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: 1d7c00616a5494792e26bb3e9b353dac6b85d62c / Ryan Zhang <[email protected]> feat(notebook-migration): add r folders to the import modal (#9427) ### What changes were proposed in this PR? This PR lets users convert a local folder of R files, the last input type for R support (#8009). It reuses the Python folder pipeline from #8767: the folder is assembled into one banner separated document, the model names an entry point, and the notebook shows that file with each operator mapped to its call site. **Folder assembly.** `folder-assembly.ts` now takes the language. A small per language table gives the file extension, the directories to skip and the name used in messages. R reads `.R` and `.r` and skips `renv` and `packrat`, which hold installed packages full of `.R` files. Python's extension, exclusions and messages are unchanged. Files in other languages are named in the folder layout and never read, as for Python, so a folder of `.py` files on the R tab gets "No R files were found in the selected folder." **R folder prompts.** `MigrationPromptSet` gains folder fields, so `convertFolderToWorkflow` takes the language like the notebook and script conversions and goes through the same R flag guard. `migration-prompts-r.ts` adds R versions of the three folder prompts, which differ from the Python ones where R differs: * `source()` is how R files load each other, and it reads a file, which a UDF cannot do. The prompt asks the model to copy every definition a UDF uses into that UDF and to never call `source()`. * R has no `if __name__ == "__main__"`, so the entry point is described as the file whose top level code sources the others and calls their functions. The worked example is a three file project: `data_prep.R` and `models.R` define functions, and `main.R` sources them and calls them in order. Unlike the Python folder example, each example UDF carries the definition of the function it calls, which is what the prompt asks for. The example was generated from a real project that runs under `Rscript`, and all six example UDFs were run through texera-rudf on `diabetes.csv`, chained the way `buildWorkflow` wires them. **Escaped slashes.** In one live run the model wrote `<\/script>` inside an R string. R rejects `\/` as an unrecognized escape, so the plot UDF failed to parse. The R visualization rules now say to write closing tags as shown, and a guard test keeps every R worked example free of `\/`. The rule is part of the shared R documentation, so it covers R notebooks and files too. **Import modal.** An "R Folder" tab after R File, laid out like the Python Folder tab with its own diagram and a directory picker. It is one more `IMPORT_TABS` entry, so the existing folder handling (directory picker, drop rejection, whole list selection) applies to it unchanged. As with the other R options, it is shown but disabled with the tooltip "R is not enabled on this deployment." when `rNotebookMigrationEnabled` is off. Its description is shorter than the Python Folder one so the tab fits the modal without scrolling. The dashboard passes the language to `parseFolder` and the folder conversion. **Assets.** A new R folder diagram, at the same size and border as the others. `frontend/LICENSE-binary` adds it to the Material Symbols entry. **Demo video (wait time cut out)** https://github.com/user-attachments/assets/f7be5cfb-fb49-46eb-a440-b4711ddad40f **R Folder disabled on a deployment without R** <img width="727" height="156" alt="image" src="https://github.com/user-attachments/assets/383e127e-9a4b-40b4-9992-1b8f2a4995ad" /> ### Any related issues, documentation, discussions? Closes #9386 Closes #8009 Parent-issue #4301 The plan is in https://github.com/apache/texera/discussions/8866. With this PR, R supports the same three inputs as Python: notebooks (#8912), files (#8963) and folders. Language mismatches between the upload and the selected tab are tracked in #8929. ### How was this PR tested? * `folder-assembly.spec.ts`: R paths (`.R` and `.r` accepted; `.py`, `.Rmd` and `.Rproj` rejected; `renv`, `packrat` and `.Rproj.user` skipped), each language's exclusions applying only to that language, the exact Python messages and the R messages, and the layout's overflow line naming R. * `notebook-migration.service.spec.ts`: `parseFolder` for R keeps the R files, names a `.py` in the layout and drops `renv`, with the R messages for no files and all blank files. The language reaches the folder conversion, and an R folder is refused before any client is created while the R flag is off. * `migration-llm.spec.ts`: the exact R folder prelude, layout and prompts, RUDF operators and the `ir` kernel from a folder, and the R flag blocking a folder without a model call. * `migration-prompts-r.spec.ts`: the folder example passes the same guards as the notebook and script examples, plus four of its own: its entry point is a file in the folder, no UDF calls `source()` and each copies the definitions it calls, the layout names a file the document leaves out, and every mapping range falls on non blank lines of the entry point. * `notebook-import-modal.component.spec.ts`: four new tests for the R Folder tab: disabled with its tooltip while the flag is off, not selectable by a click, a directory picker with the R language while the flag is on, and submit passing the whole folder with `"r"`. The tab counts now expect five. * `user-workflow.component.spec.ts`: an R folder is read and converted as R, and the Python folder test now checks `"python"`. The full frontend suite passes, and every new line and branch is covered. Checked by hand against a local stack. With the R flag on, all five tabs fit on one line, every tab fits the modal without scrolling, and the R Folder tab stages a picked folder as one R selection. Two live conversions of the example project each produced a six operator RUDF workflow with the expected edges and output types, and a notebook of only `main.R` with each operator mapped to its call site. After the slash fix, the generated UDFs ran through texera-rudf with the same accuracies as `Rscript`. These runs used the worked example's own project, so they check the pipeline more than how well the model generalizes. With the flag off, the R Folder tab is disabled, ignores clicks and shows its tooltip on one line. ### 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/44434573769 With regards, GitHub Actions via GitBox
