port: tables, resizing, markdown in cells, carry, motion (stacked on #845) #854

Closed
kayg wants to merge 29 commits from port/port-tables-2 into port/port-tables
Owner

Stacked on #845 (base port/port-tables). The rest of the approved table behaviour.

What it does

  • Resize columns and rows. A mouse drags a column's right border or a row's bottom border (cursor says where; a second press on the border lets the column size itself again). A finger picks the column or row, then drags the handle on its edge. Never narrower than the longest word: the browser's table layout enforces that, and the width kept is what the column really became. A table with a width of its own may be wider than its card and then scrolls.
  • Where widths live (the mockup's storage, ADR 0056 / 0068, no new key): frontmatter table-widths: [[14, null, 4, 5]], characters, one list per table in document order, null for a column that sizes itself. The table's own pipes are never touched. Widths follow their column when columns are added, removed or moved. Row heights are UI state, never saved (as in the mockup).
  • Markdown in cells. **bold**, *italic*, ~~strike~~, ==mark==, `code` and links are drawn at rest; with the caret in a cell it shows the file's markdown, so what is typed is exactly what is saved (the caret goes to the end of a cell that has formatting). Built from DOM nodes, never HTML strings.
  • Carry a picked row or column by its strip; the others make room, it settles, then the order changes.
  • Motion (Emil's rules): a pointer's add / delete / move / sort slides what was there, new rows and columns ease in, leaving ones fade; all < 300 ms, ease-out, nothing from scale(0); keys and reduced motion play nothing. Tested.
  • Copy a picked row or column: tab-separated text and a small HTML table.
  • Hook for the pickers (port-pickers: [[, @, # in cells): the grid dispatches table-cell-input on the editor's DOM (detail.cell, detail.value) on each cell edit; a link the picker writes is [title](<path>) in the cell's text, which is already drawn. Following a cell link is not wired (links are drawn and styled; clicking goes into the cell).

Gates

  • editor vitest 531 passed (new: inline drawing, table-widths read/write/remove incl. whole-block removal, motion index maps); tsc clean; svelte-check 0 errors; web 78, ui 46.
  • e2e/tables.spec.ts + e2e/tables-more.spec.ts: chromium 1440+390 43 passed; webkit 1440+390 43 passed; with the neighbours 356 passed.
  • Typing path (dev-01 Chromium, headless on a busy Linux box: relative only), keydown to the frame after the input, 120 keys x 3 rounds, p50 in ms: plain 60-paragraph note 157 / 176 / 127; note with a 50-row table, typing in a paragraph 164 / 131 / 141; typing in a cell of that table 157 / 160 / 165. No measurable difference beyond the box's noise (p95 270 to 520 everywhere). Real numbers need the perf VMs.

Bundle (brotli bytes): first paint JS 245,664 (budget 245,760), first paint CSS 21,483, all JS 332,598 (budget 322,560: over by 10,038 B; see #845, needs kayg's decision).

How a table cell maps onto the note (no layer in between)

The note's text is the only copy of a table: plain pipe lines in the note document. The grid on screen is a drawing of those lines. Nothing is stored anywhere else.

  1. Drawing. When a table is drawn, each cell's text box is filled from its line in the note document.
  2. Typing. A key goes into the cell's text box (the browser does that, it is where the caret is). In the very same input event, the grid replaces that one row's line in the note document with a single ordinary transaction (input.table.cell), keeping every other byte of the row and of the note. There is no timer, no wait for a frame, no queue, no draft: when the event handler returns, the note document already holds the key. (An earlier version of this PR waited 160 ms before writing; that is removed.)
  3. Who sees it. Because each key is an ordinary transaction on the note, the note's own undo history, Yjs sync and crash recovery see the same text at the same moment. Ctrl/Cmd+Z in a cell is handed to the note's undo, and the cell is redrawn from the document afterwards. An edit that arrives from outside (another device, undo, source mode) replaces the grid's rows from the document; if the document's row is not what the grid expects, the grid re-reads the table from the note instead of writing over it.
  4. What the grid keeps. Only a parsed list of rows for drawing, and the line positions; both are checked against the note on each write, never the other way round.
  5. Cost per key. One row's text is replaced (O(row)). The note's table record is mapped, not rebuilt. The Markdown parser still walks the table's lines, because a table is one block to the parser, but it no longer parses any cell inline: the note language (tables/parser.ts) leaves cells without inline nodes, since the grid draws cell Markdown itself. Column widths are not measured on keys (fit runs on load, resize, structure change and leaving a cell).
  6. What the browser draws per key (14 Nov). The card is built so the browser's own work per key stays near the screen, whatever the table's length: rows sit in groups of 16 (one tbody each) that the browser skips while off screen (content-visibility per group; per row, the browser's check of every skipped row grew with the table); the first column is pinned (position: sticky, one layer per row) only when the table is wider than its card (data-wide, read when columns are measured, never per key); ordinary cells are not positioned; and only header cells are scroll-snap areas (one per column; per cell, the browser re-read every cell's snap area after each layout).

Tests: tables-live.test.ts (the note holds each key at once; undo/redo round-trips through the note and the cell follows; other rows byte-for-byte), tables-parser.test.ts (same table ranges as the stock parser; no inline work inside tables; a cell edit's inline-parse count is the same for 10 and 400 rows, with a stock-parser control), e2e each key in a cell is in the note document the moment it is typed.

Stacked on #845 (base `port/port-tables`). The rest of the approved table behaviour. ## What it does - **Resize columns and rows.** A mouse drags a column's right border or a row's bottom border (cursor says where; a second press on the border lets the column size itself again). A finger picks the column or row, then drags the handle on its edge. Never narrower than the longest word: the browser's table layout enforces that, and the width kept is what the column really became. A table with a width of its own may be wider than its card and then scrolls. - **Where widths live** (the mockup's storage, ADR 0056 / 0068, no new key): frontmatter `table-widths: [[14, null, 4, 5]]`, characters, one list per table in document order, `null` for a column that sizes itself. The table's own pipes are never touched. Widths follow their column when columns are added, removed or moved. Row heights are UI state, never saved (as in the mockup). - **Markdown in cells.** `**bold**`, `*italic*`, `~~strike~~`, `==mark==`, `` `code` `` and links are drawn at rest; with the caret in a cell it shows the file's markdown, so what is typed is exactly what is saved (the caret goes to the end of a cell that has formatting). Built from DOM nodes, never HTML strings. - **Carry a picked row or column** by its strip; the others make room, it settles, then the order changes. - **Motion** (Emil's rules): a pointer's add / delete / move / sort slides what was there, new rows and columns ease in, leaving ones fade; all < 300 ms, ease-out, nothing from `scale(0)`; keys and reduced motion play nothing. Tested. - **Copy a picked row or column**: tab-separated text and a small HTML table. - **Hook for the pickers** (port-pickers: `[[`, `@`, `#` in cells): the grid dispatches `table-cell-input` on the editor's DOM (`detail.cell`, `detail.value`) on each cell edit; a link the picker writes is `[title](<path>)` in the cell's text, which is already drawn. Following a cell link is not wired (links are drawn and styled; clicking goes into the cell). ## Gates - editor vitest 531 passed (new: inline drawing, `table-widths` read/write/remove incl. whole-block removal, motion index maps); tsc clean; svelte-check 0 errors; web 78, ui 46. - `e2e/tables.spec.ts` + `e2e/tables-more.spec.ts`: chromium 1440+390 43 passed; webkit 1440+390 43 passed; with the neighbours 356 passed. - Typing path (dev-01 Chromium, headless on a busy Linux box: **relative only**), keydown to the frame after the input, 120 keys x 3 rounds, p50 in ms: plain 60-paragraph note 157 / 176 / 127; note with a 50-row table, typing in a paragraph 164 / 131 / 141; typing in a cell of that table 157 / 160 / 165. No measurable difference beyond the box's noise (p95 270 to 520 everywhere). Real numbers need the perf VMs. ## Bundle (brotli bytes): first paint JS 245,664 (budget 245,760), first paint CSS 21,483, all JS 332,598 (budget 322,560: over by 10,038 B; see #845, needs kayg's decision). ## How a table cell maps onto the note (no layer in between) The note's text is the only copy of a table: plain pipe lines in the note document. The grid on screen is a drawing of those lines. Nothing is stored anywhere else. 1. **Drawing.** When a table is drawn, each cell's text box is filled from its line in the note document. 2. **Typing.** A key goes into the cell's text box (the browser does that, it is where the caret is). In the very same `input` event, the grid replaces that one row's line in the note document with a single ordinary transaction (`input.table.cell`), keeping every other byte of the row and of the note. There is no timer, no wait for a frame, no queue, no draft: when the event handler returns, the note document already holds the key. (An earlier version of this PR waited 160 ms before writing; that is removed.) 3. **Who sees it.** Because each key is an ordinary transaction on the note, the note's own undo history, Yjs sync and crash recovery see the same text at the same moment. Ctrl/Cmd+Z in a cell is handed to the note's undo, and the cell is redrawn from the document afterwards. An edit that arrives from outside (another device, undo, source mode) replaces the grid's rows from the document; if the document's row is not what the grid expects, the grid re-reads the table from the note instead of writing over it. 4. **What the grid keeps.** Only a parsed list of rows for drawing, and the line positions; both are checked against the note on each write, never the other way round. 5. **Cost per key.** One row's text is replaced (O(row)). The note's table record is mapped, not rebuilt. The Markdown parser still walks the table's lines, because a table is one block to the parser, but it no longer parses any cell inline: the note language (`tables/parser.ts`) leaves cells without inline nodes, since the grid draws cell Markdown itself. Column widths are not measured on keys (`fit` runs on load, resize, structure change and leaving a cell). 6. **What the browser draws per key** (14 Nov). The card is built so the browser's own work per key stays near the screen, whatever the table's length: rows sit in groups of 16 (one `tbody` each) that the browser skips while off screen (`content-visibility` per group; per row, the browser's check of every skipped row grew with the table); the first column is pinned (`position: sticky`, one layer per row) only when the table is wider than its card (`data-wide`, read when columns are measured, never per key); ordinary cells are not positioned; and only header cells are scroll-snap areas (one per column; per cell, the browser re-read every cell's snap area after each layout). Tests: `tables-live.test.ts` (the note holds each key at once; undo/redo round-trips through the note and the cell follows; other rows byte-for-byte), `tables-parser.test.ts` (same table ranges as the stock parser; no inline work inside tables; a cell edit's inline-parse count is the same for 10 and 400 rows, with a stock-parser control), e2e `each key in a cell is in the note document the moment it is typed`.
tables: a dragged width may overflow the card at once
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled
c9bad2d457
Author
Owner

housekeeping #1009: rebased+failing, left open for review.

restacked table follow-up on #845.

head: b4e67da4aff4bb7a42d678935900dfb447b5ab01; based on dev cd7f84432febfc63b788fbb9b9f9950452982d74, pushed with the original exact force-with-lease.

frontend frozen install, check, lint, build and unit tests passed. bundle gate failed. first-paint brotli vs dev: JS 231054 B (+277 B), CSS 18533 B (+147 B).

targeted Chromium and WebKit specs at 1440 and 390 never started. the audit waited more than three hours behind the live daily-train-1107 locks (first queue at 23:45 IST, 7 November; final queue cleanup after 02:46 IST, 8 November). browser validation and UI captures are unrun. only this audit’s exact queued units were stopped; the train locks and owners were left intact. hot-path perf qualification is unrun.

all executed gates used the VM Nix environment, shared Mac lock and slot. exact commands, source heads, logs and dev baseline. frontend inputs are identical to the tested frontend tree when a Rust-only repair changed the head.

original-head cherry/patch inventory, pr-854.md; unmatched entries are missing-patch candidates, with semantic overlap/replacements noted above.

final queue, cleanup and source-verification evidence.

housekeeping #1009: rebased+failing, left open for review. restacked table follow-up on #845. head: `b4e67da4aff4bb7a42d678935900dfb447b5ab01`; based on dev `cd7f84432febfc63b788fbb9b9f9950452982d74`, pushed with the original exact force-with-lease. frontend frozen install, check, lint, build and unit tests passed. bundle gate failed. first-paint brotli vs dev: JS 231054 B (+277 B), CSS 18533 B (+147 B). targeted Chromium and WebKit specs at 1440 and 390 never started. the audit waited more than three hours behind the live daily-train-1107 locks (first queue at 23:45 IST, 7 November; final queue cleanup after 02:46 IST, 8 November). browser validation and UI captures are unrun. only this audit’s exact queued units were stopped; the train locks and owners were left intact. hot-path perf qualification is unrun. all executed gates used the VM Nix environment, shared Mac lock and slot. [exact commands, source heads, logs and dev baseline](https://git.kayg.org/attachments/870a0fef-2e31-425c-aea6-eb87a66d365a). frontend inputs are identical to the tested frontend tree when a Rust-only repair changed the head. [original-head cherry/patch inventory](https://git.kayg.org/attachments/e05a38dc-c028-4d77-8655-efa9d5c8ea50), `pr-854.md`; unmatched entries are missing-patch candidates, with semantic overlap/replacements noted above. [final queue, cleanup and source-verification evidence](https://git.kayg.org/attachments/7ab315a5-4b6c-4af1-971b-cdae2637adae).
Author
Owner

Final-port test pass (issue #1009), READY: no: fixed 2 real failures, specs now pass; bundle gate fails; first paint is bigger than dev.

head e817319cd1ec37c43078c4eb204ce2ee53f21888

Targeted specs, CI=1 --retries=0 --workers=1, dev-01 Chromium and dev-02 WebKit (through ~/bin/slot), against a dev-head backend (cd7f84432).

spec Chromium 1440 Chromium 390 WebKit 1440 WebKit 390
tables-more (before fix) 6 pass, 2 fail 6 pass, 2 fail 6 pass, 2 fail 6 pass, 2 fail
tables + tables-more (after e817319cd) 21/21 22/22 21/21 22/22

Bundle gate: perf/web.sh --bundle-only --gate (the 17 failures from the housekeeping audit). Per the gate's own rule (total_js_brotli budget must equal the sum of the named chunk budgets) a cap can only move between named chunks; there is no donor chunk inside this PR, so a fix is a code cut or a decision by kayg. I raised nothing and moved nothing.

  • Fix pushed (e817319cd): the table-widths line was written with userEvent: 'input.table'; dev's editor drops every frontmatter edit not tagged input.properties, so a dragged width never reached the note. widths.ts now uses input.properties. Probe: the right change was dispatched and silently filtered.
  • Gate: widget 10.35 KB vs 1.1 cap. First paint JS +277 B, CSS +147 B vs dev.

Not done: Not run yet: Mac VM Safari blur/frame check and perf ABAB x5 on the perf VMs (they need a ready PR first); light/dark 2x screenshots against the mockup are only done for #888 (see its comment).

Not marked READY FOR MERGE.

**Final-port test pass (issue #1009), READY: no: fixed 2 real failures, specs now pass; bundle gate fails; first paint is bigger than dev.** head `e817319cd1ec37c43078c4eb204ce2ee53f21888` Targeted specs, `CI=1 --retries=0 --workers=1`, dev-01 Chromium and dev-02 WebKit (through `~/bin/slot`), against a dev-head backend (`cd7f84432`). | spec | Chromium 1440 | Chromium 390 | WebKit 1440 | WebKit 390 | |---|---|---|---|---| | tables-more (before fix) | 6 pass, 2 fail | 6 pass, 2 fail | 6 pass, 2 fail | 6 pass, 2 fail | | tables + tables-more (after `e817319cd`) | 21/21 | 22/22 | 21/21 | 22/22 | **Bundle gate:** `perf/web.sh --bundle-only --gate` (the 17 failures from the housekeeping audit). Per the gate's own rule (`total_js_brotli` budget must equal the sum of the named chunk budgets) a cap can only move between named chunks; there is no donor chunk inside this PR, so a fix is a code cut or a decision by kayg. I raised nothing and moved nothing. - **Fix pushed (`e817319cd`):** the `table-widths` line was written with `userEvent: 'input.table'`; dev's editor drops every frontmatter edit not tagged `input.properties`, so a dragged width never reached the note. `widths.ts` now uses `input.properties`. Probe: the right change was dispatched and silently filtered. - Gate: `widget` 10.35 KB vs 1.1 cap. First paint JS +277 B, CSS +147 B vs dev. **Not done:** Not run yet: Mac VM Safari blur/frame check and perf ABAB x5 on the perf VMs (they need a ready PR first); light/dark 2x screenshots against the mockup are only done for #888 (see its comment). Not marked READY FOR MERGE.
Author
Owner

Screenshots and state (issue #1009), 0a98ffe3f9

Product (the #854 tip, which contains #845; Chromium, 2x) next to the approved mockup, light and dark, 1440x900 and 390x844. Real Safari not taken yet. Not READY: first paint is over dev (see the #1009 table).
Differences from the mockup: the product's row bar is shorter (insert above/below, move up/down, delete, done) and its cell and column bars lack the mic; the mockup note shows its own Share and More pills, a warm sky and a 40-note list; the product table's rows are a little taller; on wide the product shows seven columns before the edge fade, the mockup six.

Screenshots (2x; light and dark; 1440x900 and 390x844). Left: the approved mockup (review/calendar-2). Right: this PR.

cell

mockup this PR
1440 light
1440 dark
390 light
390 dark

row

mockup this PR
1440 light
1440 dark
390 light
390 dark

col

mockup this PR
1440 light
1440 dark
390 light
390 dark

rest

mockup this PR
1440 light
1440 dark
390 light
390 dark

wide

mockup this PR
1440 light
1440 dark
390 light
390 dark

Real Safari (Mac VM, safaridriver, 1x: the VM reports devicePixelRatio 1)

cell

light dark
1440
390

row

light dark
1440
390

col

light dark
1440
390

rest

light dark
1440
390

wide

light dark
1440
390
**Screenshots and state (issue #1009), 0a98ffe3f94dfab37b37819787362d99b2c5ae98** Product (the #854 tip, which contains #845; Chromium, 2x) next to the approved mockup, light and dark, 1440x900 and 390x844. Real Safari not taken yet. **Not READY: first paint is over dev (see the #1009 table).** Differences from the mockup: the product's row bar is shorter (insert above/below, move up/down, delete, done) and its cell and column bars lack the mic; the mockup note shows its own Share and More pills, a warm sky and a 40-note list; the product table's rows are a little taller; on `wide` the product shows seven columns before the edge fade, the mockup six. ### Screenshots (2x; light and dark; 1440x900 and 390x844). Left: the approved mockup (review/calendar-2). Right: this PR. **cell** | | mockup | this PR | |---|---|---| | 1440 light | ![](https://git.kayg.org/attachments/6699c58a-0cff-409a-b973-123b7e542dc9) | ![](https://git.kayg.org/attachments/1c177966-3a80-4334-8da4-520ca79841f0) | | 1440 dark | ![](https://git.kayg.org/attachments/27a2272f-14f3-4f4f-bdb8-7c895aad19d9) | ![](https://git.kayg.org/attachments/24aec18c-b955-4c01-bbf6-94e340589958) | | 390 light | ![](https://git.kayg.org/attachments/c330aba9-f872-49c8-ae7b-6c76f3cf61b4) | ![](https://git.kayg.org/attachments/78ca82e1-e54a-46ad-ac2b-da3bd0312c32) | | 390 dark | ![](https://git.kayg.org/attachments/ce02394d-bd96-421f-91bc-35fa52b348b5) | ![](https://git.kayg.org/attachments/15c881b9-d650-49f0-aaf6-548137924062) | **row** | | mockup | this PR | |---|---|---| | 1440 light | ![](https://git.kayg.org/attachments/dc3323f0-fb6b-4311-ab03-c34e511c6d09) | ![](https://git.kayg.org/attachments/f8d919dd-22b6-4335-a9ce-6bb34923f61c) | | 1440 dark | ![](https://git.kayg.org/attachments/0fcaa3c2-42e5-4b9d-934c-3a74b7ef9a0c) | ![](https://git.kayg.org/attachments/92874ff7-92ba-480a-8152-e40d35e4886e) | | 390 light | ![](https://git.kayg.org/attachments/3a47c18d-eb52-4446-8aa3-21127ff9cf6b) | ![](https://git.kayg.org/attachments/95654e34-b634-4bfe-be0c-578dd4e67328) | | 390 dark | ![](https://git.kayg.org/attachments/83151857-2445-41c2-976e-b11d3dfb3c50) | ![](https://git.kayg.org/attachments/65ac0cd9-29ae-4262-b338-0daf088eed45) | **col** | | mockup | this PR | |---|---|---| | 1440 light | ![](https://git.kayg.org/attachments/4826745a-e7d7-48b8-96cc-650ad91e6cb5) | ![](https://git.kayg.org/attachments/0e0e77be-f929-4dfb-b9ca-931458184b56) | | 1440 dark | ![](https://git.kayg.org/attachments/ac268838-95b1-4f81-9797-e8891ada3c94) | ![](https://git.kayg.org/attachments/7a8d8f81-53c7-4e9a-a4fd-1d87dd171876) | | 390 light | ![](https://git.kayg.org/attachments/2c66d597-b2d1-433a-93a2-7959ba465004) | ![](https://git.kayg.org/attachments/59870771-0a38-4b9f-a1b6-28538574bbae) | | 390 dark | ![](https://git.kayg.org/attachments/a2a22068-ce3f-4b7c-93c7-dd50da849943) | ![](https://git.kayg.org/attachments/72fa2807-1549-402f-8e90-d0e0944ffa2d) | **rest** | | mockup | this PR | |---|---|---| | 1440 light | ![](https://git.kayg.org/attachments/70a2adbb-c652-4409-b3b0-fdfc8f3fa97e) | ![](https://git.kayg.org/attachments/cfd7a0d2-5f27-4889-90b0-fa9cb7b01a80) | | 1440 dark | ![](https://git.kayg.org/attachments/61300758-7139-48a9-a274-c6f172bf53b9) | ![](https://git.kayg.org/attachments/0e80e16a-4b86-47c3-80d3-967d0eb43cfc) | | 390 light | ![](https://git.kayg.org/attachments/68131565-d211-42bd-96d1-bdeadf283b0b) | ![](https://git.kayg.org/attachments/bcdc8355-9a22-4a43-99e3-f75930c7cd16) | | 390 dark | ![](https://git.kayg.org/attachments/21546bfc-1cf9-45fc-8c2a-c290d527eb06) | ![](https://git.kayg.org/attachments/d47ebb09-45fa-45f5-8c3b-58077e5621b7) | **wide** | | mockup | this PR | |---|---|---| | 1440 light | ![](https://git.kayg.org/attachments/f638cb01-2e42-4df4-9397-abf2a4ce82a8) | ![](https://git.kayg.org/attachments/02bcbaf8-b49c-4329-a49d-a9548cf9f068) | | 1440 dark | ![](https://git.kayg.org/attachments/f5edabc6-56b4-4c24-a942-d8e969117d7d) | ![](https://git.kayg.org/attachments/c0fd2396-be46-4261-9a32-d55d641bd28e) | | 390 light | ![](https://git.kayg.org/attachments/90eee056-de86-4f94-b95a-c0e9411e7a90) | ![](https://git.kayg.org/attachments/c1723736-b413-4d7a-b91c-071c9d5cec22) | | 390 dark | ![](https://git.kayg.org/attachments/d1b75d70-b3f0-4dc4-af8c-a6673dcb5d9a) | ![](https://git.kayg.org/attachments/376eeaf5-bd99-48a1-aaa4-80a939d63609) | ### Real Safari (Mac VM, safaridriver, 1x: the VM reports devicePixelRatio 1) **cell** | | light | dark | |---|---|---| | 1440 | ![](https://git.kayg.org/attachments/f083bf27-ce4c-4ab7-b358-d26a5655a7df) | ![](https://git.kayg.org/attachments/415e0287-fd74-465c-819c-0910af63f5af) | | 390 | ![](https://git.kayg.org/attachments/e5188e52-13b6-4186-abab-357ede135b7b) | ![](https://git.kayg.org/attachments/f7cc11c1-10d9-4eb4-9d5c-462e483f9e54) | **row** | | light | dark | |---|---|---| | 1440 | ![](https://git.kayg.org/attachments/a1e7c631-7bdb-40f7-9b73-43d3c47b11d2) | ![](https://git.kayg.org/attachments/b7c052fa-265d-4e98-8224-eb9c66d0afd3) | | 390 | ![](https://git.kayg.org/attachments/43eb7c14-7bef-4b1f-bc18-e1d6df9e4177) | ![](https://git.kayg.org/attachments/0cbb7bc6-a026-4a60-9533-38797d89487a) | **col** | | light | dark | |---|---|---| | 1440 | ![](https://git.kayg.org/attachments/7bce09b9-e6b3-4d09-adee-43b222486f31) | ![](https://git.kayg.org/attachments/656542d1-416a-4179-a0b7-98b72dc31e8a) | | 390 | ![](https://git.kayg.org/attachments/0d2acb0d-fb5c-4284-b290-5c5e5820b24d) | ![](https://git.kayg.org/attachments/136c0856-20ce-4bb0-bfbe-26746084c646) | **rest** | | light | dark | |---|---|---| | 1440 | ![](https://git.kayg.org/attachments/b54a7c79-7346-4369-8d26-cf241388f157) | ![](https://git.kayg.org/attachments/1f30a8f8-0404-42b7-af40-f8af56245b64) | | 390 | ![](https://git.kayg.org/attachments/2c5ded28-1835-4ad2-b6f0-73c77f1031d9) | ![](https://git.kayg.org/attachments/8168b699-79de-4cbc-b96d-04b4ba92f22d) | **wide** | | light | dark | |---|---|---| | 1440 | ![](https://git.kayg.org/attachments/648f4607-d904-47c2-ae30-a1a6db13888a) | ![](https://git.kayg.org/attachments/c19a9e8e-473a-4dd0-8a51-d5c0ba29f2b5) | | 390 | ![](https://git.kayg.org/attachments/cbd65cb8-2975-49c2-beec-cca80db4e14c) | ![](https://git.kayg.org/attachments/5cd576e1-6513-4bca-b4d7-cc9f3bce065d) |
Author
Owner

Screenshots and state (issue #1009), 1f87444052

Tables (#845, #854; this is the #854 tip), restacked on dev 661123e94. Product (Chromium, 2x, re-taken after the rebase) next to the approved mockup, light and dark. Not READY: first paint JS is over dev (+387 B plain for #854, +506 B for #845; CSS +142 B). Specs: tables, tables-more, bars, dialogs, slash menu: green on Chromium and WebKit at both sizes except slash-menu:79, which fails about one run in six on dev 661123e94 itself. Gate passes (budget total 517.6 KiB). Rebase notes: dev's Insert sheet now lists the block registry, so Table is a registry block whose action runs the grid's insert (the registry's blocks may run something instead of writing markdown). Perf ABAB is queued behind other lanes.

Screenshots (2x; light and dark; 1440x900 and 390x844). Left: the approved mockup (review/calendar-2). Right: this PR.

cell

mockup this PR
1440 light
1440 dark
390 light
390 dark

row

mockup this PR
1440 light
1440 dark
390 light
390 dark

col

mockup this PR
1440 light
1440 dark
390 light
390 dark

rest

mockup this PR
1440 light
1440 dark
390 light
390 dark

wide

mockup this PR
1440 light
1440 dark
390 light
390 dark

Differences from the mockup: as in the earlier set (the row bar is shorter, the cell and column bars lack the mic, the mockup's own Share and More pills and warm sky).

**Screenshots and state (issue #1009), 1f874440527e0c527229655d487f7ad0660f3dd1** Tables (#845, #854; this is the #854 tip), restacked on dev `661123e94`. Product (Chromium, 2x, re-taken after the rebase) next to the approved mockup, light and dark. **Not READY: first paint JS is over dev (+387 B plain for #854, +506 B for #845; CSS +142 B).** Specs: tables, tables-more, bars, dialogs, slash menu: green on Chromium and WebKit at both sizes except `slash-menu:79`, which fails about one run in six on dev `661123e94` itself. Gate passes (budget total 517.6 KiB). Rebase notes: dev's Insert sheet now lists the block registry, so Table is a registry block whose action runs the grid's insert (the registry's blocks may run something instead of writing markdown). Perf ABAB is queued behind other lanes. ### Screenshots (2x; light and dark; 1440x900 and 390x844). Left: the approved mockup (review/calendar-2). Right: this PR. **cell** | | mockup | this PR | |---|---|---| | 1440 light | ![](https://git.kayg.org/attachments/b9d2c01b-4fbf-450f-9503-6782646ff90a) | ![](https://git.kayg.org/attachments/b2b99b71-e0b3-43ea-9f25-71a6db9cdc5c) | | 1440 dark | ![](https://git.kayg.org/attachments/1b03b394-60e7-4d44-b728-9111b1d8f752) | ![](https://git.kayg.org/attachments/d4aeaca8-86ea-411a-ac27-81c20db83a63) | | 390 light | ![](https://git.kayg.org/attachments/a0ff14de-7f22-4022-8be3-713ce91257ab) | ![](https://git.kayg.org/attachments/f302261c-721b-49f9-b02b-fcfa08cf2d07) | | 390 dark | ![](https://git.kayg.org/attachments/91c4e693-792c-4561-a6d7-98e3ae31382a) | ![](https://git.kayg.org/attachments/503eb9c6-20dd-4a3c-b85f-299bfc8c1314) | **row** | | mockup | this PR | |---|---|---| | 1440 light | ![](https://git.kayg.org/attachments/3efcecf1-e866-40e7-bf72-e785a200f7a4) | ![](https://git.kayg.org/attachments/6c3acc85-17fd-4d58-a092-8ddebe15ff7e) | | 1440 dark | ![](https://git.kayg.org/attachments/8692c997-7853-4282-9134-c6f7ad9284be) | ![](https://git.kayg.org/attachments/b6664f78-ffda-42e4-98b5-961b4a8e1ec0) | | 390 light | ![](https://git.kayg.org/attachments/31df8e62-888a-4e44-acf3-7d3c95166af8) | ![](https://git.kayg.org/attachments/50b9a24f-33fe-4391-a55e-29948bf614d1) | | 390 dark | ![](https://git.kayg.org/attachments/fae549ac-0915-4f3c-bb99-0bbe2dce97b4) | ![](https://git.kayg.org/attachments/6425d142-5bfe-4941-8055-5c9c3790d378) | **col** | | mockup | this PR | |---|---|---| | 1440 light | ![](https://git.kayg.org/attachments/02691657-8ca3-4be6-8a0b-931e96519acd) | ![](https://git.kayg.org/attachments/bc1e08bf-02a2-4fbe-9a86-1f295d56d620) | | 1440 dark | ![](https://git.kayg.org/attachments/6ffb4727-5e97-4791-9d70-21a5cbb9e2a9) | ![](https://git.kayg.org/attachments/9c12bfd9-68fb-4178-ac55-c416fbeccf95) | | 390 light | ![](https://git.kayg.org/attachments/bc640f51-f310-486b-9735-b77ef926f803) | ![](https://git.kayg.org/attachments/4dfe44b0-7315-4431-839c-b73b216264c5) | | 390 dark | ![](https://git.kayg.org/attachments/9917c417-5b8f-4baf-908d-de9036f30915) | ![](https://git.kayg.org/attachments/152d51e3-9cce-447d-b83f-9fe5f0526852) | **rest** | | mockup | this PR | |---|---|---| | 1440 light | ![](https://git.kayg.org/attachments/c3bcfd5a-10da-491d-b0e9-2896738376ba) | ![](https://git.kayg.org/attachments/f91c12cc-f711-4daa-abeb-0fc601c344ad) | | 1440 dark | ![](https://git.kayg.org/attachments/dd7df58f-d659-40d2-8723-1940d6ddded5) | ![](https://git.kayg.org/attachments/7e99331e-61a4-49bc-b42a-199b88f71998) | | 390 light | ![](https://git.kayg.org/attachments/ca8dea05-8d2d-4ac0-a50f-2ce2cd104dd5) | ![](https://git.kayg.org/attachments/a8a83750-fb7c-44c9-be4c-5dc828a0d62e) | | 390 dark | ![](https://git.kayg.org/attachments/68b3edde-1674-403f-a5a4-ddd37b0186fd) | ![](https://git.kayg.org/attachments/7679f2e3-7b8f-4934-80f0-38da97825541) | **wide** | | mockup | this PR | |---|---|---| | 1440 light | ![](https://git.kayg.org/attachments/53892c84-0036-4829-8113-0056f3e665a4) | ![](https://git.kayg.org/attachments/08095188-e10e-46a8-8e50-3832ae3a0bfc) | | 1440 dark | ![](https://git.kayg.org/attachments/5fc97be0-07cb-4e9e-8555-a6535c94e17b) | ![](https://git.kayg.org/attachments/31668d1e-0bbe-4d0d-b7b6-7466e98a8177) | | 390 light | ![](https://git.kayg.org/attachments/9f1fdd5b-3cff-4c91-bdcd-9cfd31d952cc) | ![](https://git.kayg.org/attachments/d4502a61-5e9f-4cdb-bc9c-4361e6f8333f) | | 390 dark | ![](https://git.kayg.org/attachments/33b1f879-bda1-4fbd-ac44-75c882b452ba) | ![](https://git.kayg.org/attachments/7ef04ee6-e799-4d04-946a-35f1d191ab89) | Differences from the mockup: as in the earlier set (the row bar is shorter, the cell and column bars lack the mic, the mockup's own Share and More pills and warm sky).
Author
Owner

Perf (perf-02, Chromium 4x slowdown, 10k notes, 5 interleaved rounds, dev built from 3f079de39 run twice as a control; medians of per-run p50 / p95, ms):

metric dev A dev B (control) #1022 credits #849 Contacts #854 tables #861 attachments
blaze.shown p50 / p95 36.2 / 64.7 36.0 / 65.7 35.5 / 67.3 37.3 / 65.1 35.1 / 62.3 34.7 / 66.6
type.long_note p50 / p95 21.9 / 55.5 23.5 / 53.4 22.8 / 55.2 23.3 / 54.8 21.8 / 57.0 26.3 / 61.5
type.nested_list p50 / p95 42.1 / 51.0 42.0 / 51.3 43.0 / 52.5 42.4 / 51.0 42.2 / 50.8 43.2 / 52.2
type.code_block p50 / p95 23.9 / 34.8 24.0 / 47.3 24.4 / 52.9 28.0 / 47.5 24.9 / 53.6 25.7 / 53.1
type.code_note_prose p50 / p95 28.0 / 63.0 29.6 / 64.0 29.6 / 68.6 33.4 / 68.5 27.9 / 69.5 37.1 / 71.2
blaze.cpu 76.8 76.3 75.8 75.8 75.4 77.2
blaze.long_task_max 157 153 157 151 149 162

The dev-vs-dev control moves by as much as any arm (code_block p95 34.8 vs 47.3; long_note p95 53.4 vs 55.5), so there is no change beyond the noise on any metric, for any arm. Arms are the heads built from the rebased branches (#854 f58c71010, #861 f20b9457b, #849 as 144013926 before its budget-only commit, #1022 17010f469).

First paint on dev 3f079de39 (before credits): +365 B plain / +384 B normalised over dev. Specs on the rebased head f58c71010: only dev's own failures (lazy-ui:70, preload:89 at 390); gate passes.

**Perf** (perf-02, Chromium 4x slowdown, 10k notes, 5 interleaved rounds, dev built from `3f079de39` run twice as a control; medians of per-run p50 / p95, ms): | metric | dev A | dev B (control) | #1022 credits | #849 Contacts | #854 tables | #861 attachments | |---|---|---|---|---|---|---| | blaze.shown p50 / p95 | 36.2 / 64.7 | 36.0 / 65.7 | 35.5 / 67.3 | 37.3 / 65.1 | 35.1 / 62.3 | 34.7 / 66.6 | | type.long_note p50 / p95 | 21.9 / 55.5 | 23.5 / 53.4 | 22.8 / 55.2 | 23.3 / 54.8 | 21.8 / 57.0 | 26.3 / 61.5 | | type.nested_list p50 / p95 | 42.1 / 51.0 | 42.0 / 51.3 | 43.0 / 52.5 | 42.4 / 51.0 | 42.2 / 50.8 | 43.2 / 52.2 | | type.code_block p50 / p95 | 23.9 / 34.8 | 24.0 / 47.3 | 24.4 / 52.9 | 28.0 / 47.5 | 24.9 / 53.6 | 25.7 / 53.1 | | type.code_note_prose p50 / p95 | 28.0 / 63.0 | 29.6 / 64.0 | 29.6 / 68.6 | 33.4 / 68.5 | 27.9 / 69.5 | 37.1 / 71.2 | | blaze.cpu | 76.8 | 76.3 | 75.8 | 75.8 | 75.4 | 77.2 | | blaze.long_task_max | 157 | 153 | 157 | 151 | 149 | 162 | The dev-vs-dev control moves by as much as any arm (code_block p95 34.8 vs 47.3; long_note p95 53.4 vs 55.5), so there is no change beyond the noise on any metric, for any arm. Arms are the heads built from the rebased branches (#854 `f58c71010`, #861 `f20b9457b`, #849 as `144013926` before its budget-only commit, #1022 `17010f469`). First paint on dev `3f079de39` (before credits): +365 B plain / +384 B normalised over dev. Specs on the rebased head `f58c71010`: only dev's own failures (lazy-ui:70, preload:89 at 390); gate passes.
Author
Owner

READY FOR MERGE: tables 2 (head 8c6ec171b, on #845)

Rebased on dev 9438918f3 (#848/#849 in), budgets regenerated from a fresh build of this head, bundle gate clean, specs on dev-02 (idle host) with calternal-h861, chromium and webkit at 1440 and 390 (preload, lazy-ui, lazy-offline, glass, shortcuts and this PR's own specs): 0 failed.

dev #845 + #854
first paint plain / normalised 227531 / 227081 B 227938 / 227333 B (+407 / +252 B)
CSS 18234 18399 (+165)
budget total 537.55 KiB 542.27 KiB (tables 10.39)

234 passed, 42 skipped. Perf: the 11-09 run on the previous head is on #854.

## READY FOR MERGE: tables 2 (head `8c6ec171b`, on #845) Rebased on dev `9438918f3` (#848/#849 in), budgets regenerated from a fresh build of this head, bundle gate clean, specs on dev-02 (idle host) with `calternal-h861`, chromium and webkit at 1440 and 390 (preload, lazy-ui, lazy-offline, glass, shortcuts and this PR's own specs): **0 failed**. | | dev | #845 + #854 | |---|---|---| | first paint plain / normalised | 227531 / 227081 B | 227938 / 227333 B (**+407 / +252 B**) | | CSS | 18234 | 18399 (+165) | | budget total | 537.55 KiB | 542.27 KiB (tables 10.39) | 234 passed, 42 skipped. Perf: the 11-09 run on the previous head is on #854.
Author
Owner

READY FOR MERGE: tables 2 (head fb563bf69, on #845)

Merged dev fe2efbf11 (#1044) into the branch (it also merges cleanly with 4274dafb4, git merge-tree), budgets regenerated from a fresh build, bundle gate clean, specs on dev-02 with calternal-h861, chromium and webkit at 1440 and 390. Dev baseline on fe2efbf11: 228023 B plain / 227378 B normalised / CSS 18236.

first paint plain / normalised CSS budget total
228298 / 227989 B (+275 / +611 B; growth accepted by kayg) 18400 (+164) 542.54 KiB (≤ 543.9)

Specs: tables-more (including the motion spec that #1044 would have broken) and keys-no-motion pass, 48 passed, 0 failed; earlier full set 221 passed. Gate clean.

## READY FOR MERGE: tables 2 (head `fb563bf69`, on #845) Merged dev `fe2efbf11` (#1044) into the branch (it also merges cleanly with `4274dafb4`, `git merge-tree`), budgets regenerated from a fresh build, bundle gate clean, specs on dev-02 with `calternal-h861`, chromium and webkit at 1440 and 390. Dev baseline on `fe2efbf11`: 228023 B plain / 227378 B normalised / CSS 18236. | first paint plain / normalised | CSS | budget total | |---|---|---| | 228298 / 227989 B (**+275 / +611 B**; growth accepted by kayg) | 18400 (+164) | 542.54 KiB (≤ 543.9) | Specs: `tables-more` (including the motion spec that #1044 would have broken) and `keys-no-motion` pass, 48 passed, 0 failed; earlier full set 221 passed. Gate clean.
Author
Owner

Handoff: head fb563bf69 is pushed and READY as posted

Handoff (usage limit): the x86 pixel and contrast run on dev-01 (4 projects, 15 specs) was stopped before finishing this head; I released its job. Done: dev fe2efbf11 and the earlier heads (#902, #854, rows tip, #878 base) ran there with the same 6 phone-bars photo-dark failures on dev itself and nothing new. Next step: re-run px-d1b.sh-style pixel set on this head on dev-01 (about 1 h per head) if you want it before merging.

## Handoff: head `fb563bf69` is pushed and READY as posted Handoff (usage limit): the x86 pixel and contrast run on dev-01 (4 projects, 15 specs) was stopped before finishing this head; I released its job. Done: dev `fe2efbf11` and the earlier heads (#902, #854, rows tip, #878 base) ran there with the same 6 `phone-bars` photo-dark failures on dev itself and nothing new. Next step: re-run `px-d1b.sh`-style pixel set on this head on dev-01 (about 1 h per head) if you want it before merging.
Author
Owner

BLOCKED / unrun in the current ports lane

Current remote head: fb563bf69976edc2bab47fb4497562510d775805. This PR was not changed or retested in this pass.

The requested serial lane stopped at #902: fresh dev-01 measurement on dev 31972329b shows first-paint JS +313 B (+0.306 KiB), CSS unchanged, and failed index/ContactsScreen bundle lines. The instruction is to stop and report additional growth requiring kayg; no budgets were raised. Current #902 evidence and exact commands.

For this PR: rebase/push, svelte-check, vitest, four-project targeted e2e, contrast, bundle delta, editor perf vs dev, and fresh real Safari / iPhone Simulator product-versus-mockup captures are unrun in this pass. Earlier evidence remains historical; this comment makes no current READY claim. The approved tables/attachments growth remains accepted as specified by kayg; that approval was not revoked or changed. No merge performed.

## BLOCKED / unrun in the current ports lane Current remote head: `fb563bf69976edc2bab47fb4497562510d775805`. This PR was not changed or retested in this pass. The requested serial lane stopped at #902: fresh dev-01 measurement on dev `31972329b` shows first-paint JS +313 B (+0.306 KiB), CSS unchanged, and failed index/ContactsScreen bundle lines. The instruction is to stop and report additional growth requiring kayg; no budgets were raised. [Current #902 evidence and exact commands](https://git.kayg.org/kayg/calternal/pulls/902#issuecomment-90034). For this PR: rebase/push, svelte-check, vitest, four-project targeted e2e, contrast, bundle delta, editor perf vs dev, and fresh real Safari / iPhone Simulator product-versus-mockup captures are **unrun in this pass**. Earlier evidence remains historical; this comment makes no current READY claim. The approved tables/attachments growth remains accepted as specified by kayg; that approval was not revoked or changed. No merge performed.
Author
Owner

current-dev validation: BLOCKED

Head 3f67f0cbe, based on dev 31972329b. No merge performed.

Only this PR's original named budget lines were carried over; current dev's unrelated lines and ContactsScreen approval remain intact. _approval_tables_854 cites "kayg 11-10, tables and attachments ports OK".

All checks ran on dev-01 through ~/bin/slot and the Nix shell:

gate result
bun run --cwd apps/web check 0 errors, 18 warnings
bun run --cwd apps/web test 238 passed
bun run --cwd packages/editor test 582 passed
targeted Playwright, four main projects 116 passed, 32 skipped, 0 failed
bunx playwright test --project=contrast --workers=1 --retries=0 10 passed
PERF_WORK=… PERF_OUT=… bash perf/web.sh --bundle-only --gate PASS

Targeted command: CI=1 E2E_DIST=<built-dist> CALTERNAL_BIN=<dev-debug-bin> bunx playwright test e2e/tables.spec.ts e2e/tables-more.spec.ts e2e/keys-no-motion.spec.ts --project=chromium-1440 --project=chromium-390 --project=webkit-1440 --project=webkit-390 --workers=1 --retries=0.

First paint, Brotli vs current dev: JS +543 B (+0.530 KiB); CSS +167 B (+0.163 KiB). Total JS including opt-in chunks +13022 B (+12.717 KiB). Dev: JS 227763 B, CSS 18859 B, total JS 534085 B. Normalising content-hash references gives JS +284 B. The recorded allowance is JS +275 B plain / +611 B normalised, CSS +164 B. Normalised JS is within that record, but wire JS is larger and CSS is 3 B beyond it. This is BLOCKED; no extra budget was granted or added.

Gate logs and bundle JSON.

Typing on perf-02 through the plain FIFO perf-turn, holding both VM locks, Chromium 4× slowdown, 10k fixture notes, three counterbalanced rounds, independent dev A and dev B controls. Exact selector: bunx playwright test -c perf/playwright.config.ts '(^|/)typing[.]perf[.]ts$' --project=chromium --workers=1. 48/48 checks passed. Both locks released. No timings ran on std; Mac VM memory was below its 2 GB perf floor, so it was used only for captures.

Medians of per-run p50 / p95 latency (ms), and median CPU ms/key:

metric dev A dev B #845 #854
code_block 54.20 / 98.70 58.00 / 100.60 48.10 / 76.40 63.90 / 75.30
code_block_cpu 29.74 30.52 30.25 29.69
code_note_prose 43.30 / 70.50 51.70 / 74.90 43.30 / 69.90 60.60 / 100.20
code_note_prose_cpu 32.67 32.50 32.54 32.41
long_note 65.60 / 100.10 64.00 / 100.30 63.00 / 81.90 64.20 / 80.30
long_note_cpu 27.35 28.39 27.86 28.31
nested_list 43.70 / 52.60 43.40 / 54.90 43.50 / 53.90 44.00 / 53.80
nested_list_cpu 50.99 51.25 51.19 50.93

Raw samples, logs and exact run script. The initial broad filename selector was stopped and discarded; these results use fresh fixture homes and the exact selector. The perf-01-to-perf-02 SSH connection failed on retry, so the control host coordinated a FIFO perf-01 holder and the measurement unit on perf-02; both locks were held together, and measurement began immediately.

Perf qualification is BLOCKED for #854: code-note prose latency is 60.6 / 100.2 ms versus dev A 43.3 / 70.5 and dev B 51.7 / 74.9. CPU cost is flat, but that does not establish flat input latency. No no-regression claim is made.

Real Safari on the Mac VM, actual 1440×900, light and dark. Native iPhone 18 Pro Safari on std, own simulator under the std lock, iOS 27, light and dark. The native phone is 402 CSS px wide (1206-pixel screenshots); auxiliary WebKit captures below cover exactly 390×844. Glass is judged only from real Safari and iPhone captures.

state approved mockup product
1440 Safari, light mockup product
iPhone Safari, light mockup product
390 layout, light mockup product
1440 Safari, dark mockup product
iPhone Safari, dark mockup product
390 layout, dark mockup product

Visual differences remain visible: the resting phone capture uses narrower, more equal column widths and a solid cell/header treatment; the mockup gives the first column more room and a tint. This wraps exercise names more on the phone. The active desktop grid also has a different tint from the mockup. The product also retains its current shell/backdrop and larger gap below the title. Captures use sample data. A fresh iPhone light capture taken after only 10 seconds showed pending content; the 25-second settled capture above renders the table. No visual parity claim is made.

Active desktop grid, real Safari: light product / light mockup · dark product / dark mockup

## current-dev validation: BLOCKED Head `3f67f0cbe`, based on dev `31972329b`. No merge performed. Only this PR's original named budget lines were carried over; current dev's unrelated lines and ContactsScreen approval remain intact. `_approval_tables_854` cites "kayg 11-10, tables and attachments ports OK". All checks ran on dev-01 through `~/bin/slot` and the Nix shell: | gate | result | |---|---| | `bun run --cwd apps/web check` | 0 errors, 18 warnings | | `bun run --cwd apps/web test` | 238 passed | | `bun run --cwd packages/editor test` | 582 passed | | targeted Playwright, four main projects | 116 passed, 32 skipped, 0 failed | | `bunx playwright test --project=contrast --workers=1 --retries=0` | 10 passed | | `PERF_WORK=… PERF_OUT=… bash perf/web.sh --bundle-only --gate` | PASS | Targeted command: `CI=1 E2E_DIST=<built-dist> CALTERNAL_BIN=<dev-debug-bin> bunx playwright test e2e/tables.spec.ts e2e/tables-more.spec.ts e2e/keys-no-motion.spec.ts --project=chromium-1440 --project=chromium-390 --project=webkit-1440 --project=webkit-390 --workers=1 --retries=0`. First paint, Brotli vs current dev: JS **+543 B (+0.530 KiB)**; CSS **+167 B (+0.163 KiB)**. Total JS including opt-in chunks **+13022 B (+12.717 KiB)**. Dev: JS 227763 B, CSS 18859 B, total JS 534085 B. Normalising content-hash references gives JS +284 B. The recorded allowance is JS +275 B plain / +611 B normalised, CSS +164 B. Normalised JS is within that record, but wire JS is larger and CSS is **3 B beyond it**. This is BLOCKED; no extra budget was granted or added. [Gate logs and bundle JSON](https://git.kayg.org/attachments/7fb79414-3bba-4070-b755-70580c2db80f). Typing on perf-02 through the plain FIFO `perf-turn`, holding both VM locks, Chromium 4× slowdown, 10k fixture notes, three counterbalanced rounds, independent dev A and dev B controls. Exact selector: `bunx playwright test -c perf/playwright.config.ts '(^|/)typing[.]perf[.]ts$' --project=chromium --workers=1`. 48/48 checks passed. Both locks released. No timings ran on std; Mac VM memory was below its 2 GB perf floor, so it was used only for captures. Medians of per-run p50 / p95 latency (ms), and median CPU ms/key: | metric | dev A | dev B | #845 | #854 | |---|---|---|---|---| | code_block | 54.20 / 98.70 | 58.00 / 100.60 | 48.10 / 76.40 | 63.90 / 75.30 | | code_block_cpu | 29.74 | 30.52 | 30.25 | 29.69 | | code_note_prose | 43.30 / 70.50 | 51.70 / 74.90 | 43.30 / 69.90 | 60.60 / 100.20 | | code_note_prose_cpu | 32.67 | 32.50 | 32.54 | 32.41 | | long_note | 65.60 / 100.10 | 64.00 / 100.30 | 63.00 / 81.90 | 64.20 / 80.30 | | long_note_cpu | 27.35 | 28.39 | 27.86 | 28.31 | | nested_list | 43.70 / 52.60 | 43.40 / 54.90 | 43.50 / 53.90 | 44.00 / 53.80 | | nested_list_cpu | 50.99 | 51.25 | 51.19 | 50.93 | [Raw samples, logs and exact run script](https://git.kayg.org/attachments/ee6db570-abad-439f-ace6-1937b0ede60c). The initial broad filename selector was stopped and discarded; these results use fresh fixture homes and the exact selector. The perf-01-to-perf-02 SSH connection failed on retry, so the control host coordinated a FIFO perf-01 holder and the measurement unit on perf-02; both locks were held together, and measurement began immediately. **Perf qualification is BLOCKED for #854:** code-note prose latency is 60.6 / 100.2 ms versus dev A 43.3 / 70.5 and dev B 51.7 / 74.9. CPU cost is flat, but that does not establish flat input latency. No no-regression claim is made. Real Safari on the Mac VM, actual 1440×900, light and dark. Native iPhone 18 Pro Safari on std, own simulator under the std lock, iOS 27, light and dark. The native phone is 402 CSS px wide (1206-pixel screenshots); auxiliary WebKit captures below cover exactly 390×844. Glass is judged only from real Safari and iPhone captures. | state | approved mockup | product | |---|---|---| | 1440 Safari, light | ![mockup](https://git.kayg.org/attachments/8d03191e-f4e0-474d-ad5e-31997b2f3e3c) | ![product](https://git.kayg.org/attachments/739c1332-f1ed-4a81-bc96-0b14a800518c) | | iPhone Safari, light | ![mockup](https://git.kayg.org/attachments/64861e52-fc90-4855-93b8-79ec7c19cd34) | ![product](https://git.kayg.org/attachments/fc1f90b2-a63c-45ab-8cbb-276a12e55309) | | 390 layout, light | ![mockup](https://git.kayg.org/attachments/6ee28aed-df72-4df1-9d42-37544592103d) | ![product](https://git.kayg.org/attachments/8e464718-80b1-4826-a719-754fc2ddfca7) | | 1440 Safari, dark | ![mockup](https://git.kayg.org/attachments/e384a765-efa1-43e7-afba-e1220a1b1eb3) | ![product](https://git.kayg.org/attachments/f6258e4d-b8ef-4750-8e8c-f0bb0bce88f6) | | iPhone Safari, dark | ![mockup](https://git.kayg.org/attachments/b70535a4-51fb-445a-85d8-eb1efa335d11) | ![product](https://git.kayg.org/attachments/2c9660ae-0841-4f57-b35b-ef62e57c998c) | | 390 layout, dark | ![mockup](https://git.kayg.org/attachments/9e73649d-83cc-4e50-8b96-1b729909c143) | ![product](https://git.kayg.org/attachments/f02029bb-08c7-4a32-9c15-865526ceae04) | Visual differences remain visible: the resting phone capture uses narrower, more equal column widths and a solid cell/header treatment; the mockup gives the first column more room and a tint. This wraps exercise names more on the phone. The active desktop grid also has a different tint from the mockup. The product also retains its current shell/backdrop and larger gap below the title. Captures use sample data. A fresh iPhone light capture taken after only 10 seconds showed pending content; the 25-second settled capture above renders the table. No visual parity claim is made. Active desktop grid, real Safari: [light product](https://git.kayg.org/attachments/b98a967e-3626-45e2-80db-3eef82a81565) / [light mockup](https://git.kayg.org/attachments/cc5acec2-28ff-4ffb-b514-602b544e146e) · [dark product](https://git.kayg.org/attachments/20a22c8b-2ab2-4fc8-8e66-6bb5e46e8e5f) / [dark mockup](https://git.kayg.org/attachments/378aa2ba-1c47-4910-a347-eb9820ae1b09)
Author
Owner

Implementation plan: typing and first paint

Base: dev 31972329b; current stack heads: #845 f828454e7, #854 3f67f0cbe.

  • Cell typing: tag the Grid's own cell transaction with its current widget identity. That one path patches the changed Markdown row and maps the existing table decoration; it must not rediscover tables across the note or rebuild the table model. Other edits, undo, structure changes, stale identities, and failed checks keep the full redraw path. Target work is proportional to the changed cell/row and CodeMirror's changed decoration ranges.
  • Layout: ignore height-only ResizeObserver notifications; refresh horizontal measurements only when the scroller width changes or scrolling changes.
  • First paint: keep the NodeView and its styles in lazy chunks, including pending-row CSS. Load them with the first table note, typed or pasted table, or Insert action. A note without a table must not fetch the table UI or its CSS.
  • Size: do not edit budgets. The latest #845 report records +179 B first-paint JS / +611 B normalized JS and +164 B CSS as the approved lines; current measured deltas are +567 B JS / +284 B normalized and +167 B CSS. #854 records +275 B JS / +611 B normalized and +164 B CSS; current deltas are +543 B JS / +284 B normalized and +167 B CSS. Rebuild and report exact post-change deltas; any growth outside those lines remains pending kayg's approval.
  • Failure table:
    • Missing or stale cell identity → fall back to full table discovery and redraw → regression test sends an untagged edit and expects discovery.
    • Cell content or row patch mismatch → adopt the document text through the existing parser path → raw-cell, round-trip, undo and table e2e coverage.
    • Lazy import or stylesheet load fails → keep the Markdown text visible at its reserved height and allow a later load attempt → lazy-load tests and table e2e.
    • ResizeObserver is absent or reports only height changes → retain CSS sizing without horizontal refresh → layout e2e and Safari/iPhone captures.
  • Gates: svelte-check, web/editor Vitest, table specs on the four main Playwright projects, contrast, bundle gate, then perf ABAB ×3 with dev-vs-dev control through the FIFO lane and both locks. Capture approved-mockup pairs in Safari at 1440 and iPhone Simulator at 390; post evidence in the PR comments.
## Implementation plan: typing and first paint Base: dev `31972329b`; current stack heads: #845 `f828454e7`, #854 `3f67f0cbe`. - Cell typing: tag the Grid's own cell transaction with its current widget identity. That one path patches the changed Markdown row and maps the existing table decoration; it must not rediscover tables across the note or rebuild the table model. Other edits, undo, structure changes, stale identities, and failed checks keep the full redraw path. Target work is proportional to the changed cell/row and CodeMirror's changed decoration ranges. - Layout: ignore height-only ResizeObserver notifications; refresh horizontal measurements only when the scroller width changes or scrolling changes. - First paint: keep the NodeView and its styles in lazy chunks, including pending-row CSS. Load them with the first table note, typed or pasted table, or Insert action. A note without a table must not fetch the table UI or its CSS. - Size: do not edit budgets. The latest #845 report records +179 B first-paint JS / +611 B normalized JS and +164 B CSS as the approved lines; current measured deltas are +567 B JS / +284 B normalized and +167 B CSS. #854 records +275 B JS / +611 B normalized and +164 B CSS; current deltas are +543 B JS / +284 B normalized and +167 B CSS. Rebuild and report exact post-change deltas; any growth outside those lines remains pending kayg's approval. - Failure table: - Missing or stale cell identity → fall back to full table discovery and redraw → regression test sends an untagged edit and expects discovery. - Cell content or row patch mismatch → adopt the document text through the existing parser path → raw-cell, round-trip, undo and table e2e coverage. - Lazy import or stylesheet load fails → keep the Markdown text visible at its reserved height and allow a later load attempt → lazy-load tests and table e2e. - ResizeObserver is absent or reports only height changes → retain CSS sizing without horizontal refresh → layout e2e and Safari/iPhone captures. - Gates: svelte-check, web/editor Vitest, table specs on the four main Playwright projects, contrast, bundle gate, then perf ABAB ×3 with dev-vs-dev control through the FIFO lane and both locks. Capture approved-mockup pairs in Safari at 1440 and iPhone Simulator at 390; post evidence in the PR comments.
Author
Owner

Tables gates on head 2d8ccfc97 (dev 796d80cba merged), 14 Nov

All on current heads, dev-01 (x86) and dev-02 (aarch64) through ~/bin/slot, Nix shell; server binary built from this branch (crates identical to dev). Logs: gate-logs.

Gate Result
bun run --cwd apps/web check 0 errors, 19 warnings
bun run --cwd apps/web test 261 passed
bun run --cwd packages/editor test 55 files, 624 passed
CI=1 … bunx playwright test e2e/tables.spec.ts e2e/tables-more.spec.ts --project=chromium-1440 --project=chromium-390 --workers=1 --retries=0 (dev-01) 54 passed, 2 skipped, 0 failed
same, --project=webkit-1440 --project=webkit-390 (dev-02) 53 passed, 3 skipped, 0 failed
bunx playwright test --project=contrast --workers=1 --retries=0 (dev-01, head 981f15448, later commits only budgets and a test skip) 10 passed
PERF_WORK=… PERF_OUT=… PERF_DIST=… bash perf/web.sh --bundle-only --gate PASS (exit 0)

Bundle (brotli, vs dev 796d80cba build on the same box): first-paint JS +695 B (224.428 KiB vs 223.75), first-paint CSS +0 B (18.479 KiB). kayg approved <1 KB on 14 Nov, so no trimming; lines recorded in perf/budgets.json (_approval_tables_1114): index 224.6, tables 12.2, new lazy chunk 0.55, press 7.9 and code-javascript 24.5 for hash jitter, total = sum of lines (558.84).

What changed this round

  1. origin/dev merged into #845, #845 merged into #854 (conflicts: perf/budgets.json, Editor.svelte readFm + table-cell skip).
  2. Typing. Profiled on dev-01 (V8 sampler, Chromium 4x CPU). Plain-note and code-note prose typing run no code of this PR per key (only a cheap Enter check and a cell-edit map); the sampled prose profile matches dev (73 vs 78 ms/key program time) so the earlier "slower than dev" prose number was machine noise, and the formal runs below confirm it. The real per-key cost was table cell typing: every frame wrote the cell into the note, and each write made the Markdown parser re-read the whole table block (a table is one block), the parseInline / parse / nextLine samples. Fix (gate.ts): keys wait for a 160 ms gap (480 ms at most) and then write once; leaving the cell, structure edits, undo, destroy and page hide flush at once. Profiled: 124 → 27 writes per 168 keys; under the profiler on the busy box cell p50 1705 → 183 ms. New test tables-commit-gate.test.ts (burst coalescing, max wait, flush, cancel); existing tests cover decoration mapping (tables-cell-update), the width-only ResizeObserver (tables-resize), and fallbacks (tables-lazy, tables-trigger).
  3. Layout bug found by the Safari shots, fixed: the fit gave a short numeric last column 64 px but the stylesheet's .td:last-child needs 7.5em, so the last column ("Reps") poked out past the card and showed blank on desktop. The fit now reserves it (grid.ts), with an e2e check (the last column stays inside the card).
  4. Test race fixed: cell typing keeps column width measured before the first fit (WebKit failed deterministically).

Typing, formal: ABAB ×3 with dev-vs-dev control, perf-02 under both perf locks via perf-01 perf-turn ticket

Selector bunx playwright test -c perf/playwright.config.ts '(^|/)typing[.]perf[.]ts$' --project=chromium --workers=1, 10k fixture notes, Chromium 4x slowdown, fresh fixture home per run; arms devA / devB (same dev build, independent controls) / #845 / #854, three rounds in rotated order, 12/12 runs rc=0. Binaries and fixtures sha256-verified before the ticket. Median over the 3 runs of each run's p50 / p95 (ms) and CPU ms/key:

metric | devA | devB | p845 | p854   (median of per-run p50 / p95 ms, n runs)
type.code_block | 54.2 / 107.0 (n=3) | 60.1 / 114.8 (n=3) | 64.0 / 119.7 (n=3) | 51.5 / 112.4 (n=3)
type.code_block_cpu | 31.8 / 31.8 (n=3) | 32.1 / 32.1 (n=3) | 32.5 / 32.5 (n=3) | 32.3 / 32.3 (n=3)
type.code_note_prose | 56.8 / 107.3 (n=3) | 53.3 / 104.0 (n=3) | 57.6 / 116.7 (n=3) | 56.4 / 108.0 (n=3)
type.code_note_prose_cpu | 35.7 / 35.7 (n=3) | 35.4 / 35.4 (n=3) | 34.7 / 34.7 (n=3) | 34.8 / 34.8 (n=3)
type.long_note | 53.6 / 104.4 (n=3) | 48.5 / 100.5 (n=3) | 53.6 / 99.9 (n=3) | 58.1 / 107.2 (n=3)
type.long_note_cpu | 30.5 / 30.5 (n=3) | 30.8 / 30.8 (n=3) | 30.3 / 30.3 (n=3) | 29.9 / 29.9 (n=3)
type.nested_list | 46.7 / 64.3 (n=3) | 45.3 / 68.3 (n=3) | 46.1 / 63.4 (n=3) | 45.9 / 66.4 (n=3)
type.nested_list_cpu | 55.4 / 55.4 (n=3) | 55.0 / 55.0 (n=3) | 54.7 / 54.7 (n=3) | 54.5 / 54.5 (n=3)
type.table_cell | - | - | 171.8 / 436.4 (n=3) | 79.1 / 159.8 (n=3)
type.table_cell_commit | - | - | 187.2 / 504.1 (n=3) | 385.3 / 632.2 (n=3)
type.table_cell_cpu | - | - | 70.6 / 70.6 (n=3) | 31.3 / 31.3 (n=3)

Raw: typing-results.tgz.

Reading: plain-note typing for #854 is inside the dev-vs-dev spread on every case (long note 58.1 vs 48.5–53.6 p50 is the one to watch: dev A/B differ by 5 ms themselves and CPU/key is flat 29.9 vs 30.5/30.8; prose 56.4 vs 56.8/53.3; nested list 45.9 vs 46.7/45.3; code block 51.5 vs 54.2/60.1). CPU per key is flat everywhere (±1 ms). Table cell: #854 79 / 160 ms and 31 ms CPU/key, against #845's 172 / 436 ms and 71 ms/key; there is no dev cell arm (dev has no tables), the cell CPU/key now equals dev's plain-note level (30–36). By design the commit to the note is now 385 ms median (it waits for the quiet gap); nothing paints from it.

Real Safari (macos-01, 1440×900) and iPhone Simulator (std, own sim iOS 27.0, deleted), product at 2d8ccfc97's code, sample note

Mockup images are the approved review/calendar-2 ones already attached above.

state mockup product
1440 Safari light m p
1440 Safari dark m p
active grid, light m p
active grid, dark m p
iPhone light m p
iPhone dark m p

No parity claim. Open on the phone: a 3-column table with a long first column is wider than the 402 px card, so Reps sits off to the right behind the fade (scrolls sideways, first column pinned) while the mockup shows all columns; the first-column width allotment is the thing to look at. Phone shots show resting state only (no tap automation this round).

Not merged. Decisions: no extra trimming (kayg 14 Nov); cell commit debounce chosen over a parser change (a table stays one Markdown block).

## Tables gates on head `2d8ccfc97` (dev `796d80cba` merged), 14 Nov All on current heads, dev-01 (x86) and dev-02 (aarch64) through `~/bin/slot`, Nix shell; server binary built from this branch (crates identical to dev). Logs: [gate-logs](https://git.kayg.org/attachments/daccf61b-43f5-4966-b809-6b8b2feae3cb). | Gate | Result | |---|---| | `bun run --cwd apps/web check` | 0 errors, 19 warnings | | `bun run --cwd apps/web test` | 261 passed | | `bun run --cwd packages/editor test` | 55 files, 624 passed | | `CI=1 … bunx playwright test e2e/tables.spec.ts e2e/tables-more.spec.ts --project=chromium-1440 --project=chromium-390 --workers=1 --retries=0` (dev-01) | 54 passed, 2 skipped, 0 failed | | same, `--project=webkit-1440 --project=webkit-390` (dev-02) | 53 passed, 3 skipped, 0 failed | | `bunx playwright test --project=contrast --workers=1 --retries=0` (dev-01, head `981f15448`, later commits only budgets and a test skip) | 10 passed | | `PERF_WORK=… PERF_OUT=… PERF_DIST=… bash perf/web.sh --bundle-only --gate` | PASS (exit 0) | Bundle (brotli, vs dev `796d80cba` build on the same box): first-paint JS **+695 B** (224.428 KiB vs 223.75), first-paint CSS **+0 B** (18.479 KiB). kayg approved <1 KB on 14 Nov, so no trimming; lines recorded in `perf/budgets.json` (`_approval_tables_1114`): index 224.6, tables 12.2, new lazy chunk 0.55, press 7.9 and code-javascript 24.5 for hash jitter, total = sum of lines (558.84). ### What changed this round 1. `origin/dev` merged into #845, #845 merged into #854 (conflicts: `perf/budgets.json`, `Editor.svelte` `readFm` + table-cell skip). 2. **Typing.** Profiled on dev-01 (V8 sampler, Chromium 4x CPU). Plain-note and code-note prose typing run no code of this PR per key (only a cheap Enter check and a cell-edit map); the sampled prose profile matches dev (73 vs 78 ms/key program time) so the earlier "slower than dev" prose number was machine noise, and the formal runs below confirm it. The real per-key cost was table cell typing: every frame wrote the cell into the note, and each write made the Markdown parser re-read the **whole table block** (a table is one block), the `parseInline` / `parse` / `nextLine` samples. Fix (`gate.ts`): keys wait for a 160 ms gap (480 ms at most) and then write once; leaving the cell, structure edits, undo, `destroy` and page hide flush at once. Profiled: 124 → 27 writes per 168 keys; under the profiler on the busy box cell p50 1705 → 183 ms. New test `tables-commit-gate.test.ts` (burst coalescing, max wait, flush, cancel); existing tests cover decoration mapping (`tables-cell-update`), the width-only ResizeObserver (`tables-resize`), and fallbacks (`tables-lazy`, `tables-trigger`). 3. **Layout bug found by the Safari shots, fixed**: the fit gave a short numeric last column 64 px but the stylesheet's `.td:last-child` needs 7.5em, so the last column ("Reps") poked out past the card and showed blank on desktop. The fit now reserves it (`grid.ts`), with an e2e check (`the last column stays inside the card`). 4. Test race fixed: `cell typing keeps column width` measured before the first fit (WebKit failed deterministically). ### Typing, formal: ABAB ×3 with dev-vs-dev control, perf-02 under both perf locks via perf-01 `perf-turn` ticket Selector `bunx playwright test -c perf/playwright.config.ts '(^|/)typing[.]perf[.]ts$' --project=chromium --workers=1`, 10k fixture notes, Chromium 4x slowdown, fresh fixture home per run; arms devA / devB (same dev build, independent controls) / #845 / #854, three rounds in rotated order, 12/12 runs rc=0. Binaries and fixtures sha256-verified before the ticket. Median over the 3 runs of each run's p50 / p95 (ms) and CPU ms/key: ``` metric | devA | devB | p845 | p854 (median of per-run p50 / p95 ms, n runs) type.code_block | 54.2 / 107.0 (n=3) | 60.1 / 114.8 (n=3) | 64.0 / 119.7 (n=3) | 51.5 / 112.4 (n=3) type.code_block_cpu | 31.8 / 31.8 (n=3) | 32.1 / 32.1 (n=3) | 32.5 / 32.5 (n=3) | 32.3 / 32.3 (n=3) type.code_note_prose | 56.8 / 107.3 (n=3) | 53.3 / 104.0 (n=3) | 57.6 / 116.7 (n=3) | 56.4 / 108.0 (n=3) type.code_note_prose_cpu | 35.7 / 35.7 (n=3) | 35.4 / 35.4 (n=3) | 34.7 / 34.7 (n=3) | 34.8 / 34.8 (n=3) type.long_note | 53.6 / 104.4 (n=3) | 48.5 / 100.5 (n=3) | 53.6 / 99.9 (n=3) | 58.1 / 107.2 (n=3) type.long_note_cpu | 30.5 / 30.5 (n=3) | 30.8 / 30.8 (n=3) | 30.3 / 30.3 (n=3) | 29.9 / 29.9 (n=3) type.nested_list | 46.7 / 64.3 (n=3) | 45.3 / 68.3 (n=3) | 46.1 / 63.4 (n=3) | 45.9 / 66.4 (n=3) type.nested_list_cpu | 55.4 / 55.4 (n=3) | 55.0 / 55.0 (n=3) | 54.7 / 54.7 (n=3) | 54.5 / 54.5 (n=3) type.table_cell | - | - | 171.8 / 436.4 (n=3) | 79.1 / 159.8 (n=3) type.table_cell_commit | - | - | 187.2 / 504.1 (n=3) | 385.3 / 632.2 (n=3) type.table_cell_cpu | - | - | 70.6 / 70.6 (n=3) | 31.3 / 31.3 (n=3) ``` Raw: [typing-results.tgz](https://git.kayg.org/attachments/a6ec6fdc-76be-4803-b703-2215b6dde7b4). Reading: plain-note typing for #854 is inside the dev-vs-dev spread on every case (long note 58.1 vs 48.5–53.6 p50 is the one to watch: dev A/B differ by 5 ms themselves and CPU/key is flat 29.9 vs 30.5/30.8; prose 56.4 vs 56.8/53.3; nested list 45.9 vs 46.7/45.3; code block 51.5 vs 54.2/60.1). CPU per key is flat everywhere (±1 ms). **Table cell: #854 79 / 160 ms and 31 ms CPU/key, against #845's 172 / 436 ms and 71 ms/key**; there is no dev cell arm (dev has no tables), the cell CPU/key now equals dev's plain-note level (30–36). By design the *commit* to the note is now 385 ms median (it waits for the quiet gap); nothing paints from it. ### Real Safari (macos-01, 1440×900) and iPhone Simulator (std, own sim iOS 27.0, deleted), product at `2d8ccfc97`'s code, sample note Mockup images are the approved `review/calendar-2` ones already attached above. | state | mockup | product | |---|---|---| | 1440 Safari light | ![m](https://git.kayg.org/attachments/8d03191e-f4e0-474d-ad5e-31997b2f3e3c) | ![p](https://git.kayg.org/attachments/37183808-452c-4518-81e7-1dbffddf3ec5) | | 1440 Safari dark | ![m](https://git.kayg.org/attachments/e384a765-efa1-43e7-afba-e1220a1b1eb3) | ![p](https://git.kayg.org/attachments/992b6f36-4ad2-4971-87d5-756245c69b93) | | active grid, light | ![m](https://git.kayg.org/attachments/cc5acec2-28ff-4ffb-b514-602b544e146e) | ![p](https://git.kayg.org/attachments/04aa731b-b4ab-477a-b2af-ba2d15d381e0) | | active grid, dark | ![m](https://git.kayg.org/attachments/378aa2ba-1c47-4910-a347-eb9820ae1b09) | ![p](https://git.kayg.org/attachments/bbea7576-25b8-42b7-882d-d0b69c6b675c) | | iPhone light | ![m](https://git.kayg.org/attachments/64861e52-fc90-4855-93b8-79ec7c19cd34) | ![p](https://git.kayg.org/attachments/05078497-1383-42ab-94b8-dabdd9a0dff3) | | iPhone dark | ![m](https://git.kayg.org/attachments/b70535a4-51fb-445a-85d8-eb1efa335d11) | ![p](https://git.kayg.org/attachments/de6e5005-3d25-48e8-b372-cb145a3deeba) | No parity claim. Open on the phone: a 3-column table with a long first column is wider than the 402 px card, so Reps sits off to the right behind the fade (scrolls sideways, first column pinned) while the mockup shows all columns; the first-column width allotment is the thing to look at. Phone shots show resting state only (no tap automation this round). Not merged. Decisions: no extra trimming (kayg 14 Nov); cell commit debounce chosen over a parser change (a table stays one Markdown block).
Author
Owner

Round 2 on head deba78c8f (orchestrator + kayg 14 Nov): typing straight into the note, long-note check, phone width

1. Debounce reverted: a key in a cell is a note edit in the same event

How it maps onto the note is written in the PR description (section "How a table cell maps onto the note"). Short version: the note's pipe lines are the only copy; each input event in a cell replaces that one row's line in the note document in the same event (no timer, frame or queue); undo/redo/sync/crash recovery are the note's own.

  • Removed tables/gate.ts and its test. Grid.onInput calls commit() directly; the table's start position comes from the note's table record instead of walking the page's DOM.
  • Parser: the Markdown parser re-read the whole table block on each edit and parsed every cell inline (the parseInline / parse / nextLine samples). New tables/parser.ts: the note language keeps the stock table block rules (same ranges, checked against the stock parser on 13 shapes) but leaves cells without inline nodes; the grid draws cell Markdown itself. The parser still walks the table's lines (Lezer cannot skip a block), no per-cell work. In the profile parseInline/parse/nextLine no longer appear in the top functions.
  • Tests: tables-live.test.ts (the note holds each key at once; undo/redo round-trips and the cell follows; other rows byte-for-byte), tables-parser.test.ts (ranges equal stock; no inline nodes in tables; a cell edit's parseInline count is 0 for 10 and 400 rows, with a stock-parser control that does grow), e2e each key in a cell is in the note document the moment it is typed. Existing tests still cover decoration mapping (tables-cell-update), the width-only ResizeObserver (tables-resize, fit is 0 per 168 keys in the profile) and fallbacks (tables-lazy, tables-trigger).

2. Long-note typing: no per-key work from this PR

Profile on dev-01 (V8 sampler, Chromium 4x CPU), dev vs #854, 3 alternating runs each, long 50,000-word note: layout events/key 1.99 vs 1.94–1.99, style recalcs/key 3.9–4.0 vs 3.9–4.0, ScriptDuration ms/key 21.9 / 25.8 / 22.1 (dev) vs 21.7 / 24.8 / 26.4 (PR); top self-time functions identical ((program) 28.3 vs 29.4, update .75 vs .78, measure .52 vs .50; the only name that differs is a minified identifier). In a note with no table, the PR adds nothing per key (the table field and Grid are not installed; the cell-edit check in HiddenView.update is one isUserEvent call). The one in-note thing on every key is the Enter-only keydown check. The earlier 58.1 vs 48.5–53.6 was run-to-run spread on perf-02 (p50 per run swings 22–52 ms in both arms).

3. Formal typing: ABAB ×3 with dev-vs-dev control, perf-02 under both perf locks via perf-01 perf-turn ticket (long note + table cell; 12/12 runs rc=0)

Arms devA / devB (same dev build) and #854 twice per round, rounds in rotated order. Median over runs of each run's p50 / p95 (ms) and main-thread CPU ms/key. Raw.

metric | devA | devB | p854   (median of per-run p50 / p95 ms; n runs)
type.long_note | 30.9 / 67.2 (n=3; p50 range 24.8-52.1) | 34.2 / 64.3 (n=3; p50 range 22.7-51.6) | 25.5 / 66.4 (n=6; p50 range 23.3-44.6)
type.long_note_cpu | 27.7 / 27.7 (n=3; p50 range 27.1-27.9) | 27.2 / 27.2 (n=3; p50 range 27.1-28.1) | 27.3 / 27.3 (n=6; p50 range 27.0-28.3)
type.table_cell | - | - | 164.2 / 491.0 (n=6; p50 range 105.3-211.0)
type.table_cell_commit | - | - | 165.7 / 499.5 (n=6; p50 range 105.3-212.7)
type.table_cell_cpu | - | - | 37.3 / 37.3 (n=6; p50 range 36.5-37.7)
  • Long note: #854 25.5 / 66.4 vs devA 30.9 / 67.2 and devB 34.2 / 64.3, CPU/key 27.3 vs 27.7 / 27.2: flat.
  • Table cell (no dev cell arm; dev has no tables): 164 / 491 ms, CPU 37.3 ms/key, against #845's 172 / 436 ms and 70.6 ms/key, and the debounced version's 79 / 160 ms and 31.3 (which is gone by design). Cell CPU/key is 10 ms over plain-note typing (27); what remains is browser work on the big table card rather than our script: a Chromium trace of the cell case shows, per key at 4x slowdown, forced style+layout ≈ 11 ms, paint-layerize (PaintArtifactCompositor) ≈ 7 ms, a hit test after layout ≈ 6 ms, and our JS (FunctionCall) ≈ 22 ms, the same as plain typing's script time. Not fixed here; the next lever is fewer paint chunks per table row (the row/column strips). Open item for you, not a claim of parity.

4. Phone width (mockup shows every column)

tables/shrink.ts: when the columns' wanted widths exceed the card, each column gives back width above its floor (longest word, number width, the 7.5em last column) in proportion to its slack, so long text wraps instead of scrolling; a dragged width stays. Unit tests tables-shrink.test.ts; e2e a three-column table fits the card, at desktop and on a phone, long text wraps at 390 and 1440. iPhone Simulator (std, own sim, iOS 27.0, deleted): light · dark; all three columns are on the card, names wrap. (The first column is narrower than the mockup's; the last column keeps its 7.5em.)

Gates on deba78c8f (code is 758c4eda8; later commits are budgets only)

Gate Result
svelte-check 0 errors, 19 warnings
web vitest 261 passed
editor vitest 645 passed
tables specs, chromium-1440 + chromium-390 (dev-01) 57 passed, 1 skipped, 0 failed
contrast (dev-01, at d94766894) 10 passed (a first run under heavy shared load had 5 failures that did not reproduce in the rerun, nothing in them touches tables)
bundle gate PASS; first-paint JS +929 B over dev (index 224.656 KiB), CSS +0; index line 224.7, tables 12.3, total 559.07
tables specs, webkit-1440 + webkit-390 (dev-02) not re-run on the final code: dev-02 and std stopped answering (no route to host) from about 15:17 IST. Last green WebKit run: 55 passed on ad649b89d (before the parser slimming 80c9644bd and the new e2e test)

Not merged.

## Round 2 on head `deba78c8f` (orchestrator + kayg 14 Nov): typing straight into the note, long-note check, phone width ### 1. Debounce reverted: a key in a cell is a note edit in the same event How it maps onto the note is written in the PR description (section "How a table cell maps onto the note"). Short version: the note's pipe lines are the only copy; each `input` event in a cell replaces that one row's line in the note document in the same event (no timer, frame or queue); undo/redo/sync/crash recovery are the note's own. - Removed `tables/gate.ts` and its test. `Grid.onInput` calls `commit()` directly; the table's start position comes from the note's table record instead of walking the page's DOM. - **Parser**: the Markdown parser re-read the whole table block on each edit and parsed every cell inline (the `parseInline` / `parse` / `nextLine` samples). New `tables/parser.ts`: the note language keeps the stock table block rules (same ranges, checked against the stock parser on 13 shapes) but leaves cells without inline nodes; the grid draws cell Markdown itself. The parser still walks the table's lines (Lezer cannot skip a block), no per-cell work. In the profile `parseInline`/`parse`/`nextLine` no longer appear in the top functions. - Tests: `tables-live.test.ts` (the note holds each key at once; undo/redo round-trips and the cell follows; other rows byte-for-byte), `tables-parser.test.ts` (ranges equal stock; no inline nodes in tables; a cell edit's `parseInline` count is 0 for 10 and 400 rows, with a stock-parser control that does grow), e2e `each key in a cell is in the note document the moment it is typed`. Existing tests still cover decoration mapping (`tables-cell-update`), the width-only ResizeObserver (`tables-resize`, `fit` is 0 per 168 keys in the profile) and fallbacks (`tables-lazy`, `tables-trigger`). ### 2. Long-note typing: no per-key work from this PR Profile on dev-01 (V8 sampler, Chromium 4x CPU), dev vs #854, 3 alternating runs each, long 50,000-word note: layout events/key 1.99 vs 1.94–1.99, style recalcs/key 3.9–4.0 vs 3.9–4.0, ScriptDuration ms/key 21.9 / 25.8 / 22.1 (dev) vs 21.7 / 24.8 / 26.4 (PR); top self-time functions identical (`(program)` 28.3 vs 29.4, `update` .75 vs .78, `measure` .52 vs .50; the only name that differs is a minified identifier). In a note with no table, the PR adds nothing per key (the table field and Grid are not installed; the cell-edit check in `HiddenView.update` is one `isUserEvent` call). The one in-note thing on every key is the Enter-only keydown check. The earlier 58.1 vs 48.5–53.6 was run-to-run spread on perf-02 (p50 per run swings 22–52 ms in both arms). ### 3. Formal typing: ABAB ×3 with dev-vs-dev control, perf-02 under both perf locks via perf-01 `perf-turn` ticket (long note + table cell; 12/12 runs rc=0) Arms devA / devB (same dev build) and #854 twice per round, rounds in rotated order. Median over runs of each run's p50 / p95 (ms) and main-thread CPU ms/key. [Raw](https://git.kayg.org/attachments/541d472b-a156-4ab5-a2c2-3228c31e8d58). ``` metric | devA | devB | p854 (median of per-run p50 / p95 ms; n runs) type.long_note | 30.9 / 67.2 (n=3; p50 range 24.8-52.1) | 34.2 / 64.3 (n=3; p50 range 22.7-51.6) | 25.5 / 66.4 (n=6; p50 range 23.3-44.6) type.long_note_cpu | 27.7 / 27.7 (n=3; p50 range 27.1-27.9) | 27.2 / 27.2 (n=3; p50 range 27.1-28.1) | 27.3 / 27.3 (n=6; p50 range 27.0-28.3) type.table_cell | - | - | 164.2 / 491.0 (n=6; p50 range 105.3-211.0) type.table_cell_commit | - | - | 165.7 / 499.5 (n=6; p50 range 105.3-212.7) type.table_cell_cpu | - | - | 37.3 / 37.3 (n=6; p50 range 36.5-37.7) ``` - Long note: #854 25.5 / 66.4 vs devA 30.9 / 67.2 and devB 34.2 / 64.3, CPU/key 27.3 vs 27.7 / 27.2: flat. - Table cell (no dev cell arm; dev has no tables): 164 / 491 ms, CPU **37.3 ms/key**, against #845's 172 / 436 ms and 70.6 ms/key, and the debounced version's 79 / 160 ms and 31.3 (which is gone by design). Cell CPU/key is 10 ms over plain-note typing (27); what remains is browser work on the big table card rather than our script: a Chromium trace of the cell case shows, per key at 4x slowdown, forced style+layout ≈ 11 ms, paint-layerize (`PaintArtifactCompositor`) ≈ 7 ms, a hit test after layout ≈ 6 ms, and our JS (`FunctionCall`) ≈ 22 ms, the same as plain typing's script time. Not fixed here; the next lever is fewer paint chunks per table row (the row/column strips). Open item for you, not a claim of parity. ### 4. Phone width (mockup shows every column) `tables/shrink.ts`: when the columns' wanted widths exceed the card, each column gives back width above its floor (longest word, number width, the 7.5em last column) in proportion to its slack, so long text wraps instead of scrolling; a dragged width stays. Unit tests `tables-shrink.test.ts`; e2e `a three-column table fits the card, at desktop and on a phone, long text wraps` at 390 and 1440. iPhone Simulator (std, own sim, iOS 27.0, deleted): [light](https://git.kayg.org/attachments/43568d6b-99c7-48d2-8883-4176b66ba944) · [dark](https://git.kayg.org/attachments/f0e5e026-155f-4678-ac2a-17448eefd15c); all three columns are on the card, names wrap. (The first column is narrower than the mockup's; the last column keeps its 7.5em.) ### Gates on `deba78c8f` (code is `758c4eda8`; later commits are budgets only) | Gate | Result | |---|---| | svelte-check | 0 errors, 19 warnings | | web vitest | 261 passed | | editor vitest | 645 passed | | tables specs, chromium-1440 + chromium-390 (dev-01) | 57 passed, 1 skipped, 0 failed | | contrast (dev-01, at `d94766894`) | 10 passed (a first run under heavy shared load had 5 failures that did not reproduce in the rerun, nothing in them touches tables) | | bundle gate | PASS; first-paint JS **+929 B** over dev (index 224.656 KiB), CSS +0; index line 224.7, tables 12.3, total 559.07 | | tables specs, webkit-1440 + webkit-390 (dev-02) | **not re-run on the final code**: dev-02 and std stopped answering (`no route to host`) from about 15:17 IST. Last green WebKit run: 55 passed on `ad649b89d` (before the parser slimming `80c9644bd` and the new e2e test) | Not merged.
Author
Owner

Addendum: WebKit on the final code

dev-02 and std stayed unreachable, so I ran the WebKit projects on dev-01 (x86, Playwright WebKit, through ~/bin/slot): CI=1 … bunx playwright test e2e/tables.spec.ts e2e/tables-more.spec.ts --project=webkit-1440 --project=webkit-390 --workers=1 --retries=0 on head deba78c8f (code 758c4eda8): 57 passed, 1 skipped, 0 failed. That replaces the "not re-run" row above. (x86 WebKit is not dev-02's aarch64 build; rerun there when it is back if you want the same box as the daily train.)

### Addendum: WebKit on the final code dev-02 and std stayed unreachable, so I ran the WebKit projects on dev-01 (x86, Playwright WebKit, through `~/bin/slot`): `CI=1 … bunx playwright test e2e/tables.spec.ts e2e/tables-more.spec.ts --project=webkit-1440 --project=webkit-390 --workers=1 --retries=0` on head `deba78c8f` (code `758c4eda8`): **57 passed, 1 skipped, 0 failed**. That replaces the "not re-run" row above. (x86 WebKit is not dev-02's aarch64 build; rerun there when it is back if you want the same box as the daily train.)
Author
Owner

Round 3 on head a47c26d4a: faster cell typing, still no layer in between (14 Nov)

The write path stays exactly as kayg asked: every input in a cell replaces that row's line in the note document in the same event. No timer, no batching, no draft. All of this round's work is in how the browser draws the card.

Where the time went (dev-01, Chromium trace, 4× CPU, 168 keys, 120-row × 8-column table)

I profiled the base head deba78c8f, then took CSS out piece by piece by injecting a style tag into the same build (one variable per run, alternating, with base repeated). Main-thread task ms per key:

what was tried ms/key effect
base (cell) 56–58 long note on the same box: 39
no content-visibility on rows 72 worse: then every row paints
sticky first column off 52 layerize 7.2 → 4.5 (one sticky layer per row)
ordinary cells not positioned 57 no change alone
no strips / no borders / no pseudo shadows / rows not positioned / flex rows 56–57 / 51 noise, or a change too small to keep
content-visibility per 16-row group instead of per row 49.6 the browser's per-frame check of skipped boxes, 1.5 → 0.2 ms/key; layout 4.4 → 3.2
scroll-snap areas on header cells only (on top of the two above) 43–44 the editing step's own work (EventDispatch self) 6.7 → 3.5–4.0, layout 3.3 → 2.3. Every cell was a snap area, and the browser re-reads all of them after each layout
group size 8 / 16 / 32 44–47 / 45–47 / 48–49 16 kept

Script time (FunctionCall) was 18 ms/key in every arm, the same as plain-note typing. Forced layouts from JS were under 0.3 ms/key (CodeMirror's own measure). The big forced layout came from the browser's text insertion, and it was mostly the snap areas.

It no longer grows with the table (dev-01, same trace setup, 2 runs per cell):

rows base ms/key base p50 new ms/key new p50
120 52.7 / 55.8 192 / 378 ms 45.3 / 45.3 152 / 156 ms
480 105.7 / 107.6 1468 / 2548 ms 49.4 / 51.1 179 / 225 ms

What still grows is about 1 ms per 100 rows, mostly the per-group check (one entry per 16 rows).

What changed

  1. cf241fb01, 559e4ee16: tables.css + grid.ts
    • Rows are drawn in groups of 16, one tbody each, with content-visibility: auto per group. A short last group gets its own size guess. Rows are read through table.rows / rowIndex, which span the groups. edges.ts / motion.ts take the table instead of a tbody.
    • The first column is position: sticky only when the table is wider than its card. data-wide is set in applyWidths, where scrollWidth was already read; it is never read on a key, because typing keeps the column widths.
    • Ordinary cells are not positioned. Header cells and the first column still are, because they hold the strips and handles.
    • Only header cells (except the first) are snap areas. Snapping is the same: every column starts at its header.
    • Row borders: .td:not(.th) instead of tr + tr, because tr + tr would miss the first row of each group. The header background is tbody:first-child > tr:first-child.
  2. a47c26d4a: a typing fix svelte-check asked for. Also notes-visibility-apply jitter: the code is identical (raw 1,092 B in dev and here), but its brotli size moves 568–574 B with hashed import names. Line 0.56 → 0.57, total +0.01 (559.08), with a note in budgets.json.
  3. Test: tables-live.test.ts "a long table is drawn in row groups of 16, and a key in a later group edits its own row" (41 rows → groups 16/16/9; a key in row 20 changes note line 22 and leaves 21 and 23 byte-for-byte). The happy-dom polyfill gained HTMLTableElement.rows / rowIndex.

Not needed: the widget's eq/updateDOM. A cell edit already maps the same decoration and widget instance (no DOM rebuild), and the trace shows no widget work per key. The scroller's width-only ResizeObserver already ignores same-width edits.

Formal typing: ABAB ×3 with dev-vs-dev control

Setup:

  • perf-01 under ~/bin/perf-turn (ticket tables-typing-1114), with perf-02's lock held for the whole session by an hd01 watcher. Asked 13:59, held 14:01–14:08 CET, released at once.
  • 4× CPU, 10k-note fixture. A fresh copy of my own fixture home for each run (relayed from the 13 Nov tables relay, not ~/nfa-perf).
  • Release server built from dev 796d80cba; crates are identical to this branch. sha256 checked on dev-01, hd01 and perf-01.
  • Harness = this branch's typing.perf.ts, -g "50,000-word note|inside a table cell".
  • Arms: devA / devB (the same dev 796d80cba dist), pre (deba78c8f), new (a47c26d4a). Rounds rotated. 12/12 runs rc=0; dev skips the table test (no tables).

Median over runs of each run's p50 / p95 (ms), and main-thread CPU ms/key:

metric            | devA                         | devB                         | pre (deba78c8f)               | new (a47c26d4a)
type.long_note    | 53.5 / 99.8 (p50 30.9-58.0)  | 44.4 / 74.6 (p50 36.1-49.2)  | 42.3 / 85.8 (p50 39.5-56.9)   | 48.8 / 71.4 (p50 33.7-57.7)
type.long_note_cpu| 27.4 (26.2-28.6)             | 27.6 (27.4-28.9)             | 27.5 (27.5-28.8)              | 27.1 (27.0-27.7)
type.table_cell   | -                            | -                            | 150.2 / 340.8 (p50 109-150)   | 86.5 / 177.9 (p50 80-97)
type.table_cell_cpu| -                           | -                            | 37.5 (36.8-38.4)              | 31.2 (29.9-38.0)
  • Table cell: p50 150 → 86.5 ms, p95 341 → 178 ms, CPU 37.5 → 31.2 ms/key. Plain-note typing on the same box is 27 ms CPU and p50 44–54. Cell typing is now in the same order of magnitude: about 4 ms CPU/key above plain typing.
  • Long note: CPU 27.1 vs dev 27.4 / 27.6, p50 inside the dev-vs-dev spread. Flat, as expected: nothing in this round runs without a table.

Raw: typing-results-1114.tgz (driver, metrics, logs); profile summaries, ablation CSS and gate logs: profile-gates-1114.tgz.

Gates

gate where result
bun run --cwd apps/web check dev-01, a47c26d4a 0 errors, 19 warnings (at cf241fb01 it found the typing error fixed in a47c26d4a)
bun run --cwd apps/web test dev-01, cf241fb01 (a47c26d4a only changes a TS annotation and budgets) 27 files, 261 passed
bun run --cwd packages/editor test (incl. tables-live / tables-parser / tables-shrink) dev-01, a47c26d4a 57 files, 646 passed
CI=1 CALTERNAL_BIN=<debug 796d80cba> bunx playwright test e2e/tables.spec.ts e2e/tables-more.spec.ts --project=<p> --workers=1 --retries=0 dev-01, cf241fb01 chromium-1440 28 passed + 1 skipped; chromium-390 29 passed; webkit-1440 28 + 1 skipped; webkit-390 29 passed
same, re-run on a47c26d4a dev-01 chromium-1440 28 + 1 skipped; webkit-390 29 passed
bunx playwright test --project=contrast --workers=1 --retries=0 dev-01, cf241fb01 10 passed
PERF_WORK=… PERF_OUT=… bash perf/web.sh --bundle-only --gate dev-01, a47c26d4a PASS

WebKit ran on dev-01 (x86), not dev-02: dev-02 was unreachable ("no route to host" at about 16:40 IST).

Bundle (brotli), vs deba78c8f: first-paint JS raw is identical (810,716 B), brotli −33 B (jitter); first-paint CSS is identical. The lazy tables chunk is +89 B (12,457 → 12,546 B, the row groups and data-wide).

Open

  • Real Safari / iPhone sim were not re-shot. The look should be the same; worth eyeballing:
    • a wide table's pinned first column while scrolled (only wide tables pin now);
    • row lines at rows 16, 32, … (group boundaries);
    • the header tint.
  • The rest of the cell's cost above plain typing (about 4 ms CPU/key) is layerize/prepaint of the rows near the screen. It is bounded by the viewport, not by the table.
## Round 3 on head `a47c26d4a`: faster cell typing, still no layer in between (14 Nov) The write path stays exactly as kayg asked: every `input` in a cell replaces that row's line in the note document in the same event. No timer, no batching, no draft. All of this round's work is in how the browser draws the card. ### Where the time went (dev-01, Chromium trace, 4× CPU, 168 keys, 120-row × 8-column table) I profiled the base head `deba78c8f`, then took CSS out piece by piece by injecting a style tag into the same build (one variable per run, alternating, with base repeated). Main-thread task ms per key: | what was tried | ms/key | effect | |---|---|---| | base (cell) | 56–58 | long note on the same box: 39 | | no `content-visibility` on rows | 72 | worse: then every row paints | | sticky first column off | 52 | layerize 7.2 → 4.5 (one sticky layer per row) | | ordinary cells not positioned | 57 | no change alone | | no strips / no borders / no pseudo shadows / rows not positioned / flex rows | 56–57 / 51 | noise, or a change too small to keep | | **`content-visibility` per 16-row group instead of per row** | 49.6 | the browser's per-frame check of skipped boxes, 1.5 → 0.2 ms/key; layout 4.4 → 3.2 | | **scroll-snap areas on header cells only** (on top of the two above) | 43–44 | the editing step's own work (EventDispatch self) 6.7 → 3.5–4.0, layout 3.3 → 2.3. Every cell was a snap area, and the browser re-reads all of them after each layout | | group size 8 / 16 / 32 | 44–47 / 45–47 / 48–49 | 16 kept | Script time (`FunctionCall`) was 18 ms/key in every arm, the same as plain-note typing. Forced layouts from JS were under 0.3 ms/key (CodeMirror's own measure). The big forced layout came from the browser's text insertion, and it was mostly the snap areas. **It no longer grows with the table** (dev-01, same trace setup, 2 runs per cell): | rows | base ms/key | base p50 | new ms/key | new p50 | |---|---|---|---|---| | 120 | 52.7 / 55.8 | 192 / 378 ms | 45.3 / 45.3 | 152 / 156 ms | | 480 | 105.7 / 107.6 | 1468 / 2548 ms | 49.4 / 51.1 | 179 / 225 ms | What still grows is about 1 ms per 100 rows, mostly the per-group check (one entry per 16 rows). ### What changed 1. `cf241fb01`, `559e4ee16`: `tables.css` + `grid.ts` - Rows are drawn in groups of 16, one `tbody` each, with `content-visibility: auto` per group. A short last group gets its own size guess. Rows are read through `table.rows` / `rowIndex`, which span the groups. `edges.ts` / `motion.ts` take the table instead of a tbody. - The first column is `position: sticky` only when the table is wider than its card. `data-wide` is set in `applyWidths`, where `scrollWidth` was already read; it is never read on a key, because typing keeps the column widths. - Ordinary cells are not positioned. Header cells and the first column still are, because they hold the strips and handles. - Only header cells (except the first) are snap areas. Snapping is the same: every column starts at its header. - Row borders: `.td:not(.th)` instead of `tr + tr`, because `tr + tr` would miss the first row of each group. The header background is `tbody:first-child > tr:first-child`. 2. `a47c26d4a`: a typing fix svelte-check asked for. Also `notes-visibility-apply` jitter: the code is identical (raw 1,092 B in dev and here), but its brotli size moves 568–574 B with hashed import names. Line 0.56 → 0.57, total +0.01 (559.08), with a note in `budgets.json`. 3. Test: `tables-live.test.ts` "a long table is drawn in row groups of 16, and a key in a later group edits its own row" (41 rows → groups 16/16/9; a key in row 20 changes note line 22 and leaves 21 and 23 byte-for-byte). The happy-dom polyfill gained `HTMLTableElement.rows` / `rowIndex`. Not needed: the widget's `eq`/`updateDOM`. A cell edit already maps the same decoration and widget instance (no DOM rebuild), and the trace shows no widget work per key. The scroller's width-only `ResizeObserver` already ignores same-width edits. ### Formal typing: ABAB ×3 with dev-vs-dev control Setup: - perf-01 under `~/bin/perf-turn` (ticket `tables-typing-1114`), with perf-02's lock held for the whole session by an hd01 watcher. Asked 13:59, held 14:01–14:08 CET, released at once. - 4× CPU, 10k-note fixture. A fresh copy of my own fixture home for each run (relayed from the 13 Nov tables relay, not `~/nfa-perf`). - Release server built from dev `796d80cba`; crates are identical to this branch. sha256 checked on dev-01, hd01 and perf-01. - Harness = this branch's `typing.perf.ts`, `-g "50,000-word note|inside a table cell"`. - Arms: devA / devB (the same dev `796d80cba` dist), pre (`deba78c8f`), new (`a47c26d4a`). Rounds rotated. 12/12 runs rc=0; dev skips the table test (no tables). Median over runs of each run's p50 / p95 (ms), and main-thread CPU ms/key: ``` metric | devA | devB | pre (deba78c8f) | new (a47c26d4a) type.long_note | 53.5 / 99.8 (p50 30.9-58.0) | 44.4 / 74.6 (p50 36.1-49.2) | 42.3 / 85.8 (p50 39.5-56.9) | 48.8 / 71.4 (p50 33.7-57.7) type.long_note_cpu| 27.4 (26.2-28.6) | 27.6 (27.4-28.9) | 27.5 (27.5-28.8) | 27.1 (27.0-27.7) type.table_cell | - | - | 150.2 / 340.8 (p50 109-150) | 86.5 / 177.9 (p50 80-97) type.table_cell_cpu| - | - | 37.5 (36.8-38.4) | 31.2 (29.9-38.0) ``` - Table cell: p50 **150 → 86.5 ms**, p95 **341 → 178 ms**, CPU **37.5 → 31.2 ms/key**. Plain-note typing on the same box is 27 ms CPU and p50 44–54. Cell typing is now in the same order of magnitude: about 4 ms CPU/key above plain typing. - Long note: CPU 27.1 vs dev 27.4 / 27.6, p50 inside the dev-vs-dev spread. Flat, as expected: nothing in this round runs without a table. Raw: [typing-results-1114.tgz](https://git.kayg.org/attachments/3fd58d50-ab16-4fb2-915c-508b401c8f65) (driver, metrics, logs); profile summaries, ablation CSS and gate logs: [profile-gates-1114.tgz](https://git.kayg.org/attachments/1567b43a-0d2b-4536-884c-30c75f55996a). ### Gates | gate | where | result | |---|---|---| | `bun run --cwd apps/web check` | dev-01, `a47c26d4a` | 0 errors, 19 warnings (at `cf241fb01` it found the typing error fixed in `a47c26d4a`) | | `bun run --cwd apps/web test` | dev-01, `cf241fb01` (`a47c26d4a` only changes a TS annotation and budgets) | 27 files, 261 passed | | `bun run --cwd packages/editor test` (incl. tables-live / tables-parser / tables-shrink) | dev-01, `a47c26d4a` | 57 files, 646 passed | | `CI=1 CALTERNAL_BIN=<debug 796d80cba> bunx playwright test e2e/tables.spec.ts e2e/tables-more.spec.ts --project=<p> --workers=1 --retries=0` | dev-01, `cf241fb01` | chromium-1440 28 passed + 1 skipped; chromium-390 29 passed; webkit-1440 28 + 1 skipped; webkit-390 29 passed | | same, re-run on `a47c26d4a` | dev-01 | chromium-1440 28 + 1 skipped; webkit-390 29 passed | | `bunx playwright test --project=contrast --workers=1 --retries=0` | dev-01, `cf241fb01` | 10 passed | | `PERF_WORK=… PERF_OUT=… bash perf/web.sh --bundle-only --gate` | dev-01, `a47c26d4a` | PASS | **WebKit ran on dev-01 (x86), not dev-02:** dev-02 was unreachable ("no route to host" at about 16:40 IST). Bundle (brotli), vs `deba78c8f`: first-paint JS raw is identical (810,716 B), brotli −33 B (jitter); first-paint CSS is identical. The lazy `tables` chunk is +89 B (12,457 → 12,546 B, the row groups and `data-wide`). ### Open - Real Safari / iPhone sim were not re-shot. The look should be the same; worth eyeballing: - a wide table's pinned first column while scrolled (only wide tables pin now); - row lines at rows 16, 32, … (group boundaries); - the header tint. - The rest of the cell's cost above plain typing (about 4 ms CPU/key) is layerize/prepaint of the rows near the screen. It is bounded by the viewport, not by the table.
Author
Owner

Final checks, #854 @ a47c26d4a vs origin/dev 8b00393b0 (attachments port): NOT merge-ready, stopped after step 1.

1. Merge-readiness: CONFLICTS (git merge origin/port/port-tables-2 on a detached origin/dev worktree; aborted, nothing resolved, nothing pushed). 3 files:

  • packages/editor/src/insert/insert.ts: 1 hunk. dev added a comment above if (a.run) return a.run(view) (file chooser "does something else than write markdown"); the branch removed it. Trivial.
  • packages/editor/src/insert/plugins.ts: 1 hunk in the imports. dev added import type { EditorView } plus the attach() helper (calternal:attach event for Photos/File blocks); the branch added import { insertTable } from '../tables/slot'. Keep both.
  • perf/budgets.json: 1 hunk. dev has notes-visibility-apply 0.56, _web_attachments_lazy note and chunk.index 224.59; the branch has 0.57 and 224.7. The two sets of growth have to be re-measured together, so this needs a real first-paint number on the merged head, not a pick of one side.

2-4 not run. The merge needs a hand resolution and a new budget, so the branch will get a new head. Webkit tables specs, the per-project full suite and real Safari / iPhone Simulator shots on a resolved head would not describe what merges, and would need repeating. Nothing was started on any VM; no locks, sims or Safari touched.

Next: rebase or merge origin/dev into port/port-tables-2 (the three hunks above), re-measure the index chunk, then rerun steps 2-4 on the new head.

**Final checks, #854 @ a47c26d4a vs origin/dev 8b00393b0 (attachments port): NOT merge-ready, stopped after step 1.** **1. Merge-readiness: CONFLICTS** (`git merge origin/port/port-tables-2` on a detached origin/dev worktree; aborted, nothing resolved, nothing pushed). 3 files: - `packages/editor/src/insert/insert.ts`: 1 hunk. dev added a comment above `if (a.run) return a.run(view)` (file chooser "does something else than write markdown"); the branch removed it. Trivial. - `packages/editor/src/insert/plugins.ts`: 1 hunk in the imports. dev added `import type { EditorView }` plus the `attach()` helper (`calternal:attach` event for Photos/File blocks); the branch added `import { insertTable } from '../tables/slot'`. Keep both. - `perf/budgets.json`: 1 hunk. dev has `notes-visibility-apply` 0.56, `_web_attachments_lazy` note and `chunk.index` 224.59; the branch has 0.57 and 224.7. The two sets of growth have to be re-measured together, so this needs a real first-paint number on the merged head, not a pick of one side. **2-4 not run.** The merge needs a hand resolution and a new budget, so the branch will get a new head. Webkit tables specs, the per-project full suite and real Safari / iPhone Simulator shots on a resolved head would not describe what merges, and would need repeating. Nothing was started on any VM; no locks, sims or Safari touched. Next: rebase or merge origin/dev into `port/port-tables-2` (the three hunks above), re-measure the index chunk, then rerun steps 2-4 on the new head.
Author
Owner

Final checks, resumed (hd01): #854 now merged with dev 8b00393b0 and pushed as 730a6dd33. All suites green; one flake (not a blocker); Safari/iPhone findings below. Supersedes my earlier comment (which said 1 conflicting hunk in perf/budgets.json; it was 3 hunks).

1. Merge (orchestrator OK): git merge --no-ff origin/dev into a47c26d4a -> e19d3165d, conflicts in insert.ts (kept dev's comment), plugins.ts (kept both: EditorView import + attach() AND insertTable), perf/budgets.json (3 hunks: both sides' notes kept, chunk.attachments + dev's lines kept). Then 730a6dd33 sets the budgets to the measured sizes on dev-01 (perf/web.sh --bundle-only): first-paint JS 225.318 KiB brotli (+0.73 KiB over dev's 224.59, under 1 KB), CSS 18.48 (budget 22.1); chunk.index 225.32, PictureViewer 1.222 -> 1.23, total = sum of lines (570.05). Pushed to port/port-tables-2 (a47c26d4a..730a6dd33).
Gates on the merged head (dev-01): bun run check: 0 errors (19 warnings, same files as before); web vitest 272/272, editor vitest 663/663; tables.spec.ts + tables-more.spec.ts chromium-1440: 28 passed, 1 skipped.

2. WebKit tables (dev-02, server binary built from the head): tables.spec.ts + tables-more.spec.ts webkit-1440: 28 passed, 1 skipped.

3. Full suite on 730a6dd33 (already = branch merged with dev; no extra scratch merge), CI=1 --retries=0 --workers=1, own --output per project, throwaway config outside the repo (dependencies emptied; admin-* run together with admin-setup):

  • dev-01 chromium-1440: 653 passed, 0 failed. chromium-390: 1097 passed, 1 failed (below). admin-chromium-1440 23 passed, admin-chromium-390 21, flow 1, passkeys 1, prefs-chromium 7, look-chromium-1440 5, look-chromium-390 5, contrast 10, sidebar-band-chromium 3, throttled-1440 3, throttled-390 5: all passed.
  • dev-02 webkit-1440: 648 passed, 0 failed. webkit-390: 1091 passed, 0 failed. admin-webkit-1440 20, admin-webkit-390 18, prefs-webkit 3, look-webkit-1440 4, look-webkit-390 4, sidebar-band-webkit 3: all passed.
  • Failure: chromium-390 touch-select.spec.ts:246 (far was NaN at line 261). --repeat-each=10 on the same head and project: 10 passed -> not branch-reproducible, so flaky, not a blocker. I did not repeat it on dev: it needs a failure on the branch first. Filed as #1134 (no existing stability issue to add it to).

4. Real Safari (macos-01, 1440, Mac lock held and released, Safari + safaridriver quit) and iPhone Simulator (std, own iPhone 18 Pro iOS 27.0, deleted), light and dark. The server ran on dev-02 from the head, sample notes only, reached through a tunnel as localhost.
Approved mockup compared: review/calendar-2 chrome.html#/note/gym-log and big-table. The mockup ignores ?theme=dark, so it was shot in light only.

  • Wide table (5 columns, 1440): scrolls sideways inside the card, first column stays on the card's left edge (left 659 = cellLeft 659 after scrollLeft 317/317), page does not move. Same on the phone: swipe moves the table, first column pinned with a divider line. OK in light and dark.
  • Long table (50 rows) at 1440: no visible seam at rows 16/32 (row 32 centred shot is continuous). Measured before scrolling, getBoundingClientRect shows a 64 px gap before rows 32 and 48 (rows 1.. are 41-42 px): the rows are probably still estimated-size placeholders then; nothing visible, but worth knowing if the seam code is touched.
  • Header tint: product header is a warm paper tone (color(srgb 0.949 0.926 0.904) light, 0.115 0.110 0.105 dark); the mockup's is a neutral grey (0.928).
  • 3 columns at phone width: all three columns fit on the card in the simulator, light and dark. Playwright chromium/webkit at 390 report 9-13 px of sideways overflow for that table, so it can scroll a hair.

Differences vs the approved mockup: (a) header tint warm vs neutral grey, as above; (b) in the mockup the number columns (Sets/Reps/kg) have a grey tint and the first column is white, in the product all body cells are the same cream, with a hairline after the pinned column; (c) the mockup's wide week table (9 columns) scrolls under a pinned Day column, the product at 1440 shrinks it to fit the card (words wrap, "Warm-/up") so it only scrolls ~7 px; (d) the card is wider in the product's frame (layout, not table).

Open points that need a look (not proven bugs):

  1. iOS Simulator Safari, big-table (5 columns) at 390: on a fresh load (light and dark) the Date column is pinned and the Exercise column is not visible: the header shows Date | "ets" (Sets half-clipped) | Reps | an empty column, so the table looks already scrolled sideways. Playwright chromium and webkit at 390 on the same note read scrollLeft 0 on 3 of 3 loads, so I could not reproduce it there; I could not read the scroll position inside the simulator.
  2. Mac Safari 1440, light, first load of the wide note: scrollLeft was already 239 before I touched it (the shot shows the Programmeringsförklaring column scrolled away); the dark load of the same note and all later loads read 0.

Shots attached below (sample data only). Everything cleaned up: sim deleted, tunnels and the dev-02 server stopped, Safari/safaridriver quit, Mac lock released, build/dist/target scratch removed.

**Final checks, resumed (hd01): #854 now merged with dev 8b00393b0 and pushed as 730a6dd33. All suites green; one flake (not a blocker); Safari/iPhone findings below. Supersedes my earlier comment (which said 1 conflicting hunk in `perf/budgets.json`; it was 3 hunks).** **1. Merge** (orchestrator OK): `git merge --no-ff origin/dev` into a47c26d4a -> e19d3165d, conflicts in `insert.ts` (kept dev's comment), `plugins.ts` (kept both: `EditorView` import + `attach()` AND `insertTable`), `perf/budgets.json` (3 hunks: both sides' notes kept, `chunk.attachments` + dev's lines kept). Then 730a6dd33 sets the budgets to the measured sizes on dev-01 (`perf/web.sh --bundle-only`): first-paint JS 225.318 KiB brotli (+0.73 KiB over dev's 224.59, under 1 KB), CSS 18.48 (budget 22.1); `chunk.index` 225.32, `PictureViewer` 1.222 -> 1.23, total = sum of lines (570.05). Pushed to `port/port-tables-2` (a47c26d4a..730a6dd33). Gates on the merged head (dev-01): `bun run check`: 0 errors (19 warnings, same files as before); web vitest 272/272, editor vitest 663/663; `tables.spec.ts` + `tables-more.spec.ts` chromium-1440: 28 passed, 1 skipped. **2. WebKit tables (dev-02, server binary built from the head)**: `tables.spec.ts` + `tables-more.spec.ts` webkit-1440: 28 passed, 1 skipped. **3. Full suite** on 730a6dd33 (already = branch merged with dev; no extra scratch merge), `CI=1 --retries=0 --workers=1`, own `--output` per project, throwaway config outside the repo (dependencies emptied; admin-* run together with admin-setup): - dev-01 chromium-1440: 653 passed, 0 failed. chromium-390: 1097 passed, 1 failed (below). admin-chromium-1440 23 passed, admin-chromium-390 21, flow 1, passkeys 1, prefs-chromium 7, look-chromium-1440 5, look-chromium-390 5, contrast 10, sidebar-band-chromium 3, throttled-1440 3, throttled-390 5: all passed. - dev-02 webkit-1440: 648 passed, 0 failed. webkit-390: 1091 passed, 0 failed. admin-webkit-1440 20, admin-webkit-390 18, prefs-webkit 3, look-webkit-1440 4, look-webkit-390 4, sidebar-band-webkit 3: all passed. - Failure: chromium-390 `touch-select.spec.ts:246` (`far` was NaN at line 261). `--repeat-each=10` on the same head and project: 10 passed -> not branch-reproducible, so **flaky, not a blocker**. I did not repeat it on dev: it needs a failure on the branch first. Filed as #1134 (no existing stability issue to add it to). **4. Real Safari (macos-01, 1440, Mac lock held and released, Safari + safaridriver quit) and iPhone Simulator (std, own iPhone 18 Pro iOS 27.0, deleted), light and dark.** The server ran on dev-02 from the head, sample notes only, reached through a tunnel as localhost. Approved mockup compared: `review/calendar-2` `chrome.html#/note/gym-log` and `big-table`. The mockup ignores `?theme=dark`, so it was shot in light only. - Wide table (5 columns, 1440): scrolls sideways inside the card, first column stays on the card's left edge (`left` 659 = `cellLeft` 659 after scrollLeft 317/317), page does not move. Same on the phone: swipe moves the table, first column pinned with a divider line. OK in light and dark. - Long table (50 rows) at 1440: no visible seam at rows 16/32 (row 32 centred shot is continuous). Measured before scrolling, `getBoundingClientRect` shows a 64 px gap before rows 32 and 48 (rows 1.. are 41-42 px): the rows are probably still estimated-size placeholders then; nothing visible, but worth knowing if the seam code is touched. - Header tint: product header is a warm paper tone (`color(srgb 0.949 0.926 0.904)` light, `0.115 0.110 0.105` dark); the mockup's is a neutral grey (`0.928`). - 3 columns at phone width: all three columns fit on the card in the simulator, light and dark. Playwright chromium/webkit at 390 report 9-13 px of sideways overflow for that table, so it can scroll a hair. **Differences vs the approved mockup:** (a) header tint warm vs neutral grey, as above; (b) in the mockup the number columns (Sets/Reps/kg) have a grey tint and the first column is white, in the product all body cells are the same cream, with a hairline after the pinned column; (c) the mockup's wide week table (9 columns) scrolls under a pinned Day column, the product at 1440 shrinks it to fit the card (words wrap, "Warm-/up") so it only scrolls ~7 px; (d) the card is wider in the product's frame (layout, not table). **Open points that need a look (not proven bugs):** 1. iOS Simulator Safari, `big-table` (5 columns) at 390: on a fresh load (light and dark) the Date column is pinned and the Exercise column is not visible: the header shows Date | "ets" (Sets half-clipped) | Reps | an empty column, so the table looks already scrolled sideways. Playwright chromium and webkit at 390 on the same note read `scrollLeft` 0 on 3 of 3 loads, so I could not reproduce it there; I could not read the scroll position inside the simulator. 2. Mac Safari 1440, light, first load of the wide note: `scrollLeft` was already 239 before I touched it (the shot shows the Programmeringsförklaring column scrolled away); the dark load of the same note and all later loads read 0. Shots attached below (sample data only). Everything cleaned up: sim deleted, tunnels and the dev-02 server stopped, Safari/safaridriver quit, Mac lock released, build/dist/target scratch removed.
Author
Owner

#854 last fixes: mockup parity, no sideways open, row-group size (head 9d972514a on port/port-tables-2)

Four commits on top of 730a6dd33 (CSS in apps/web/src/styles/tables.css, logic in packages/editor/src/tables/grid.ts, new spec e2e/tables-parity.spec.ts, budgets). Not merged.

1. Mockup parity: computed values, mockup (review/calendar-2 gym-log, Chromium 1440, light) vs product (same fixture text)

value mockup product before product now
card fill (.tw background) transparent solid --tpaper transparent
body cell background transparent (page shows through) transparent over a solid card transparent over the page
first (pinned) column opaque --tpaper (#f7f7f7) opaque paper opaque paper (same)
--tpaper var(--page-tint, var(--paper)) var(--paper) var(--page-tint, var(--paper))
header bg --thead = ink 5 % over --tpaper = color(srgb .9276 .9276 .9276) same formula = (.9488 .9259 .9040) same formula
cell padding / row height 10px 12px / 42 10px 12px / 42 same
non-first column padding in the width maths 26 24 26
last column minimum none (kg = 64 px) 7.5em (112.5 px) none
scroll-snap on the scroller none x proximity + header snap areas none
9-column week table, column widths (px) 156.5 142.5 144 145 64 69 64 64 142.5 squeezed to fit the card (70 77 81 105 64 69 64 64 86 at 1440) 156.5 142.5 144 145 64 69 64 64 142.5 (identical)
week table at 1440 scrolls (card 572, overflow 420), Day pinned fitted, ~7 px scroll scrolls (card 680, overflow 312), Day position: sticky

(a) Header tint: the table's formula is already the mockup's (--thead = ink 5 % of the paper). The warm tone comes from the global paper token: the mockup's default theme "Calternal" sets base #f7f7f7 / ink #262626, the product's packages/ui/src/styles/tokens.css is color-mix(accent 4%, #fffdfa) / #1f1b17. That is a product-wide token, not a table value, so I did NOT recolour the table alone (it would be a grey header on a warm page). Decision for kayg: if the neutral grey is meant for the whole app, it is a token change in tokens.css, not part of this PR.
(b) Number columns tinted in the mockup: the mockup's body cells are transparent over a see-through page, only the first column is opaque; the product had a solid card behind everything. The card fill is gone, cells now behave like the mockup's.
(c) Wide table: wrap-to-fit now only applies to tables of up to 4 columns whose longest words still fit the card (the phone's three columns); everything wider scrolls under the pinned first column. Probe at 1440 / 390: 9 columns scroll in both, 3 columns fit at 390.

2. Opens already scrolled sideways: cause and fix

Reproduced in real Safari (macos-01 Safari, before the fix): t854-wide scrollLeft = 241 / 379 / 379 / 241 on four loads, and in the iPhone Simulator big-table opened with Exercise hidden under the pinned Date column. 241 is the first column's width: Safari settled the freshly opened table on the second column's scroll-snap header and ignored scroll-padding-left: var(--tpin) that should leave room for the pinned column. Fix: the table has no scroll-snap any more (the mockup has none). Plus a safety net in grid.ts: an untouched table (no wheel/touch/pointer on the scroller, no caret scroll) is put back at scrollLeft 0 after every column measure.
After the fix, real Safari 1440 light and dark, 3 loads each of the wide note: scrollLeft 0, 0, 0 / 0, 0, 0; big-table and gym-log 0. iPhone Simulator: big-table shows Date | Exercise (light + dark).
Spec: tables-parity.spec.ts (opens at 0 three loads in a row, no snap points, a person's own scroll is kept when the card is resized). Chromium/WebKit could not reproduce the bug (as in the last report); the spec guards the regression only through the no-snap assertion.
Behaviour change to know about: with no snap, a column can now rest half under the pinned column, as in the mockup (see mac-*-gym-week-scrolled). The old snap was a product addition (not in the mockup) and it is what broke the opening position. If kayg wants the resting-at-the-pin behaviour back it needs another mechanism (e.g. snap only after the first scroll, re-checked in Safari).

3. Row-group placeholder

contain-intrinsic-block-size: auto calc(16 * var(--trow)) with --trow = 1.4em + 21px desktop, max(var(--hit-min), 1.4em + 24px) + 1px on touch (the real row heights, 42 / 63 px when two lines), and the short last group auto calc(<rows> * var(--trow)). Before: 16 x 46 = 736 vs a real group of about 672 (the 64 px gap). Spec an undrawn row group is guessed at its real height: heights of all 4 groups of a 51-row table before and after drawing differ by at most 2 px. Real Safari 1440: big-table 51 rows, all row gaps 0, row heights 41/42 before any scrolling (earlier report: a 64 px gap before rows 32 and 48); shots at rows 16 and 32 below have no seam.

Gates (final head; hosts and commands)

gate command / host result
tables specs chromium-1440, chromium-390 CI=1 CALTERNAL_BIN=<head debug> bunx playwright test e2e/tables.spec.ts e2e/tables-more.spec.ts e2e/tables-parity.spec.ts --project=<p> --workers=1 --retries=0 on dev-01 (x86) 34 passed + 1 skipped / 35 passed
same, webkit-1440, webkit-390 dev-02 (aarch64), binary built from the head 34 passed + 1 skipped / 35 passed
contrast --project=contrast dev-01, head ad8644119 (before the grid-only fit changes; CSS identical afterwards) 10 passed
svelte-check bun run --cwd apps/web check dev-01 0 errors, 19 warnings (same as before)
web vitest bun run --cwd apps/web test 29 files, 272 passed
editor vitest bun run --cwd packages/editor test 58 files, 663 passed
bundle perf/web.sh --bundle-only --gate dev-01 pass. first-paint JS raw identical to 730a6dd33 (793.886 KB); chunk.index brotli 225.318 -> 225.505 (+0.19 KB, hashed lazy-chunk name only; base re-measured today = 225.318). Budgets: index 225.51, total 570.24 (= sum of lines).

Real Safari (macos-01, 1440, Mac lock) and iPhone Simulator (std, own iPhone 18 Pro iOS 27.0, deleted): light + dark

Safari: wide-note scrollLeft 0/0/0 in both themes; gym-log week table scrolled shows Day pinned, the rest sliding under it; 51-row note, no seams at rows 16/32; 3-column note fits at 1440.
Simulator: big-table (Date | Exercise visible), wide, gym-log, three columns (all three columns fit).
Mockup reference (light only, the mockup ignores ?theme=): mock-light-gym-log.png mock-light-gym-week-scrolled.png mock-light-big-row32.png

Safari light: mac-light-wide-0.png mac-light-gym-week-scrolled.png mac-light-big-row32.png mac-light-three.png
Safari dark: mac-dark-wide-0.png mac-dark-gym-week-scrolled.png mac-dark-big-row32.png mac-dark-three.png
Simulator light: sim-light-big-table.png sim-light-t854-wide.png sim-light-gym-log.png sim-light-t854-three.png
Simulator dark: sim-dark-big-table.png sim-dark-t854-wide.png sim-dark-gym-log.png sim-dark-t854-three.png

Typing path (cell + long note, ABAB x3 with control)

Setup: perf-01 under ~/bin/perf-turn tpar-854-parity (waited behind sound-comparator and nf3oh), perf-02's lock held by an hd01 watcher only while the turn ran (taken 22:55, released 23:07 IST 14 Nov), 4x CPU, 10k-note fixture, a fresh copy of my own fixture home per run, release server built from this head's crates (sha256 1a3a2d92… identical on dev-01, hd01 and perf-01), harness = this branch's typing.perf.ts -g "50,000-word note|inside a table cell". Arms: pre = 730a6dd33 dist, new = dist built at ab1664cb4 (see note), order pre new pre new / new pre new pre / pre new pre new, 12/12 runs passed. The control is pre vs pre (6 runs of the same dist) because dev has no tables.
Per run p50 / p95 (ms) and main-thread CPU per key:

run arm   long_note     cpu   table_cell      cpu   table_cell_commit
 1  pre   69.1/125.2   41.6    98.6/160.5    32.7   121.2/161.3
 2  new   71.0/161.2   44.0   146.9/230.9    34.0   147.8/230.9
 3  pre   74.0/134.6   45.6    89.2/161.0    31.9    99.8/165.5
 4  new   40.6/74.5    41.1   141.3/159.2    33.6   142.4/164.1
 5  new   69.4/139.9   44.8    85.3/159.2    32.3    88.6/161.6
 6  pre   72.1/126.9   44.1   129.8/161.6    34.4   143.8/169.7
 7  new   46.2/73.5    42.3    81.7/224.9    30.9    81.7/226.4
 8  pre   72.4/149.6   41.4    91.0/162.5    32.8    93.5/163.6
 9  pre   73.2/130.3   43.1    99.5/160.3    33.5   108.2/162.6
10  new   56.3/122.6   47.3   138.4/447.5    30.6   139.2/447.5
11  pre   72.1/148.1   43.2    86.5/222.6    32.1    97.4/223.5
12  new   67.1/129.0   43.6    88.1/240.7    34.9   116.4/240.8
median of runs:  long_note p50 pre 72.2 / new 61.7;  cpu pre 43.1 / new 43.8 (ms/key)
                 table_cell p50 pre 94.8 (86.5-129.8) / new 113.2 (81.7-146.9);  cpu pre 32.7 / new 33.0

Reading: CPU per key is flat (table cell 32.7 vs 33.0, long note 43.1 vs 43.8, both inside each arm's own spread of about 3 ms). The wall-clock table-cell p50 is bimodal in both arms (about 85-100 and about 130-147) and follows the position in the session, not the arm: new minus pre in adjacent pairs is +48, +52, -45, -9, +39, +2 (no consistent sign), and the pre arm alone spans 86.5-129.8. I do not read a regression or an improvement out of it. What changed in the typing path is only the size guess of undrawn row groups (CSS) and, at this head, a fit() rule that does not run on keys.
Note: the new dist was built at ab1664cb4 (all of items 1-3 except the last fit rule "only tables of up to four columns wrap to fit", which is in fit() and does not run per key). Raw per-run files: ~/tpar1114/out on perf-01 (removed after this comment), summaries above.

Decisions and risks

  • No scroll-snap (see 2) and no 7.5em last-column minimum: both removed to match the mockup; both were product additions. Flagging because of the 14 Nov "never drop a feature" rule: the first was the cause of the opening-position bug; the second only decided the width of the last column.
  • Header tint warm vs grey is the global paper token (see 1a), left to kayg.
  • The 4-column gym table at 390 scrolls in the Simulator (kg off the edge), as in the mockup (it overflows 72 px there).
## #854 last fixes: mockup parity, no sideways open, row-group size (head `9d972514a` on `port/port-tables-2`) Four commits on top of 730a6dd33 (CSS in `apps/web/src/styles/tables.css`, logic in `packages/editor/src/tables/grid.ts`, new spec `e2e/tables-parity.spec.ts`, budgets). Not merged. ### 1. Mockup parity: computed values, mockup (`review/calendar-2` gym-log, Chromium 1440, light) vs product (same fixture text) | value | mockup | product before | product now | |---|---|---|---| | card fill (`.tw` background) | transparent | solid `--tpaper` | **transparent** | | body cell background | transparent (page shows through) | transparent over a solid card | **transparent over the page** | | first (pinned) column | opaque `--tpaper` (#f7f7f7) | opaque paper | opaque paper (same) | | `--tpaper` | `var(--page-tint, var(--paper))` | `var(--paper)` | **`var(--page-tint, var(--paper))`** | | header bg | `--thead` = ink 5 % over `--tpaper` = `color(srgb .9276 .9276 .9276)` | same formula = `(.9488 .9259 .9040)` | same formula | | cell padding / row height | 10px 12px / 42 | 10px 12px / 42 | same | | non-first column padding in the width maths | 26 | 24 | **26** | | last column minimum | none (kg = 64 px) | 7.5em (112.5 px) | **none** | | scroll-snap on the scroller | none | `x proximity` + header snap areas | **none** | | 9-column week table, column widths (px) | 156.5 142.5 144 145 64 69 64 64 142.5 | squeezed to fit the card (70 77 81 105 64 69 64 64 86 at 1440) | **156.5 142.5 144 145 64 69 64 64 142.5 (identical)** | | week table at 1440 | scrolls (card 572, overflow 420), Day pinned | fitted, ~7 px scroll | **scrolls (card 680, overflow 312), Day `position: sticky`** | (a) **Header tint:** the table's formula is already the mockup's (`--thead` = ink 5 % of the paper). The warm tone comes from the global paper token: the mockup's default theme "Calternal" sets base `#f7f7f7` / ink `#262626`, the product's `packages/ui/src/styles/tokens.css` is `color-mix(accent 4%, #fffdfa)` / `#1f1b17`. That is a product-wide token, not a table value, so I did NOT recolour the table alone (it would be a grey header on a warm page). **Decision for kayg:** if the neutral grey is meant for the whole app, it is a token change in `tokens.css`, not part of this PR. (b) **Number columns tinted in the mockup:** the mockup's body cells are transparent over a see-through page, only the first column is opaque; the product had a solid card behind everything. The card fill is gone, cells now behave like the mockup's. (c) **Wide table:** wrap-to-fit now only applies to tables of **up to 4 columns** whose longest words still fit the card (the phone's three columns); everything wider scrolls under the pinned first column. Probe at 1440 / 390: 9 columns scroll in both, 3 columns fit at 390. ### 2. Opens already scrolled sideways: cause and fix Reproduced in real Safari (macos-01 Safari, before the fix): `t854-wide` `scrollLeft` = 241 / 379 / 379 / 241 on four loads, and in the iPhone Simulator `big-table` opened with Exercise hidden under the pinned Date column. 241 is the first column's width: Safari settled the freshly opened table on the second column's scroll-snap header and ignored `scroll-padding-left: var(--tpin)` that should leave room for the pinned column. **Fix: the table has no scroll-snap any more (the mockup has none).** Plus a safety net in `grid.ts`: an untouched table (no wheel/touch/pointer on the scroller, no caret scroll) is put back at `scrollLeft 0` after every column measure. After the fix, real Safari 1440 light and dark, 3 loads each of the wide note: `scrollLeft` 0, 0, 0 / 0, 0, 0; `big-table` and gym-log 0. iPhone Simulator: big-table shows Date | Exercise (light + dark). Spec: `tables-parity.spec.ts` (opens at 0 three loads in a row, no snap points, a person's own scroll is kept when the card is resized). Chromium/WebKit could not reproduce the bug (as in the last report); the spec guards the regression only through the no-snap assertion. **Behaviour change to know about:** with no snap, a column can now rest half under the pinned column, as in the mockup (see `mac-*-gym-week-scrolled`). The old snap was a product addition (not in the mockup) and it is what broke the opening position. If kayg wants the resting-at-the-pin behaviour back it needs another mechanism (e.g. snap only after the first scroll, re-checked in Safari). ### 3. Row-group placeholder `contain-intrinsic-block-size: auto calc(16 * var(--trow))` with `--trow` = `1.4em + 21px` desktop, `max(var(--hit-min), 1.4em + 24px) + 1px` on touch (the real row heights, 42 / 63 px when two lines), and the short last group `auto calc(<rows> * var(--trow))`. Before: 16 x 46 = 736 vs a real group of about 672 (the 64 px gap). Spec `an undrawn row group is guessed at its real height`: heights of all 4 groups of a 51-row table before and after drawing differ by at most 2 px. Real Safari 1440: `big-table` 51 rows, all row gaps 0, row heights 41/42 before any scrolling (earlier report: a 64 px gap before rows 32 and 48); shots at rows 16 and 32 below have no seam. ### Gates (final head; hosts and commands) | gate | command / host | result | |---|---|---| | tables specs chromium-1440, chromium-390 | `CI=1 CALTERNAL_BIN=<head debug> bunx playwright test e2e/tables.spec.ts e2e/tables-more.spec.ts e2e/tables-parity.spec.ts --project=<p> --workers=1 --retries=0` on dev-01 (x86) | 34 passed + 1 skipped / 35 passed | | same, webkit-1440, webkit-390 | dev-02 (aarch64), binary built from the head | 34 passed + 1 skipped / 35 passed | | contrast | `--project=contrast` dev-01, head ad8644119 (before the grid-only fit changes; CSS identical afterwards) | 10 passed | | svelte-check | `bun run --cwd apps/web check` dev-01 | 0 errors, 19 warnings (same as before) | | web vitest | `bun run --cwd apps/web test` | 29 files, 272 passed | | editor vitest | `bun run --cwd packages/editor test` | 58 files, 663 passed | | bundle | `perf/web.sh --bundle-only --gate` dev-01 | pass. first-paint JS raw identical to 730a6dd33 (793.886 KB); `chunk.index` brotli 225.318 -> 225.505 (+0.19 KB, hashed lazy-chunk name only; base re-measured today = 225.318). Budgets: index 225.51, total 570.24 (= sum of lines). | ### Real Safari (macos-01, 1440, Mac lock) and iPhone Simulator (std, own iPhone 18 Pro iOS 27.0, deleted): light + dark Safari: wide-note `scrollLeft` 0/0/0 in both themes; gym-log week table scrolled shows Day pinned, the rest sliding under it; 51-row note, no seams at rows 16/32; 3-column note fits at 1440. Simulator: big-table (Date | Exercise visible), wide, gym-log, three columns (all three columns fit). Mockup reference (light only, the mockup ignores `?theme=`): ![mock-light-gym-log.png](https://git.kayg.org/attachments/f51c7b1f-db8e-42b0-9857-b708587f92e2) ![mock-light-gym-week-scrolled.png](https://git.kayg.org/attachments/c0568812-5cda-4753-830c-57ff31f08b23) ![mock-light-big-row32.png](https://git.kayg.org/attachments/78ea133e-2e12-4513-b6f7-f55c05c0f0e6) Safari light: ![mac-light-wide-0.png](https://git.kayg.org/attachments/1770b784-8a57-4324-8b01-794944f7bcec) ![mac-light-gym-week-scrolled.png](https://git.kayg.org/attachments/58c73687-af09-44c7-84b7-f7175bdf98d9) ![mac-light-big-row32.png](https://git.kayg.org/attachments/353fccba-769c-49d0-95fd-3777d03e0451) ![mac-light-three.png](https://git.kayg.org/attachments/d659e21b-3694-4057-b4d7-5c3741623c49) Safari dark: ![mac-dark-wide-0.png](https://git.kayg.org/attachments/c6dfb56a-65d0-4f6b-b054-8e77a20d6e77) ![mac-dark-gym-week-scrolled.png](https://git.kayg.org/attachments/217cf46c-84ad-4bdd-aa84-2fb1afc3495b) ![mac-dark-big-row32.png](https://git.kayg.org/attachments/2b915e6c-f6aa-4258-8900-25d5b90f04e6) ![mac-dark-three.png](https://git.kayg.org/attachments/800c76ca-a60b-42c0-98c1-453e4cf3afcc) Simulator light: ![sim-light-big-table.png](https://git.kayg.org/attachments/d9b546b2-7dc5-4601-83a4-d57de1547f66) ![sim-light-t854-wide.png](https://git.kayg.org/attachments/4db8983c-b3ae-4649-b53b-f2d2c5579593) ![sim-light-gym-log.png](https://git.kayg.org/attachments/5cb08b1e-a04e-4dd2-8419-408adbf2fced) ![sim-light-t854-three.png](https://git.kayg.org/attachments/ffc7af20-2ee8-4b69-b93d-a342d38eaf52) Simulator dark: ![sim-dark-big-table.png](https://git.kayg.org/attachments/ed253d6f-9d22-488a-86f2-fddc979fece5) ![sim-dark-t854-wide.png](https://git.kayg.org/attachments/d4b64c2c-b3ce-4dfe-9094-1829bb8471eb) ![sim-dark-gym-log.png](https://git.kayg.org/attachments/24fb14c2-906c-4c29-b29f-edca4f31e58d) ![sim-dark-t854-three.png](https://git.kayg.org/attachments/550ae839-6ba0-4dac-9826-82ad5fc9c251) ### Typing path (cell + long note, ABAB x3 with control) Setup: perf-01 under `~/bin/perf-turn tpar-854-parity` (waited behind sound-comparator and nf3oh), perf-02's lock held by an hd01 watcher only while the turn ran (taken 22:55, released 23:07 IST 14 Nov), 4x CPU, 10k-note fixture, a fresh copy of my own fixture home per run, release server built from this head's crates (sha256 `1a3a2d92…` identical on dev-01, hd01 and perf-01), harness = this branch's `typing.perf.ts` `-g "50,000-word note|inside a table cell"`. Arms: `pre` = 730a6dd33 dist, `new` = dist built at ab1664cb4 (see note), order `pre new pre new / new pre new pre / pre new pre new`, 12/12 runs passed. The control is pre vs pre (6 runs of the same dist) because dev has no tables. Per run p50 / p95 (ms) and main-thread CPU per key: ``` run arm long_note cpu table_cell cpu table_cell_commit 1 pre 69.1/125.2 41.6 98.6/160.5 32.7 121.2/161.3 2 new 71.0/161.2 44.0 146.9/230.9 34.0 147.8/230.9 3 pre 74.0/134.6 45.6 89.2/161.0 31.9 99.8/165.5 4 new 40.6/74.5 41.1 141.3/159.2 33.6 142.4/164.1 5 new 69.4/139.9 44.8 85.3/159.2 32.3 88.6/161.6 6 pre 72.1/126.9 44.1 129.8/161.6 34.4 143.8/169.7 7 new 46.2/73.5 42.3 81.7/224.9 30.9 81.7/226.4 8 pre 72.4/149.6 41.4 91.0/162.5 32.8 93.5/163.6 9 pre 73.2/130.3 43.1 99.5/160.3 33.5 108.2/162.6 10 new 56.3/122.6 47.3 138.4/447.5 30.6 139.2/447.5 11 pre 72.1/148.1 43.2 86.5/222.6 32.1 97.4/223.5 12 new 67.1/129.0 43.6 88.1/240.7 34.9 116.4/240.8 median of runs: long_note p50 pre 72.2 / new 61.7; cpu pre 43.1 / new 43.8 (ms/key) table_cell p50 pre 94.8 (86.5-129.8) / new 113.2 (81.7-146.9); cpu pre 32.7 / new 33.0 ``` Reading: **CPU per key is flat** (table cell 32.7 vs 33.0, long note 43.1 vs 43.8, both inside each arm's own spread of about 3 ms). The wall-clock table-cell p50 is bimodal in both arms (about 85-100 and about 130-147) and follows the position in the session, not the arm: new minus pre in adjacent pairs is +48, +52, -45, -9, +39, +2 (no consistent sign), and the pre arm alone spans 86.5-129.8. I do not read a regression or an improvement out of it. What changed in the typing path is only the size guess of undrawn row groups (CSS) and, at this head, a `fit()` rule that does not run on keys. Note: the `new` dist was built at ab1664cb4 (all of items 1-3 except the last fit rule "only tables of up to four columns wrap to fit", which is in `fit()` and does not run per key). Raw per-run files: `~/tpar1114/out` on perf-01 (removed after this comment), summaries above. ### Decisions and risks - No scroll-snap (see 2) and no 7.5em last-column minimum: both removed to match the mockup; both were product additions. Flagging because of the 14 Nov "never drop a feature" rule: the first was the cause of the opening-position bug; the second only decided the width of the last column. - Header tint warm vs grey is the global paper token (see 1a), left to kayg. - The 4-column gym table at 390 scrolls in the Simulator (kg off the edge), as in the mockup (it overflows 72 px there).
Author
Owner

Merged into dev with --no-ff at 44fc0b7c4 by the orchestrator (stack #845 ⊂ #854), after reviewing the Safari/iPhone shots in comment 96550. Scroll-snap and the 7.5em last-column minimum were port-only additions (dev had no tables), so removing them to match the mockup is not a dropped feature. Closing.

Merged into `dev` with `--no-ff` at `44fc0b7c4` by the orchestrator (stack #845 ⊂ #854), after reviewing the Safari/iPhone shots in comment 96550. Scroll-snap and the 7.5em last-column minimum were port-only additions (dev had no tables), so removing them to match the mockup is not a dropped feature. Closing.
kayg closed this pull request 2026-11-14 17:38:56 +00:00
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!854
No description provided.