Skip to content

feat: get apps from R1FS#362

Open
aledefra wants to merge 8 commits intodevelopfrom
get-apps-r1fs
Open

feat: get apps from R1FS#362
aledefra wants to merge 8 commits intodevelopfrom
get-apps-r1fs

Conversation

@aledefra
Copy link
Contributor

No description provided.

@aledefra aledefra requested a review from Copilot March 10, 2026 17:30
@aledefra aledefra marked this pull request as ready for review March 10, 2026 17:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Deeploy’s /get_apps endpoint to derive its job list from blockchain escrow “active jobs” and to enrich each job with the R1FS pipeline payload plus an optional online snapshot from NetMon.

Changes:

  • Extend _get_online_apps filtering to accept multiple job_id values (list) instead of only a single scalar.
  • Add _get_apps_by_escrow_active_jobs (plus helpers) to assemble a per-job response using escrow active jobs + R1FS payload + grouped online apps.
  • Update /get_apps to use the new escrow/R1FS-based aggregation and add new response keys (online, chain_job).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
extensions/business/deeploy/deeploy_mixin.py Adds escrow-active-job aggregation and adjusts online app filtering to support multiple job IDs.
extensions/business/deeploy/deeploy_manager_api.py Switches /get_apps implementation to the new escrow/R1FS-based method (response shape change).
extensions/business/deeploy/deeploy_const.py Introduces DEEPLOY_KEYS.ONLINE and DEEPLOY_KEYS.CHAIN_JOB constants used by the new response payload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +2772 to +2776
if isinstance(job_id, int):
job_id = [job_id]
unique_job_ids = set()
for raw_value in job_id:
unique_job_ids.add(raw_value)
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_get_online_apps now assumes job_id is either an int or an iterable; if a caller passes a string (common in JSON inputs), the for raw_value in job_id loop will iterate characters and build an incorrect unique_job_ids set, filtering out all apps. Consider treating any non-sequence scalar (including str) as a single job id and normalizing types (e.g., stringify or int-cast consistently) before membership checks.

Copilot uses AI. Check for mistakes.
)
continue

if pipeline.get(NetMonCt.DEEPLOY_SPECS, {}).get(DEEPLOY_KEYS.PROJECT_ID) != project_id:
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In _get_apps_by_escrow_active_jobs, the project filter is applied unconditionally: pipeline...get(PROJECT_ID) != project_id will be true when project_id is None and the pipeline has a non-null project id, causing those jobs to be skipped even when no project filter was requested. Guard this comparison with if project_id is not None (and only skip on mismatch when the caller provided a project id).

Suggested change
if pipeline.get(NetMonCt.DEEPLOY_SPECS, {}).get(DEEPLOY_KEYS.PROJECT_ID) != project_id:
pipeline_project_id = pipeline.get(NetMonCt.DEEPLOY_SPECS, {}).get(DEEPLOY_KEYS.PROJECT_ID)
if project_id is not None and pipeline_project_id != project_id:

Copilot uses AI. Check for mistakes.
Comment on lines +2878 to +2894
if pipeline is None:
# If we don't have the details in R1FS, we skip the job. It can happen before the deploy, or for legacy jobs.
continue

pipeline_owner = pipeline[NetMonCt.OWNER.upper()]
if pipeline_owner != owner:
self.Pd(
f"Skipping R1FS payload for job {job_id}: owner mismatch "
f"(expected {owner}, got {pipeline_owner}).",
color='y'
)
continue

if pipeline.get(NetMonCt.DEEPLOY_SPECS, {}).get(DEEPLOY_KEYS.PROJECT_ID) != project_id:
self.Pd(f"Skipping R1FS payload for job {job_id}: project_id mismatch.", color='y')
continue

Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring for _get_apps_by_escrow_active_jobs says each job entry may include "pipeline": <dict|None>, but the implementation continues when pipeline is None, so those jobs are omitted entirely. Either include the job in the response with pipeline=None (and possibly still include chain_job/online) or update the docstring/endpoint contract to reflect that such jobs are skipped.

Suggested change
if pipeline is None:
# If we don't have the details in R1FS, we skip the job. It can happen before the deploy, or for legacy jobs.
continue
pipeline_owner = pipeline[NetMonCt.OWNER.upper()]
if pipeline_owner != owner:
self.Pd(
f"Skipping R1FS payload for job {job_id}: owner mismatch "
f"(expected {owner}, got {pipeline_owner}).",
color='y'
)
continue
if pipeline.get(NetMonCt.DEEPLOY_SPECS, {}).get(DEEPLOY_KEYS.PROJECT_ID) != project_id:
self.Pd(f"Skipping R1FS payload for job {job_id}: project_id mismatch.", color='y')
continue
if pipeline is not None:
pipeline_owner = pipeline[NetMonCt.OWNER.upper()]
if pipeline_owner != owner:
self.Pd(
f"Skipping R1FS payload for job {job_id}: owner mismatch "
f"(expected {owner}, got {pipeline_owner}).",
color='y'
)
continue
if pipeline.get(NetMonCt.DEEPLOY_SPECS, {}).get(DEEPLOY_KEYS.PROJECT_ID) != project_id:
self.Pd(f"Skipping R1FS payload for job {job_id}: project_id mismatch.", color='y')
continue

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants