You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Every content edit to an lf-diagram or lf-diff needs a hand-copied data-height and another check run #3174
Use. An agent building a page unattended, with an lf-diagram and several lf-diffs, edits their content as the page develops.
What happened. These widgets reserve no height before they draw (page-layout.md). After each content change, page check --render reported unreserved-height advice naming the drawn height, and the agent copied each number into data-height and ran the check again. One page took three of these edit-and-check rounds, and any later content edit starts another.
Cost. The check already has the right number, so the agent's step is a transcription plus a second render. An agent that skips the advice ships a page whose content jumps as each widget draws.
Proposed shape. Have Leaf set the reservation instead of the author. Either page check --render (or page stamp) writes the measured data-height into the source, or Leaf records the measurement with the revision so the widget reserves it without an authored attribute. An authored data-height still wins.
Seen on leaf 28c8d33, installed 2026-10-19T07:54:45-07:00.
This was written by Claude Code on behalf of max-sixty
The render check already measures the settled widget box and reports its difference from first paint; delivery reserves height from the widget declaration or an authored data-height. The repeat-edit case needs Leaf to distinguish a measured reservation from an authored one. If a check simply inserts data-height, the next content edit leaves no way to tell whether that value should be refreshed or preserved as the author’s override.
The clean direction is a measured value tied to the candidate revision and applied by delivery only when the author has not set data-height. That keeps the author’s override and lets a new measurement replace an old one after an edit. It also means deciding when a browser measurement becomes part of a revision, since page stamp currently validates source without rendering. I did not open a PR: a source-only rewrite would recreate the reported loop after the next edit, while revision-scoped measurement crosses the render check, revision capture, and delivery contracts.
Reopening for lf-diagram, which #3984's Closes swept up but didn't fix. #3984 settled lf-diff: an inline-patch diff now first-paints at its drawn height through a 1.4 KB counting script, and authors no longer write data-height for it.
lf-diagram still needs a hand-copied data-height, and quick pages, which skip --render, still shift when one draws. A count can't help there, because the height comes from Pele's layout. The direction from triage: a diagram's drawn height is a pure function of its source text, since it renders with responsive: false and isn't width-dependent. So the render check can record each diagram's measured height keyed by a digest of its source, and delivery can apply it wherever no data-height is authored. An edit changes the digest, so an old height stops applying.
This was written by Claude Code on behalf of max-sixty
The source-only cache key needs one correction: responsive: false removes width dependence, but the height also depends on font metrics. Leaf passes the page’s --sans and --mono into Pele. In Chrome, the identical source below rendered at 301px with sans-serif and 245px with monospace, with responsive: false in both calls. A circular node makes text width affect height.
A reusable measured reservation therefore needs to be scoped to its renderer and font environment as well as its source; an authored data-height can still take precedence. There is also a cold-cache limit: recording heights only during --render removes the transcription step after that check, but cannot reserve a new or edited diagram on a quick page that has never measured that source. That case remains part of this issue rather than being closed by the cache alone.
Reproduce the font-dependent height
Run this expression with leaf-dev probe security-boundary --js in this checkout. It calls the page’s vendored Pele renderer with the widget’s sizing options:
Observed heights: 301, 245, 301. No code change or PR from this run; this establishes a missing cache dependency before implementing the proposed reservation.
The remaining product choice is what a quick page should do when a diagram has no measurement yet. The existing first-paint route has a concrete cost here: x-initial producers run synchronously and are inlined in the document head, whereas the diagram renderer waits for fonts. Moving the existing drawing into that route would put Pele ahead of the body and would also need an answer for fonts that are still loading. The current committed Pele file is 689,892 bytes, or 256,293 bytes when gzipped; those are bundle sizes, not a measured startup regression.
A font-scoped measurement cache can remove the transcription after --render, as already proposed, but settling the quick-page case additionally requires choosing where the first measurement is paid: automatically render during authoring even when --render was omitted, or wait for layout and fonts before exposing the affected reading content in the viewer. Those change the quick-authoring or first-paint behavior respectively. I’m leaving this open for @max-sixty’s direction on that cache-miss behavior; no PR from this run, and the cache proposal remains a partial repair rather than a resolution of the whole issue.
Closing as obsolete. The loop this reports (the render check names a drawn height, the agent copies it into data-height, reruns) can no longer happen: #4724 removed the unreserved-height finding with the initial-render producers and deliberately accepted one content-derived resize when a widget upgrades. lf-diff was settled by #3984; lf-diagram's first-draw shift now sits under #4724's call, and the open cache-miss question in the last comment presumes a mechanism nothing on main builds.
This was written by Claude Code on behalf of max-sixty
Activity
leaf-agent commentedon Oct 19, 2026
The render check already measures the settled widget box and reports its difference from first paint; delivery reserves height from the widget declaration or an authored
data-height. The repeat-edit case needs Leaf to distinguish a measured reservation from an authored one. If a check simply insertsdata-height, the next content edit leaves no way to tell whether that value should be refreshed or preserved as the author’s override.The clean direction is a measured value tied to the candidate revision and applied by delivery only when the author has not set
data-height. That keeps the author’s override and lets a new measurement replace an old one after an edit. It also means deciding when a browser measurement becomes part of a revision, sincepage stampcurrently validates source without rendering. I did not open a PR: a source-only rewrite would recreate the reported loop after the next edit, while revision-scoped measurement crosses the render check, revision capture, and delivery contracts.max-sixty commentedon Oct 25, 2026
Reopening for
lf-diagram, which #3984'sClosesswept up but didn't fix. #3984 settledlf-diff: an inline-patch diff now first-paints at its drawn height through a 1.4 KB counting script, and authors no longer writedata-heightfor it.lf-diagramstill needs a hand-copieddata-height, and quick pages, which skip--render, still shift when one draws. A count can't help there, because the height comes from Pele's layout. The direction from triage: a diagram's drawn height is a pure function of its source text, since it renders withresponsive: falseand isn't width-dependent. So the render check can record each diagram's measured height keyed by a digest of its source, and delivery can apply it wherever nodata-heightis authored. An edit changes the digest, so an old height stops applying.leaf-agent commentedon Oct 25, 2026
The source-only cache key needs one correction:
responsive: falseremoves width dependence, but the height also depends on font metrics. Leaf passes the page’s--sansand--monointo Pele. In Chrome, the identical source below rendered at 301px withsans-serifand 245px withmonospace, withresponsive: falsein both calls. A circular node makes text width affect height.A reusable measured reservation therefore needs to be scoped to its renderer and font environment as well as its source; an authored
data-heightcan still take precedence. There is also a cold-cache limit: recording heights only during--renderremoves the transcription step after that check, but cannot reserve a new or edited diagram on a quick page that has never measured that source. That case remains part of this issue rather than being closed by the cache alone.Reproduce the font-dependent height
Run this expression with
leaf-dev probe security-boundary --jsin this checkout. It calls the page’s vendored Pele renderer with the widget’s sizing options:Observed heights:
301,245,301. No code change or PR from this run; this establishes a missing cache dependency before implementing the proposed reservation.Withdraw the second-implementation rule from AGENTS.md
Report how far an unreserved widget moves, not only its drawn height (#…
leaf-agent commentedon Oct 28, 2026
The remaining product choice is what a quick page should do when a diagram has no measurement yet. The existing first-paint route has a concrete cost here:
x-initialproducers run synchronously and are inlined in the document head, whereas the diagram renderer waits for fonts. Moving the existing drawing into that route would put Pele ahead of the body and would also need an answer for fonts that are still loading. The current committed Pele file is 689,892 bytes, or 256,293 bytes when gzipped; those are bundle sizes, not a measured startup regression.A font-scoped measurement cache can remove the transcription after
--render, as already proposed, but settling the quick-page case additionally requires choosing where the first measurement is paid: automatically render during authoring even when--renderwas omitted, or wait for layout and fonts before exposing the affected reading content in the viewer. Those change the quick-authoring or first-paint behavior respectively. I’m leaving this open for @max-sixty’s direction on that cache-miss behavior; no PR from this run, and the cache proposal remains a partial repair rather than a resolution of the whole issue.max-sixty commentedon Nov 5, 2026
Closing as obsolete. The loop this reports (the render check names a drawn height, the agent copies it into data-height, reruns) can no longer happen: #4724 removed the
unreserved-heightfinding with the initial-render producers and deliberately accepted one content-derived resize when a widget upgrades. lf-diff was settled by #3984; lf-diagram's first-draw shift now sits under #4724's call, and the open cache-miss question in the last comment presumes a mechanism nothing on main builds.