Repository navigation
feat(notebook): disable SQL cells without deleting their source - #1541
shu-chen-dot-ca wants to merge 2 commits into
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge I found no defects in the new commit
Files Reviewed (2 files)
Previous Review Summary (commit a3b1b9a)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit a3b1b9a)Status: No Issues Found | Recommendation: Merge I found no defects in the changed code. I read the diff and the saved patch output for the source files. I did not run the tests, and I did not read the changes under Files Reviewed (31 files)
Reviewed by claude-sonnet-5.5 · Input: 248 · Output: 1.1K · Cached: 194.9K Review guidance: REVIEW.md from base branch |
a3b1b9a to
355fab1
Compare
|
Rebased onto main (5725dad) to resolve the conflict. The only conflict was in |
Fixes #1510.
Adds an enabled/disabled state to SQL notebook cells. A disabled cell keeps its source, configuration and last output, but nothing in the notebook sends it to the database until it is enabled again. That covers a direct run, Run All and automatic prerequisite resolution.
types/notebook.tsisDisabledon SQL cells and in the file format. Absent means enabled, so legacy cells and files load as enabled.RunAllResultgainsblockedandblockedCells. Each blocked cell lists the disabled cells it waits on.utils/notebookRunAll.tsgetExecutableCellsleaves disabled cells out;getDisabledCellslists them, so Run All counts them as skipped.findDisabledPrerequisites(sql, cells, prepare)returns the disabled cells that stop a query: referenced directly, or through referenced cells that would have to run first because they have no current result. It resolves notebook parameters (so@source = {{cell_1}}counts) and handles reference cycles.addBlockedrecords a blocked cell;formatRunAllSummaryreports blocked cells.utils/notebookVariables.ts: a disabled cell is never scheduled as a dependency, and its cached output is never substituted into a consumer's CTE (it stays an unresolved reference).NotebookView.tsxexecute_querycall.isDisabled. Disabling does not claim the query was cancelled.NotebookCellHeader.tsx/NotebookCellWrapper.tsxaria-pressed, a translatedaria-label/title("Disable cell" / "Enable cell"), visible focus and theme tokens.SqlCell.tsxRunAllSummary.tsx: "N blocked", and for each blocked cell a link to it and to the disabled cell it waits on.notebookFile.ts/notebookUndo.tsisDisabledis written only when true, and read only from a literaltrueon SQL cells.Out of scope, as the issue says: cancellation, scheduling and read-only enforcement. The SQL source export still includes disabled cells' SQL, since the issue only covers execution. Happy to leave them out or comment them out there if preferred.
Tests:
tests/utils/notebookRunAll.test.tstests/utils/notebookFile.test.ts: round trip, enabled cells not written, legacy file loads as enabled, malformed values ("true",1,null,{}) ignored, never set on Markdown.tests/utils/notebookUndo.test.ts: signature change, describe disable/enable, undo/redo of a disable.tests/utils/notebookVariables.test.ts: a disabled cell's cached output is not substituted, and a disabled cell is not scheduled as a dependency.tests/components/notebook/NotebookView.test.tsxtests/components/notebook/NotebookCellWrapper.test.tsx,SqlCell.test.tsxand the newRunAllSummary.test.tsx: toggle name, state and handler; disabled run button with its reason; badge; disabled plan button with no EXPLAIN request; no toggle on Markdown; the notices; the summary links.Validation:
pnpm typecheck && pnpm lint && pnpm format:check && pnpm web:boundaries && pnpm web:packaging && pnpm web:docs && pnpm web:manual-parity && pnpm test:contrast && pnpm build && pnpm test run --maxWorkers=4: all passed (565 files, 9125 tests). No Rust changes.serializeNotebookHIGH: it is the save path of every notebook (create, rename, import); the change there is one optional field written only when true.NotebookCellHeader,documentSignature,deserializeNotebookandrunCellInnerLOW.getExecutableCells,findUnresolvedDependenciesanddescribeChangehave no resolved callers in the index; text search shows they are used only inNotebookViewandNotebookHistoryPanel.detect-changesbefore each commit: notebook symbols only. Risk is high becauseNotebookViewis in many flows; the export handlers it lists only moved down the file.{{cell_1}}:execute_queryafter disabling, including after re-enabling.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.