Repository navigation
Let the data-structures reference read on a phone, and check it in 46 s, not 380 s - #5769
Merged
Merged
Conversation
… s, not 380 s The site's data-structures page had two faults on main, both reproduced on this machine with `bin/leaf page check --render` on a page directory prepared from `docs/data-structures.html` the way the site build prepares it. Squeezed tables. The render check gave 31 `squeezed-table` advice findings at 360-600px, and a look at 390px in Chromium and Firefox showed a real defect, not a false positive: each description stood one word per line, cut off at the column's edge, and the table scrolled sideways for the rest. The cause is the page's own composition. Four columns (Field, Type, Required, Description) cannot fit a phone's column at their narrowest, so the description, the one column that can shrink, shrank to a word. The theme and the check behave as designed: the theme wraps a table and then scrolls it, and the check's advice leaves the remedy to the author. So the fix is in the page and its generator: - Below 36rem, the page's own CSS stacks each row: name, type and Required flag on one line, the description across the full width under them. The table becomes one grid with a subgrid per row, so the three short columns still line up, and Chromium, Firefox and WebKit all keep the table, row, columnheader and cell roles (checked with Playwright's ARIA snapshot). - `leaf_dev.docs` labels a reference to a definition's field as `Activity's <code>kind</code>`, the way it already labels an event kind's field, instead of the raw pointer `Activity/properties/kind`. The pointer is one word to the line breaker, so it held served-state's type column at 255px even on a desktop. - The existing rule that keeps a field name whole now covers type names too, in table layout only; stacked, names and types break where they must. After the change no table scrolls sideways at any width from 360 to 1000px in Chromium, Firefox or WebKit, and the check gives no `squeezed-table` finding. At 1280px, 17 of 93 tables change column widths a little, and type names broken mid-word at 1280px drop from 7 to 2 in Chromium and from 15 to 2 in Firefox. Slow render check. Timing each gate phase on the unchanged page showed that 357 of the 380 s went to `geometryReading`, 6 to 7 s per width at desktop widths. A CPU profile of the desktop sweep put about 265 s in `coveredWords` and the `closest` and `contains` calls it makes for each pair of painted text runs it compares, and it compared every pair. That is the square-of-the-page growth root AGENTS.md, "Responsiveness", rules out, paid at each of the sweep's 41 widths. Two runs can cover each other only if their boxes overlap in height, so the reading now goes down the page and compares each run only with the earlier runs whose boxes reach below its top, which on a page of text are the other runs on its line. Candidate pairs are sorted back into document order before the existing checks run, so the findings are the same, in the same order. Measured on this machine, same page directory: - render_version on data-structures, with a CPU profile recording the desktop sweep in both runs, at a load of 7-13: 379.5 s before, 38.5 s after. `geometryReading` per desktop width: about 6.8 s before, 0.25 s after. - `leaf page check --render`, end to end: 377 s before (starting at a load of 41), 46 s after (load about 15), with identical findings JSON. - Controls index, event-log and how-it-works: identical findings on the base and on this change (11.1/20.4/16.6 s before, 11.9/15.3/16.4 s after). Tests: `test_the_covered_words_reading_grows_with_the_page` counts the `contains` calls the reading makes on a 61-paragraph page: 14,642 before, fewer than one per paragraph after, while a cover between the page's first and last paragraphs is still reported. The new `tests/browser/test_site.py` serves the data-structures source and checks that no table scrolls or squeezes at 360, 390, 600 and 640px. It fails on the base page, where 47 tables scroll sideways at 360px. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ading by its findings Review fixes for the previous commit: - The phone-table case moves to `journeys/test_site.py`, the site's module, as subtests at 640, 600 and 360px on the published build's `/data-structures/`. In `browser/` it ran 71.5 s on CI against the tier's 8 s budget, and its trailing `page.close()` broke the rule that the `browser` fixture closes what it lends. The call itself takes about 2 s once the module has built the site. On main's page, the 600px and 360px subtests fail. - The covered-words test drops its count of `Node.prototype.contains` calls. An every-pair loop that checks geometry before `contains` stays quadratic and passed it, and patching a prototype is what tests/AGENTS.md rules out. It keeps, under a new name, its assertion that a cover between the page's first and last paragraphs is reported, which nothing on main exercised. - The stacked-table comment no longer says how 45% was chosen. Of 40%, 45%, 50% and equal halves for the names' column, 45% split the fewest names and types mid-word at 360px and 390px (15 and 30 of 985 rows). Co-Authored-By: Claude Opus 5.5 <[email protected]>
max-sixty
marked this pull request as ready for review
November 9, 2026 10:51
leaf-agent
approved these changes
Nov 9, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 10, 2026
…5747, squeezedBoxes (#5786) `test_the_data_structures_tables_read_on_a_phone` calls a render-check probe that no longer exists, so all three of its widths fail. This renames the call to the probe's current name. #5769 added the test with `evaluate_probe(page, "squeezedTables")`. #5747 landed after it and renamed that probe in `src/leaf/render-checks/layout.js` to `squeezedBoxes`, which now reports a code block squeezed too narrow to read as well as a table. #5747 updated every caller that existed when it was written, but not this new one. The driver throws `unknown Leaf browser probe squeezedTables` for a name it doesn't know (`src/leaf/render-checks/driver.js`). `tests/journeys` runs only on schedule, so neither pull request's CI ran the test. The test now keeps both pull requests' intent. The data-structures reference must read on a phone, and with the wider probe that also covers its code blocks. **Verified locally:** the test fails at 640, 600 and 360 px on `main` and passes with the change. Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 14, 2026
`page check --render` now refuses a page with `under-panel` when a word stays under the floating panel's row however far the page scrolls. Leaf keeps the panel's room as body's bottom padding (`--lf-foot-room`), and a page could lose it with no check saying so: a reset that zeroes body's padding, a body held to the window's height that its content runs past, a `main` or `body` that scrolls itself, or a fixed bar at the window's foot. Until now the covered-words reading compared the page's words only with each other. No CSS keeps the room against all of those, since the page can end its content past any box Leaf pads, and an `!important` padding would override spacing the author set on body. So the gate reads the outcome. `paintedRuns` gives each run a second box, where it would stand with every scroller at its end, by lifting the run by the scroll each scroller above it has left, so the reading scrolls nothing. `coveredWords` reports a run whose end box overlaps a box the panel covers (`coverBoxes`, now exported through `check-api.js`). The examples' render suite now holds Leaf's own Layouts to the room too. What the diff doesn't show: words in a bar the page sticks to the window's foot go unreported, since the reading lifts that bar from where it sticks (the header says so). The commit was written on 2026-11-03 against `windowChromeBoxes`, which #5361 replaced. It now reads `coverBoxes()`, which the gate takes before it opens a thread, when the panel's box is its row, and runs beside the covered-words sweep #5769 added. Evidence: when written, it fired on none of 198 real pages the markup check accepts, the 45-page example corpus or the plain pages, agreeing with an independent reading that scrolls each scroller to its end, and it fired on each of seven hand-made pages that lose the room, at the desktop and phone windows. On this branch it fires on none of the 48 authored pages at 1280, 540 or 360px, and the full gate refuses a page that zeroes body's padding at every width from 360 to 1920px. Max asked for this during a stale-work sweep; a subagent had committed it locally and never opened a PR. Tests: `test_words_the_panel_covers_at_the_page_s_end_are_reported` (room kept, reset, `main` scrolls, `body` scrolls) and the covered-words and `paintedWords` neighbours pass, as do `pnpm run check:browser` and pre-commit. CI's `test` job fails one test, inherited from main: `test_every_skill_file_reads_in_one_command` finds `.claude/skills/developing-leaf/SKILL.md` at 30,189 bytes since #5820; this branch leaves that file alone, and #5967 shrinks it. > _This was written by Claude Code on behalf of max-sixty_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The site's data-structures page had two faults on main, both reproduced on
this machine with
bin/leaf page check --renderon a page directoryprepared from
docs/data-structures.htmlthe way the site build prepares it.Squeezed tables. The render check gave 31
squeezed-tableadvice findings at360-600px, and a look at 390px in Chromium and Firefox showed a real defect,
not a false positive: each description stood one word per line, cut off at
the column's edge, and the table scrolled sideways for the rest. The cause is
the page's own composition. Four columns (Field, Type, Required, Description)
cannot fit a phone's column at their narrowest, so the description, the one
column that can shrink, shrank to a word. The theme and the check behave as
designed: the theme wraps a table and then scrolls it, and the check's advice
leaves the remedy to the author. So the fix is in the page and its generator:
flag on one line, the description across the full width under them. The
table becomes one grid with a subgrid per row, so the three short columns
still line up. An independent review read each engine's own accessibility
tree: Chromium's, through CDP, has the same table, row, columnheader and
cell counts on main and on this change, and Firefox 159's computed roles
keep all four on the stacked table. WebKit's is unverified.
leaf_dev.docslabels a reference to a definition's field asActivity's <code>kind</code>, the way it already labels an event kind'sfield, instead of the raw pointer
Activity/properties/kind. The pointeris one word to the line breaker, so it held served-state's type column at
255px even on a desktop.
in table layout only; stacked, names and types break where they must.
After the change no table scrolls sideways at any width from 360 to 1000px
in Chromium, Firefox or WebKit, and the check gives no
squeezed-tablefinding. At 1280px, 17 of 93 tables change column widths a little, and type names
broken mid-word at 1280px drop from 7 to 2 in Chromium and from 15 to 2 in
Firefox.
Slow render check. Timing each gate phase on the unchanged page showed that
357 of the 380 s went to
geometryReading, 6 to 7 s per width at desktopwidths. A CPU profile of the desktop sweep put about 265 s in
coveredWordsand the
closestandcontainscalls it makes for each pair of painted textruns it compares, and it compared every pair. That is the square-of-the-page
growth root AGENTS.md, "Responsiveness", rules out, paid at each of the
sweep's 41 widths. Two runs can cover each other only if their boxes overlap
in height, so the reading now goes down the page and compares each run only
with the earlier runs whose boxes reach below its top, which on a page of
text are the other runs on its line. Candidate pairs are sorted
back into document order before the existing checks run, so the findings
are the same, in the same order.
Measured on this machine, same page directory:
desktop sweep in both runs, at a load of 7-13: 379.5 s before, 38.5 s after.
geometryReadingper desktop width: about 6.8 s before, 0.25 s after.leaf page check --render, end to end: 377 s before (starting at a loadof 41), 46 s after (load about 15), with identical findings JSON.
and on this change (11.1/20.4/16.6 s before, 11.9/15.3/16.4 s after).
Tests:
test_the_covered_words_gate_reads_a_cover_between_the_first_and_last_wordslifts a page's last paragraph over its first and checks the cover is
reported, a pair the sweep has to reach although the document holds them far
apart. No test asserts the growth itself; the independent review measured
the reading at 15, 29 and 57 ms as the page doubles, against main's 319,
1,230 and 4,992 ms.
journeys/test_site.py::test_the_data_structures_tables_read_on_a_phoneloads the published build's
/data-structures/and checks, as subtests at640, 600 and 360px, that no table scrolls sideways or squeezes; on main's
page the 600px and 360px subtests fail.
Calls Max may reverse:
36rem, which is a viewport under about 624px). Above it the four-column
table stands as before; at 640px its narrowest description is 152px.
halves, 45% split the fewest names and types mid-word at 360 and 390px
(15 and 30 of 985 rows).
Not verified: Safari on a real phone (WebKit's layout was checked through
Playwright only), and WebKit's accessibility tree.