zyratlo opened a new pull request, #7602: URL: https://github.com/apache/texera/pull/7602
### What changes were proposed in this PR? Makes `notebook-migration-service` stateless so it can later run as a single global instance instead of one instance per user. This is the first backend stage of moving the service onto Texera's "orchestrator services are global, stateful resources are per user" pattern. Today the service keeps a shared `@volatile jupyterIframeURL`: `set-notebook` writes it and `get-jupyter-iframe-url` reads it back. That shared state is only safe because each user happens to run their own pod, and even within one user it lets two browser tabs race. This PR removes the shared state and builds the URL from the request instead. **`NotebookMigrationResource.scala`** - Removes the `@volatile var jupyterIframeURL` singleton and the warning comment that documented its per-user-pod assumption. Adds a `defaultNotebookName` constant (`notebook.ipynb`). - `getJupyterIframeURL` now takes a `notebookName` argument and builds the URL on each call. The name is validated with the same plain `.ipynb` regex `setNotebook` uses, since it now flows straight into the returned URL (blocks path traversal). The argument defaults to `defaultNotebookName`. - `setNotebook` no longer mutates any shared state; the assignment that wrote the singleton is gone. Its upload behavior is unchanged. - The `/get-jupyter-iframe-url` endpoint accepts an optional `notebookName` query parameter and falls back to the default when it is absent. The change is backward compatible. The existing frontend calls the endpoint with no query parameter, which resolves to `notebook.ipynb`, exactly the URL it received before. No frontend, config, or deployment change is needed in this PR, and no other service or branch consumes the removed state. ### Any related issues, documentation, discussions? Closes #7390 Parent-issue #4301 ### How was this PR tested? Extends the existing suite in `NotebookMigrationResourceSpec.scala`: - Fixed the two call sites that pass through the new endpoint signature. - Added a test that an explicit `notebookName` is honored in the returned URL. - Added a test that an invalid `notebookName` is rejected with 400 before any Jupyter call. - Added a test pinning the refactor: after `setNotebook` uploads `other.ipynb`, a parameter-less `getJupyterIframeURL` returns the default `notebook.ipynb`, proving the result no longer depends on state left by `setNotebook`. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 4.8) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
