Skip to content

refactor(python-notebook-migration): key the notebook mapping to the workflow's own version instead of a hardcoded vid=1 - #7791

Merged
mengw15 merged 6 commits into
apache:mainfrom
zyratlo:migration-tool-dynamic-workflow-vid
Aug 20, 2026
Merged

refactor(python-notebook-migration): key the notebook mapping to the workflow's own version instead of a hardcoded vid=1#7791
mengw15 merged 6 commits into
apache:mainfrom
zyratlo:migration-tool-dynamic-workflow-vid

Conversation

@zyratlo

@zyratlo zyratlo commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

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.wid is UNIQUE (one notebook per workflow) and the fetch join is on wid + nid, so keying on wid alone is sufficient and correct.

NotebookMigrationResource (store resolves the version, fetch drops the vid filter)

  • Store no longer reads a vid from the request. It resolves the mapping's vid server-side as 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.
  • Fetch no longer reads a vid or filters the query by it, so the stored mapping still resolves after the workflow advances to a newer version.
  • Adds a future-work note at the fetch query: supporting one notebook per workflow version would mean dropping the notebook.wid UNIQUE 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)

  • storeNotebookAndMapping drops its vid parameter and stops sending vid in the request body. The version is now resolved by the backend.

JupyterPanelService (frontend fetch)

  • fetchNotebookAndMapping drops its vId parameter and the vid field 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.scala
  • notebook-migration.service.spec.ts
  • jupyter-panel.service.spec.ts

Also 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)

@github-actions github-actions Bot added frontend Changes related to the frontend GUI platform Non-amber Scala service paths labels Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@codecov-commenter

codecov-commenter commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.20%. Comparing base (ee06e4b) to head (ebf3bc9).
⚠️ Report is 3 commits behind head on main.

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     
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø)
agent-service 98.62% <ø> (ø) Carriedforward from 2d60462
amber 87.93% <ø> (-0.08%) ⬇️ Carriedforward from 2d60462
computing-unit-managing-service 73.67% <ø> (ø)
config-service 86.73% <ø> (ø)
file-service 68.90% <ø> (ø)
frontend 92.66% <100.00%> (+0.02%) ⬆️
notebook-migration-service 79.13% <100.00%> (+0.01%) ⬆️
pyamber 97.57% <ø> (ø) Carriedforward from 2d60462
workflow-compiling-service 77.19% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zyratlo

zyratlo commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

This PR also folds in a small unrelated cleanup effabc3: it removes the dead JupyterPanelService.openPanel. mengw15 flagged it (#7741 (review)). The method lost its only production caller when #7571 removed the toolbar import branch, and its comment still described that flow, which no longer exists. Since this PR already touches jupyter-panel.service.ts, it was a convenient place to land the cleanup. The jupyterNotebookExists toolbar signal is still set on the normal path in init(), so no behavior is lost.

@zyratlo
zyratlo marked this pull request as ready for review August 19, 2026 23:25
@zyratlo

zyratlo commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

/request-review @mengw15

@github-actions
github-actions Bot requested a review from mengw15 August 19, 2026 23:25
@mengw15
mengw15 requested a balanced review from Copilot August 19, 2026 23:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes notebook mappings to use each workflow’s actual latest version while allowing reattachment after version changes.

Changes:

  • Resolves vid server-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.

@mengw15 mengw15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mengw15
mengw15 added this pull request to the merge queue Aug 20, 2026
Merged via the queue into apache:main with commit 68c5774 Aug 20, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI platform Non-amber Scala service paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Notebook Migration] Notebook mapping is stored and fetched against a hardcoded vid=1

4 participants