Skip to content

refactor(job): migrate progress path to job-scoped endpoint - #829

Merged
RapidPoseidon merged 1 commit into
mainfrom
refactor(job)/job-scoped-progress
Aug 19, 2026
Merged

refactor(job): migrate progress path to job-scoped endpoint#829
RapidPoseidon merged 1 commit into
mainfrom
refactor(job)/job-scoped-progress

Conversation

@jorgeparavicini

Copy link
Copy Markdown
Contributor

What & why

Migrates RapidataJob's status / progress-bar path off the pipeline + workflow HTTP endpoints onto the new GET /job/{jobId}/progress added (and merged) in rapidata-backend. Previously the job class unpacked the pipeline (GET /pipeline/{pipelineId}) to find the workflow id, then called GET /workflow/{workflowId}/progress — the same anti-pattern the frontend already moved away from.

SDK-only — the backend endpoint is already live.

Changes

  • rapidata_job.py — replace _get_workflow_progress() (pipeline-unpacking + workflow-progress) with _get_job_progress(), a single call to job_api.job_job_id_progress_get(self.id). get_progress() and display_progress_bar() now read completionPercentage from the job-scoped output. The new output exposes the same completionPercentage field, so no progress-bar behaviour changes. 404 (job has no labelling task yet) is still swallowed → treated as 0%.
  • OpenAPI client — regenerated against current prod (api.rabbitdata.ch). This is a full api_client refresh, same as the repo's periodic "update OpenAPI client" commits.
  • get_results() — untouched; still uses download-results. Confirmed working after regeneration.

Out of scope, left exactly as-is

  • The order flow (rapidata_order.py) and config/_qr_preview.py, which still legitimately use /pipeline/{id} and /workflow/{id}/progress for the deprecated-but-live order path.
  • The client-side workflow builder classes under workflow/_*.py.

⚠️ One deviation worth a look — generator keep-list

The backend PR that added the job-scoped endpoint also marked GET /pipeline/{pipelineId} and GET /workflow/{workflowId}/progress as deprecated. generate-schema.sh strips deprecated operations from the generated client — so a faithful regeneration removes exactly the two methods the out-of-scope order / QR flow still calls, leaving that flow uncompilable (pyright errors).

To honour "leave the order/qr flow untouched" while keeping a compiling client, I added a narrow keep-list to the deprecation filter in generate-schema.sh that exempts just those two paths. Everything else deprecated is still stripped (e.g. workflow_workflow_id_get, .../responses, .../compare-ab-summary — none consumed by the SDK — are correctly gone).

On the spec/removal question: there is no endpoint filter — the SDK generates the entire joined backend spec, minus deprecated operations/fields. So nothing was (or could be) selectively removed; regeneration would just re-add it. The only lever is the deprecation filter, hence the keep-list. When the order/qr flow migrates onto job/order-scoped endpoints, drop the keep-list and these two endpoints fall out on their own.

Verification

  • uv run pyright src/rapidata/rapidata_client0 errors
  • uv run pytest136 passed, 4 failed. The 4 failures are pre-existing on main (audience cost-warning / explicit-content-check tests — confirmed failing on a clean checkout before this change), unrelated to this migration.
  • uv run black on the changed file → clean.

🔗 Session: https://poseidon.rapidata.internal/chat/node-f6b42c70

Point RapidataJob's status/progress path at the new GET /job/{jobId}/progress
instead of unpacking the pipeline to find the workflow and calling
GET /workflow/{workflowId}/progress. This drops the pipeline-unpacking
anti-pattern from the job class; get_results() (download-results) is unchanged.

Regenerate the OpenAPI client against current prod. The backend change that
added the job-scoped endpoint also deprecated GET /pipeline/{pipelineId} and
GET /workflow/{workflowId}/progress, which the generator strips; the still-live
order / QR-preview flow calls both directly, so a narrow keep-list in
generate-schema.sh keeps them generated until that flow migrates too.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: jorge <24812622+jorgeparavicini@users.noreply.github.com>
@jorgeparavicini
jorgeparavicini marked this pull request as ready for review August 19, 2026 11:57
@RapidPoseidon
RapidPoseidon merged commit 1cbf084 into main Aug 19, 2026
2 checks passed
@RapidPoseidon
RapidPoseidon deleted the refactor(job)/job-scoped-progress branch August 19, 2026 13:20
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.

3 participants