Skip to content

feat(notebook-migration, frontend): upload notebooks under a per-work… - #7738

Open
zyratlo wants to merge 2 commits into
apache:mainfrom
zyratlo:migration-tool-dynamic-notebook-name
Open

feat(notebook-migration, frontend): upload notebooks under a per-work…#7738
zyratlo wants to merge 2 commits into
apache:mainfrom
zyratlo:migration-tool-dynamic-notebook-name

Conversation

@zyratlo

@zyratlo zyratlo commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Uploads each workflow's notebook to Jupyter under a per-workflow filename instead of a single shared notebook.ipynb.

Before this change the frontend always uploaded to work/notebook.ipynb. That was safe across users (each runs their own pod) but not across one user's workflows: every workflow wrote to the same file, so opening a second workflow overwrote the first, and because nothing writes back from Jupyter, any edits made in the panel were lost. Two tabs on different workflows also collided on the same file. This PR keys the notebook file on the workflow id (notebook_<wid>.ipynb) so each workflow has its own.

The backend already accepts this (from #7602): get-jupyter-iframe-url takes an optional notebookName query param and set-notebook accepts any [A-Za-z0-9._-]+\.ipynb name, which notebook_<wid>.ipynb satisfies. No backend change is needed.

NotebookMigrationService

  • Adds an exported notebookFileName(wid) helper (mirrors the existing notebookMappingKey) that returns notebook_<wid>.ipynb, or the default when there is no wid.
  • sendNotebookToJupyter(notebookData, notebookName) takes the name instead of hardcoding it.
  • getJupyterIframeURL(notebookName?) sends the name as the notebookName query param when given, and omits it otherwise so the backend default still applies.

JupyterPanelService (owns the name)

  • Adds a private currentNotebookFileName() that derives the filename from the current workflow's wid, and uses it for both the upload and the iframe fetch so the two can never derive different names.
  • Adds a public getJupyterIframeURLForWorkflow() that the panel calls to get the URL for the current workflow's notebook.

JupyterNotebookPanelComponent (view)

  • Calls jupyterPanelService.getJupyterIframeURLForWorkflow() and drops its now-unused direct dependency on NotebookMigrationService.

Because the upload and the iframe fetch both go through currentNotebookFileName(), the file that is written and the file the panel requests are always the same, and switching workflows produces a distinct notebook_<wid>.ipynb rather than overwriting a shared one.

Any related issues, documentation, discussions?

Closes #7671
Parent issue #4301

Follow-up: deleting a notebook now leaves its notebook_<wid>.ipynb file in the Jupyter pod, since deleteNotebookAndMapping only removes the database rows. This was self-limiting under the old single-file scheme. Tracked in #7737

How was this PR tested?

  • notebook-migration.service.spec.ts: notebookFileName mapping, the request body carrying the name on sendNotebookToJupyter, and the notebookName query param being present when a name is given and absent when it is not.
  • jupyter-panel.service.spec.ts: the upload uses the wid-derived filename, getJupyterIframeURLForWorkflow forwards that same filename to the HTTP client, and the disabled-flag path returns null without any HTTP call.
  • jupyter-notebook-panel.component.spec.ts: the panel fetches its URL through getJupyterIframeURLForWorkflow.

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 the frontend Changes related to the frontend GUI label Aug 17, 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:

  • Contributors with relevant context: @aglinxinyuan
    You can notify them by mentioning @aglinxinyuan in a comment.

@zyratlo
zyratlo marked this pull request as ready for review August 17, 2026 20:18
@zyratlo

zyratlo commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

/request-review @mengw15

@github-actions
github-actions Bot requested a review from mengw15 August 17, 2026 20:18
@codecov-commenter

codecov-commenter commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.04%. Comparing base (e80add4) to head (d73efb9).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #7738   +/-   ##
=========================================
  Coverage     91.03%   91.04%           
  Complexity     4459     4459           
=========================================
  Files          1174     1174           
  Lines         47139    47146    +7     
  Branches       5284     5287    +3     
=========================================
+ Hits          42915    42922    +7     
  Misses         2549     2549           
  Partials       1675     1675           
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø) Carriedforward from 1e9f891
agent-service 98.62% <ø> (ø) Carriedforward from 1e9f891
amber 87.49% <ø> (ø) Carriedforward from 1e9f891
computing-unit-managing-service 73.67% <ø> (ø) Carriedforward from 1e9f891
config-service 86.73% <ø> (ø) Carriedforward from 1e9f891
file-service 68.90% <ø> (ø) Carriedforward from 1e9f891
frontend 92.59% <100.00%> (+<0.01%) ⬆️
notebook-migration-service 83.74% <ø> (ø) Carriedforward from 1e9f891
pyamber 97.57% <ø> (ø) Carriedforward from 1e9f891
workflow-compiling-service 77.19% <ø> (ø) Carriedforward from 1e9f891

*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.

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

Adds per-workflow Jupyter notebook filenames to prevent workflows from overwriting one another.

Changes:

  • Derives notebook filenames from workflow IDs.
  • Uses the same naming scheme for uploads and iframe URLs.
  • Updates component wiring and tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
notebook-migration.service.ts Adds filename derivation and request parameters.
notebook-migration.service.spec.ts Tests filenames and HTTP payloads.
jupyter-panel.service.ts Coordinates workflow-specific upload and iframe names.
jupyter-panel.service.spec.ts Tests workflow filename forwarding.
jupyter-notebook-panel.component.ts Fetches iframe URLs through the panel service.
jupyter-notebook-panel.component.spec.ts Updates component service mocks and assertions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread frontend/src/app/workspace/service/jupyter-panel/jupyter-panel.service.ts Outdated
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Notebook Migration] Upload notebooks under a per-workflow filename

3 participants