refactor(python-notebook-migration): key the notebook mapping to the workflow's own version instead of a hardcoded vid=1 - #7791
Conversation
…low's own version instead of a hardcoded vid=1
… version-agnostic fetch
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7791 +/- ##
============================================
- Coverage 91.22% 91.20% -0.02%
+ Complexity 4471 4468 -3
============================================
Files 1171 1171
Lines 47183 47163 -20
Branches 5307 5302 -5
============================================
- Hits 43042 43015 -27
- Misses 2464 2474 +10
+ Partials 1677 1674 -3
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This PR also folds in a small unrelated cleanup effabc3: it removes the dead |
|
/request-review @mengw15 |
There was a problem hiding this comment.
Pull request overview
Fixes notebook mappings to use each workflow’s actual latest version while allowing reattachment after version changes.
Changes:
- Resolves
vidserver-side during storage. - Fetches mappings by workflow ID without version filtering.
- Updates frontend payloads and regression tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
NotebookMigrationResource.scala |
Resolves latest workflow version and makes fetch version-agnostic. |
NotebookMigrationResourceSpec.scala |
Tests version resolution and reattachment behavior. |
notebook-migration.service.ts |
Removes vid from storage requests. |
notebook-migration.service.spec.ts |
Verifies version-free storage payloads. |
jupyter-panel.service.ts |
Removes vid from fetch requests and unused panel helper. |
jupyter-panel.service.spec.ts |
Updates fetch tests and removes obsolete helper tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
What changes were proposed in this PR?
This PR resolves the real version ID of a workflow instead of the constant, and makes the fetch version-agnostic so a mapping keeps reattaching after the workflow's version advances.
notebook.widis UNIQUE (one notebook per workflow) and the fetch join is onwid + nid, so keying onwidalone is sufficient and correct.NotebookMigrationResource(store resolves the version, fetch drops the vid filter)MAX(workflow_version.vid)for the wid, anchoring the mapping to the workflow's own latest version rather than a client-supplied value. If the workflow has no version to anchor to, it returns a 400 before any insert instead of a 500 from the FK.notebook.widUNIQUE constraint and re-adding a vid filter (falling back to the latest), since without it a multi-notebook workflow would silently return only the newest.NotebookMigrationService(frontend store)storeNotebookAndMappingdrops itsvidparameter and stops sendingvidin the request body. The version is now resolved by the backend.JupyterPanelService(frontend fetch)fetchNotebookAndMappingdrops itsvIdparameter and thevidfield from the request body, along with the stale "Future work: add dynamic fetching of current workflow vId" comment. The panel reattaches by wid.Any related issues, documentation, discussions?
Closes #7636
Parent issue #4301
How was this PR tested?
Added tests in
NotebookMigrationResourceSpec.scalanotebook-migration.service.spec.tsjupyter-panel.service.spec.tsAlso manually verified on local development environment.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)