Conversation
2795d68 to
2f55a8d
Compare
There was a problem hiding this comment.
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_appsfiltering to accept multiplejob_idvalues (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_appsto 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.
| 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) |
There was a problem hiding this comment.
_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.
| ) | ||
| continue | ||
|
|
||
| if pipeline.get(NetMonCt.DEEPLOY_SPECS, {}).get(DEEPLOY_KEYS.PROJECT_ID) != project_id: |
There was a problem hiding this comment.
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).
| 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: |
| 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 | ||
|
|
There was a problem hiding this comment.
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.
| 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 |
No description provided.