Skip to content

Report a drawing's height where it differs from the box shown before it drew - #5571

Merged
max-sixty merged 3 commits into
mainfrom
agent-ac412712ea42ce550
Nov 5, 2026
Merged

max-sixty merged 3 commits into
mainfrom
agent-ac412712ea42ce550

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

page-layout.md has said since #3984 that page check --render suggests a drawing's height wherever it differs from what was reserved, and no check did. A fresh agent writing an eval report gave its lf-diagram no data-height. The check printed only startup layout-shift evidence, whose after box was all zeros, so the agent found the 937px height with leaf-dev probe.

The render check now gives drawn-height advice for every drawn element whose tag declares x-height. It fires when the drawing is taller or shorter than the box the element showed before it drew. On that report's page, copied with the diagram's data-height varied:

data-height Advice
none <lf-diagram id=campaign-flow> was 314px tall before drawing and its drawing is 937px tall, so what follows it moved down 623px as it drew; data-height="937" holds the drawing's height from first paint
600 … was 600px tall before drawing and its drawing is 937px tall, so what follows it moved down 337px as it drew; …
1200 … was 1200px tall before drawing and its drawing is 937px tall, leaving 263px blank under the drawing; …
937 nothing

The shift evidence couldn't carry the height. The Layout Instability API clips each source's box to the window, and that diagram's drawn box sits below the window inside the workspace's tab scroller, so it came back as zeros. A shift-based check also can't see a stated height that is too large, since that moves nothing. So the reading comes from the element's own box:

  • The probe driver records the first box each such element shows before it is marked lf-rendered, with a ResizeObserver started as the page parses, so nothing holds startup.
  • After the page settles, drawnHeights measures the drawing with data-lf-height lifted for one synchronous read, since the diagram's CSS keeps a larger stated height after drawing.
  • Elements hidden at check time, or never marked drawn, such as a file tree held at its stated height, are left out. It is read in the light scheme at the desktop and phone windows, so a drawing whose height depends on the width gets a finding at each.

On the shipped examples it fires only on pr-walkthrough, and both firings are real. pr-key-hunk, an inline diff, shows its patch as 508px of source text before it draws and is 473px drawn, at both windows. lf-pr-brief states 1037px and draws 1041px on desktop and 1204px on the phone. security-boundary, alert-review, heat-loss and live-progress get nothing.

An inline diff shows its source text until it draws, and #4724 accepted the resize that follows, so packages/diff/instructions/author.md says to leave data-height off inline patches. The advice gives a height there too. Whether inline patches should take one is a separate decision.

page-layout.md and evals/README.md now say what the check reports, and page-layout.md no longer says lf-diff sizes a textual patch from its inline content, which it hasn't since #4724. test_a_drawing_reports_its_height_where_its_first_box_differed covers no height, too small, too large, a match and an authored body that already takes the drawing's height. It fails with the reservation lift removed and with the stated height read in place of the recorded box. The startup shift, diagram reservation and widget-quality render tests, the browser type check and build/registry.test.mjs pass.

This was written by Claude Code on behalf of max-sixty

…it drew

`page check --render` now gives `drawn-height` advice for each drawn element
whose tag declares `x-height` and whose drawing is taller or shorter than the
box it first showed. The advice names both heights, says whether what follows
moved as it drew or whether a stated height larger than the drawing left blank
room, and gives the `data-height` that matches the drawing. A matching
`data-height`, a chart that draws at its reserved height, and an inline diff
whose counted rows already take its height get no advice.
`page-layout.md` promised this since #3984 and the check never did it: an eval
report's `lf-diagram` with no `data-height` got only startup CLS evidence whose
`after` box was all zeros, and the agent found the 937px height with
`leaf-dev probe`.

The zeros are the Layout Instability API clipping each source's rect to the
window. That report's diagram sits about 1015px down inside the workspace's
`lf-tabs` scroller, below a 720px window, so its drawn box is outside the view;
in a 2400px window the same shift reports `after` as the drawn box. So the
reading comes from the element's own box instead. The probe driver records the
first box each element painted with x-height's `data-lf-height` shows before
it is marked `lf-rendered`, by a ResizeObserver started as the page parses, so
nothing holds the page's startup. `drawnHeights` then reads the drawing with
that paint lifted for one read, since the diagram's CSS keeps a larger stated
height after drawing. Elements hidden now, or never marked drawn (a file tree
held at its stated height), are left out. It is read in the light scheme at the
desktop and phone windows, so a drawing whose height depends on width gets a
finding for each.

On the shipped examples it fires on `pr-walkthrough` only: `pr-key-hunk`'s
counted reservation is 508px against a 473px drawing at both windows, and
`lf-pr-brief`'s 1037px `data-height` against 1041px on desktop and 1204px on the
phone. `security-boundary`, `alert-review`, `heat-loss` and `live-progress`
(two diagrams, seven charts, a source diff in a closed disclosure) get none.
leaf-agent
leaf-agent previously approved these changes Nov 5, 2026
lf-diff has drawn no counted reservation for an inline patch since #4724, which accepted the resize as the drawing replaces the source text. page-layout.md still said it sized textual patches from their inline content, and the drawn-height test named its authored-body case after counted rows.
@max-sixty
max-sixty merged commit 8149b83 into main Nov 5, 2026
5 checks passed
@max-sixty
max-sixty deleted the agent-ac412712ea42ce550 branch November 5, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants