Skip to content

refactor: redesign notebook cell dimensions and responsive views - #606

Open
emrberk wants to merge 17 commits into
mainfrom
refactor/notebook-dimensions
Open

refactor: redesign notebook cell dimensions and responsive views#606
emrberk wants to merge 17 commits into
mainfrom
refactor/notebook-dimensions

Conversation

@emrberk

@emrberk emrberk commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Redesign notebook cell sizing and responsive views so users can independently size the editor and results, preserve their preferred layout across viewport changes, and use consistent resize and visibility controls.
  • Replace grid-height and maximized-view agent semantics with independent editor_height, result_height, and view controls.
  • Report the effective responsive view and compact/wide tier while preserving the preferred view intent.
  • Add a per-cell Stop control for cancelling initial query runs and chart fetches.
  • Make chart zoom controls responsive to the rendered data density and available width, while keeping Reset Zoom available across viewport changes.
  • Treat hiding a result as an explicit discard action that clears the current result and saved snapshot while preserving the preferred layout for future runs.
  • Preserve run history and copy matching saved result snapshots when duplicating notebooks, without switching the active tab.
  • Return faithful JSON previews and preserve semantic dimensions in snapshots.

Validation

  • yarn typecheck
  • yarn test:unit (2,160 tests across 95 files)
  • focused notebook snapshot/tool/controller tests (252 tests)
  • yarn build
  • targeted ESLint and git diff --check

Deferred follow-up

  • Update mcp-server-questdb for the new notebook tool contract.
  • Bump the MCP server version.
  • Update EXPECTED_MCP_VERSION in this repository after that release.

@emrberk emrberk changed the title Refactor notebook cell dimensions and responsive views refactor: redesign notebook cell dimensions and responsive views Sep 1, 2026
emrberk and others added 13 commits September 2, 2026 18:36
Replace isViewMaximized/wideView/compactView with one stored
preferredView. The rendered pane layout derives from that preference,
result availability, and the responsive tier; resizing never rewrites it.

- Persisted isViewMaximized migrates to preferredView on read and import.
- Agent reads report preferred_view plus live view/tier from the
  renderer's hydration-aware pane state.
- Drop legacy tool inputs: editor_visible, is_view_maximized, grid h
  back-solve, and the set_cell_view_maximized tool.
- Reveal a result hidden by an editor preference when the user runs,
  or switches to Table/Chart, in any tier.
- Reserve grid rows for a multi-statement result when any statement
  renders a grid, not only the first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ceLPBG4yUmAWH1zqYD9w8
…ontract

- Cells resolve their pane layout during render. The grid expansion delay
  is gone, so tool responses and the rendered pane always agree.
- Grid transitions run for drag, drop, and width changes. They are
  suppressed only while the notebook container is being resized. Item
  height never animates, so a pane switch and its box land together.
- The measured grid container width is published once per notebook and
  read by set_cell_layout, instead of travelling through every cell.
- apply_notebook_state rejects changing an existing cell's kind.
- Markdown cells report preferred_view, view, and result_height as null.
  view and result_height inputs are ignored for markdown instead of
  rejected. auto_refresh is dropped for markdown.
- Tool descriptions and the notebook prompt describe the new contract.
- e2e/questdb submodule bumped to current master.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015sKRGPKxxoNvBSKEPrEP4K
…fter persist, statement key memo

- Stop button in the cell header for a first run or first chart fetch:
  cancels the run, or aborts the chart round with a cancelled canvas state
  and Retry. Draw from an empty cell counts as a first run, so its
  validation can be stopped too. Refreshes never show it.
- Cancel markers: a launched statement keeps the unverifiable
  "Cancelled by user" error; a queued or never-started one is recorded as
  cancelled by the user, and the sequential cascade tells an abort from a
  failure.
- A deleted cell's in-flight run is superseded, so the agent is told the
  cell was deleted instead of that its result was cleared.
- Snapshot rows drop only after the document write lands; the live
  controller's transitions settle after the write and report
  persist_failed on failure.
- Per-consumer statement key memo and per-frame result key cache, so a
  keystroke over a large script formats one statement.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…le, linear key passes

- delete the 500-entry identity map, the per-consumer key memo, and the
  per-frame WeakMap; normalizeStatementIdentity calls the formatter directly
- charts compare statements by formatter identity: a whitespace or casing edit
  keeps the frame and runs nothing
- an edit-triggered chart settle carries every statement with chartable rows
  and executes only the edited ones; poll ticks and manual refresh still run all
- CellBottomContent derives its tab list from the engine debounced queries,
  so a keystroke never re-keys the cell
- the engine keeps slotKeys and identities per entry, derived once per SQL
  change; grid rounds carry frame keys through commits instead of re-keying
  per slot; reconcile and hydration take precomputed keys
