Skip to content

fix(e2e): drive run_dbconnect notebook cells explicitly after the kernel is bound#2014

Draft
rugpanov wants to merge 1 commit into
mainfrom
fix/run-dbconnect-progress-bar-stall
Draft

fix(e2e): drive run_dbconnect notebook cells explicitly after the kernel is bound#2014
rugpanov wants to merge 1 commit into
mainfrom
fix/run-dbconnect-progress-bar-stall

Conversation

@rugpanov

@rugpanov rugpanov commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the flaky run_dbconnect.ucws notebook + magic tests. Run All /
Jupyter: Run All Cells runs the first DBConnect cell but doesn't advance to
the rest in the headless CI harness, so later cells stay <not run> and the
expected *-output.json files are never written.

Evidence this is harness-only, not a product bug

  • Cell-level diagnostics (test(e2e): capture notebook cell errors in run_dbconnect diagnostics #2013) showed cell 0 success=true, later cells <not run>.
  • Manual repro on a real machine (real serverless DBConnect): Run All ran
    both .ipynb cells; running the .py Databricks-notebook cells one-by-one
    through the kernel produced all four output files (hello world, hello; world,
    hello run;). The progress-bar ipywidget was present throughout and did not
    block 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/%run magics).

What changed

  • Add executeNotebookCell(i) / runRemainingActiveNotebookCells() helpers that
    run cells via the VS Code notebook.cell.execute command.
  • Only execute cells explicitly AFTER the kernel is bound by the initial
    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 executeWorkbench promise.)
  • Notebook test: Run All → wait for cell 0 output → run cell 1 (%run) explicitly.
  • Magic test: Run All Cells → wait until first cell has an executionOrder → run
    remaining cells → assert both %sql_sqldf and %run outputs.

Verification

  • tsc/eslint/prettier clean; esbuild+keepNames shows 0 __name in the callbacks.
  • Underlying execution verified working on a real workspace (one-by-one cell run
    produced all outputs).
  • End-to-end validation is the databricks-eng e2e run (requires the harness).

This pull request and its description were written by Isaac.

@rugpanov

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests triggered for 13f98326 — ⏳ running.
View run

@rugpanov rugpanov force-pushed the fix/run-dbconnect-progress-bar-stall branch from 13f9832 to 5128b57 Compare July 15, 2026 09:05
@rugpanov rugpanov temporarily deployed to test-trigger-is July 15, 2026 09:06 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 15, 2026 09:06 — with GitHub Actions Inactive
@rugpanov

rugpanov commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ❌ 5 of 35 test jobs failed for 5128b575 (30 passed).
View run

@rugpanov

rugpanov commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ❌ 7 of 35 test jobs failed for baefbfb1 (28 passed).
View run

@rugpanov rugpanov force-pushed the fix/run-dbconnect-progress-bar-stall branch from baefbfb to 510d98b Compare July 15, 2026 14:44
@rugpanov rugpanov temporarily deployed to test-trigger-is July 15, 2026 14:44 — with GitHub Actions Inactive
@rugpanov rugpanov changed the title fix(e2e): disable DBConnect progress bar so run_dbconnect Run All advances past the first cell fix(e2e): drive run_dbconnect notebook cells explicitly after the kernel is bound Jul 15, 2026
@rugpanov rugpanov temporarily deployed to test-trigger-is July 15, 2026 14:46 — with GitHub Actions Inactive
@rugpanov

rugpanov commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ❌ 7 of 35 test jobs failed for 510d98bc (28 passed).
View run

…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
@rugpanov rugpanov force-pushed the fix/run-dbconnect-progress-bar-stall branch from 510d98b to 03a6b8a Compare July 16, 2026 10:06
@rugpanov rugpanov temporarily deployed to test-trigger-is July 16, 2026 10:06 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/vscode

Inputs:

  • PR number: 2014
  • Commit SHA: 03a6b8a865567efd4437e587d611ab787278266c

Checks will be approved automatically on success.

@rugpanov

rugpanov commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ❌ 6 of 35 test jobs failed for 03a6b8a8 (29 passed).
View run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant