You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Notebook Migration] Notebook mapping is stored and fetched against a hardcoded vid=1 #7636
The Python notebook migration tool stores a notebook and its cell-to-operator mapping so the Jupyter panel can reattach them when a generated workflow is reopened. Both the store and the fetch paths currently key this data by a hardcoded workflow version id of 1.
Store: NotebookMigrationService.storeNotebookAndMapping(...) defaults its vid parameter to 1, and the dashboard generate flow omits it. (frontend/src/app/workspace/service/notebook-migration/notebook-migration.service.ts)
Fetch: JupyterPanelService.fetchNotebookAndMapping(...) hardcodes vId = 1 and already carries a // Future work: add dynamic fetching of current workflow vId comment. (frontend/src/app/workspace/service/jupyter-panel/jupyter-panel.service.ts)
The feature works today because store and fetch use the same constant, so the keys line up and the panel reattaches. The value itself is wrong.
workflow_version.vid is a global SERIAL PRIMARY KEY, not a per-workflow version counter. The mapping table keys on (wid, vid, nid) and declares FOREIGN KEY (vid) REFERENCES workflow_version(vid) ON DELETE CASCADE.
Consequences of pinning every generated workflow's mapping to vid=1:
Every generated workflow's mapping is FK-anchored to a single unrelated version row (whichever workflow owns global vid=1).
Deleting the workflow that owns vid=1 cascade-deletes every generated notebook mapping.
If no row with vid=1 exists, the store insert violates the foreign key and fails.
Proposed Solution or Design
Resolve and persist the actual version id for the workflow instead of the constant:
Surface the real vid assigned to the newly created workflow.
Pass that real vid into storeNotebookAndMapping from the dashboard generate flow.
Resolve the current workflow's version dynamically on the fetch side, so the fetch key matches the stored one. This is the work the existing fetch-side TODO defers.
Store and fetch must stay in agreement: changing only one side breaks the match and the panel stops reattaching.
The solution should have:
Generated workflows store their mapping under their own workflow version id.
The Jupyter panel reattaches the mapping using the same resolved version id.
Deleting an unrelated workflow does not remove another workflow's mapping.
The hardcoded vid=1 and its Future work comment are removed from both paths.
Activity
zyratlo commentedon Aug 13, 2026
/parent-issue #4301
refactor(python-notebook-migration): key the notebook mapping to the …