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

Head commit for run:
8b89d0c863ca94c7670cb4b0e7e475ee5eef1376 / Ryan Zhang 
<[email protected]>
refactor(notebook-migration): select prompts and operator type by source 
language (#8910)

### What changes were proposed in this PR?

This is the first of three PRs adding R support to the migration tool
(#8009). It is a pure refactor with no behavior change: Python
conversions send the same prompts and build the same operators as
before.

The migration tool hardcodes Python in three places that R needs to
vary: the documentation and prompts sent to the model, the operator type
built from each generated UDF (`PythonUDFV2`), and the kernelspec of the
notebook derived for a script. This PR gathers those into one
`MigrationPromptSet` per source language, held in a `PROMPT_SETS` table
that only has a Python entry for now.

* `convertNotebookToWorkflow` and `convertScriptToWorkflow` take a
`language` argument, defaulting to `"python"`, and read everything from
the set.
* `buildWorkflow`, `requestConversion` and `finishConversion` receive
the operator type and notebook metadata as arguments instead of
hardcoding them.
* The three Python documentation arrays move from private statics on the
class to module level constants, unchanged, so the table can reference
them.
* The folder path uses the Python set explicitly. R folders come in a
later PR.

`MigrationLanguage` is `"python"` only in this PR. The next PR widens it
to `"python" | "r"` and adds the R set.

### Any related issues, documentation, discussions?

Part of #8009
Parent-issue #4301

The plan for R support is in
https://github.com/apache/texera/discussions/8866. The follow up PRs add
the R prompts and the R option in the import modal. They are stacked on
this one.

### How was this PR tested?

Three new tests in `migration-llm.spec.ts` pin the Python output so
later changes cannot alter it silently:

* The notebook path sends exactly the existing system prelude, workflow
prompt and mapping prompt.
* The script path does the same with the script prelude and prompts.
* Generated operators are built as `PythonUDFV2`.

The existing notebook, script and folder tests pass unchanged. Coverage
of `migration-llm.ts` is 100% of lines; the one uncovered branch is the
`@Injectable()` decorator, as before this change. The full frontend
suite passes.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5.5)

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

With regards,
GitHub Actions via GitBox

Reply via email to