fix(e2e): drive run_dbconnect notebook cells explicitly after the kernel is bound - #2014
fix(e2e): drive run_dbconnect notebook cells explicitly after the kernel is bound#2014rugpanov wants to merge 1 commit into
Conversation
|
🤖 Integration tests triggered for |
13f9832 to
5128b57
Compare
|
🤖 Integration tests ❌ 5 of 35 test jobs failed for |
|
🤖 Integration tests ❌ 7 of 35 test jobs failed for |
baefbfb to
510d98b
Compare
|
🤖 Integration tests ❌ 7 of 35 test jobs failed for |
…is bound
*Why*
The run_dbconnect notebook (`.ipynb`) and magic (`.py` Databricks notebook)
tests are flaky: "Run All" / "Jupyter: Run All Cells" runs the first DBConnect
cell but does not advance to the rest in the headless CI harness, so later
cells stay `<not run>` and the expected `*-output.json` files are never
written. A manual repro on a real machine confirmed this is a webdriver/xvfb
artifact — a real user's Run All runs every cell, and running the cells
one-by-one through the kernel also works. So the fix stays in the test and
keeps execution going through VS Code (real kernel + the extension's injected
spark/%sql/_sqldf/%run magics).
Two earlier attempts failed for reasons now understood from the VS Code source
(coreActions.ts / executeActions.ts):
- Executing a cell before a kernel was bound popped a modal kernel picker
that hung the executeWorkbench promise ("Remote command timeout exceeded").
- Targeting cells via `window.activeNotebookEditor` silently no-ops for the
Interactive Window (the focused editor is the `.py` text editor, not the
IW), and passing a mismatched `document` makes `notebook.cell.execute`
resolve no editor and return without running anything (no throw).
*What*
- Replace the per-cell helpers with `runNotebookCellsByUri(uriMatch)`, which:
- looks the notebook up in `vscode.workspace.notebookDocuments` (by URI
substring, or `notebookType === "interactive"` for the IW), so it works for
both the `.ipynb` editor and the Interactive Window;
- runs each not-yet-executed code cell via `notebook.cell.execute` with
`document: doc.uri` (URI-based resolution, independent of focus);
- logs which cells it dispatched and throws a precise error if the notebook
isn't found — so a no-op surfaces here, not later as a missing-file timeout.
- Notebook test: keep `Notebook: Run All` (binds kernel + runs cell 0), wait for
cell 0's output, then `runNotebookCellsByUri("notebook.ipynb")`.
- Magic test: keep `Jupyter: Run All Cells` (creates IW + binds kernel), wait
until the interactive doc's first cell has an executionOrder, then
`runNotebookCellsByUri("interactive")`, then assert both `%sql`->`_sqldf` and
`%run` outputs.
- Callbacks kept inline-arrow-only (no esbuild `__name` wrapper).
*Verification*
- `tsc --noEmit -p src/test/e2e/tsconfig.json`: 0 errors; eslint + prettier: clean.
- esbuild+keepNames transpile: 0 `__name` occurrences in the callbacks.
- Command contract confirmed against microsoft/vscode source (parseMultiCellExecutionArgs,
getEditorFromArgsOrActivePane, runCell). End-to-end validation is the
databricks-eng e2e run (requires the harness).
Co-authored-by: Isaac
510d98b to
03a6b8a
Compare
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
|
🤖 Integration tests ❌ 6 of 35 test jobs failed for |
|
Closing in favor of @anton-107's parallel stack (#2019–#2022), which covers the same Sharing what I found while investigating, in case it helps with the one case still failing in both our runs — the magic / Interactive Window test (
Happy to hand over the standalone repro project and the per-cell/IW helper if useful. Deferring to your stack for the actual fix. |
Summary
Fixes the flaky
run_dbconnect.ucwsnotebook + magic tests.Run All/Jupyter: Run All Cellsruns the first DBConnect cell but doesn't advance tothe rest in the headless CI harness, so later cells stay
<not run>and theexpected
*-output.jsonfiles are never written.Evidence this is harness-only, not a product bug
success=true, later cells<not run>.Run Allranboth
.ipynbcells; running the.pyDatabricks-notebook cells one-by-onethrough the kernel produced all four output files (
hello world,hello; world,hello run;). The progress-bar ipywidget was present throughout and did notblock advancement.
So the auto-advance stall is specific to webdriver/xvfb, not real users. The fix
stays in the test and keeps execution going through VS Code (real kernel + the
extension's injected
spark/%sql/_sqldf/%runmagics).What changed
executeNotebookCell(i)/runRemainingActiveNotebookCells()helpers thatrun cells via the VS Code
notebook.cell.executecommand.Run All. (An earlier approach drove cells from the start and hung with"Remote command timeout exceeded" — executing a cell with no kernel opens a
modal kernel picker that never resolves the
executeWorkbenchpromise.)Run All→ wait for cell 0 output → run cell 1 (%run) explicitly.Run All Cells→ wait until first cell has an executionOrder → runremaining cells → assert both
%sql→_sqldfand%runoutputs.Verification
tsc/eslint/prettier clean; esbuild+keepNames shows 0__namein the callbacks.produced all outputs).
This pull request and its description were written by Isaac.