The GitHub Actions job "Required Checks" on texera.git/main has succeeded.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
fa075d11541a3282562ed6ade743548cb8586d1b / Ryan Zhang 
<[email protected]>
feat(python-notebook-migration): add Jupyter panel mapping highlight service 
(#5263)

### What changes were proposed in this PR?
Introduces `JupyterPanelService`, which carries the bidirectional cell
to operator highlight orchestration, plus the workflow editor hook that
calls into it on operator click.

**`JupyterPanelService`**
- `init()`: subscribes to `workflowMetaDataChanged()` and is registered
as an `APP_BOOTSTRAP_LISTENER` in `app.module.ts` so it starts on app
bootstrap. On each workflow change it drops any stale mapping for the
current workflow (inline `deleteMapping("mapping_wid_" + currentWid)`),
fetches the new workflow's stored notebook and mapping from the
microservice, sends the notebook to JupyterLab, and precomputes the
highlight index.
- `setIframeRef(iframe)`: called by the panel component (in
`migration-tool-jupyter-panel`) once its iframe is in the DOM.
- `onWorkflowComponentClick(cellUUID)`: public entry called by the
workflow editor's click handler. If the iframe is present and the cell
UUID maps to operators, it posts a `triggerCellClick` message to the
notebook so the matching cell scrolls into view and is highlighted. The
editor hook fires this once per click and only for operators.
- `precomputeHighlightMapping` (private): builds a `cellUUID` keyed
index of `{ components, edges }` from the stored mapping and the current
graph's links, for O(1) lookup per cell click. It resets on every run so
entries from a previously opened workflow do not linger, and it records
each cell's components even when the graph has no links.
- `handleNotebookMessage` (private): the `window` message handler
installed in the constructor. It validates `event.origin` against the
cached Jupyter origin, ignores messages whose data is not an object,
then dispatches `highlightFromCell` for `cellClicked` events.
- `resolveJupyterOrigin` (private): resolves the Jupyter server origin
once and caches it (the backend serves a process static base URL). Both
the origin check and the `postMessage` target use it, normalized with
`new URL(...).origin`, so there is no network call per message or per
click.
- `highlightFromCell` (private): issues the `unhighlightOperators` /
`unhighlightLinks` and `highlightOperators` / `highlightLinks` calls
against `WorkflowActionService`.
- `fetchNotebookAndMapping` (private): `POST
/api/notebook-migration/fetch-notebook-and-mapping`, sets the mapping
cache and forwards the notebook to JupyterLab. Returns `1` if both
succeeded, `0` otherwise (caught errors included).

The service is a `providedIn: "root"` singleton with no unused
dependencies, decorators, or dead state.

**`frontend/LICENSE-binary`**
This service is the first reachable consumer of
`NotebookMigrationService`, which statically bundles the `ai` SDK, so
the AI SDK npm packages now land in the frontend bundle.
`LICENSE-binary` claims them: `ai`, `@ai-sdk/openai`, `@ai-sdk/gateway`,
`@ai-sdk/provider`, `@ai-sdk/provider-utils`, `@opentelemetry/api`,
`@vercel/oidc` (Apache-2.0), and `zod`, `eventsource-parser` (MIT). All
are ASF Category A and none ship a NOTICE file.

### Any related issues, documentation, discussions?
Closes #5053
Parent issue #4301

### How was this PR tested?
`jupyter-panel.service.spec.ts` (Vitest) covers `init` (subscribe, stale
mapping cleanup, fetch), `fetchNotebookAndMapping`,
`precomputeHighlightMapping` for both linked and linkless graphs plus
its per run reset, `highlightFromCell`, `onWorkflowComponentClick`
including the cached origin resolving only once across clicks, and the
feature flag gate. All tests pass.

### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.8)

Report URL: https://github.com/apache/texera/actions/runs/29962476680

With regards,
GitHub Actions via GitBox

Reply via email to