- resultsEquivalent skips the identity compare for byte-identical queries
- statementIdentityPasses.test pins formatter calls per event

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@emrberk

emrberk commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

PR #606 Review

Reviewing PR #606 at level 3

Reviewed head: a36aa4e812b15270f237aaddb27ab6f3d2031d34
Base revision: 72ca5487b263fba39ecd2e9221066b03535b4c75

The title and description follow the repository conventions.

Issues

Issue ID Issue name Category Severity Location Net impact Evidence Description Steps to reproduce Suggested fix
#1 Refresh rerenders entire cell Performance & rendering at scale Moderate in-diff — src/scenes/Editor/Notebook/cells/Cell.tsx:164 Multi-statement dashboards spend up to 141 ms rerendering one cell. Playwright React profiler: the same eight-statement refresh produced 13 renders/44.7 ms at head a36aa4e, versus 2 renders/6.5 ms at base 72ca5487. CellInner subscribes to every raw refresh-engine state object, although grid cells do not consume the subscribed value. Eight statements add eleven full-cell renders; 32 statements produced 37 renders and 141.4 ms of cell work. This repeats at the two-second auto-refresh minimum and compounds across dashboard cells. 1. Create an eight-statement grid cell.
2. Run it, then refresh the unchanged results.
3. Count CellInner commits: head consistently produces 13 versus 2 at base.
Subscribe to a selector-filtered fetching boolean, suppress unchanged values, and avoid installing the subscription for grid cells—for example, isolate the draw Stop gate in a small child.
#2 Divider collapses tall cell Accessibility & UX Moderate in-diff — src/scenes/Editor/Notebook/cells/useCellResizeOrchestration.ts:111 Tall split-cell users lose 2,300 px in one divider interaction. Scratch Vitest at head a36aa4e: 4,800 px becomes 2,500 px. Base End path is N/A because keyboard resizing is a new surface; the equivalent base mouse partition preserves the total. With both panes at the permitted 2,400 px maximum, the middle divider advertises a 4,700 px maximum. Pressing End partitions the cell as 4,700/100, after which the independent pane clamp converts it to 2,400/100, unexpectedly collapsing the total height. 1. Set a split SQL cell's editor and result heights to 2,400 px.
2. Focus the middle divider.
3. Press End.
4. Observe the allocation fall from 4,800 to 2,500 px.
Derive divider bounds so both panes stay within their individual maxima: clamp the requested top between sum - MAX_PANE_HEIGHT_PX and min(MAX_PANE_HEIGHT_PX, sum - minBottom). Add the 2,400/2,400 boundary test.
#3 Stop control untested Test review & coverage Moderate in-diff — src/scenes/Editor/Notebook/cells/CellStopButton.tsx:28 Notebook runners lack regression coverage for the new cancel control. Exact test search at head a36aa4e found no component or data-hook matches; lower-layer cancellation tests passed 141/141. Base is N/A because this is a new surface. Existing tests verify cancellation helpers and the refresh engine directly, but none mounts the new control or verifies its visibility, grid/chart routing, click dispatch, removal, or focused-unmount handoff. Those integration points could regress while every current test remains green. 1. Hold a notebook cell's first /exec request.
2. Assert that the Stop control appears and click it.
3. Assert cancellation and button removal.
4. Repeat for the initial chart-fetch branch.
Extend the existing delayed-/exec Cypress notebook flow to cover grid and chart cancellation, including focus handoff.

Validation

  • yarn typecheck: passed
  • yarn build: passed
  • yarn lint: passed
  • yarn test:unit: passed — 95 files, 2,160 tests
  • git diff --check: passed
  • Browser rung: the responsive chart zoom/reset path passed with Playwright against the no-auth localhost:10000 server. The repository Cypress helper hard-codes an authenticated login, so that scenario was executed directly in the browser.
  • Temporary review files and worktrees were removed. Pre-existing workspace changes were left untouched.

Summary

  • Verdict: approve with comments — address wip test for error range #1disabled buttons #3, but none is blocking.
  • Correctness gate: passed — no admitted Critical findings.
  • Test gate: passed — 1 admitted Moderate coverage gap and 0 Critical coverage gaps.
  • Findings: 3 in-diff, 0 out-of-diff. The level-3 cross-context inventory was rechecked and the remaining findings are contained within the changed surface.
  • Severity: 0 Critical, 3 Moderate, 0 Minor.
  • Adjacent findings: none.

@emrberk
emrberk marked this pull request as ready for review September 8, 2026 10:33
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Web Console deploy preview

Preview Commit Logs
https://pr-606--web-console.netlify.app 48bfc80 build log

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