Skip to content

Measure every page and input with one leaf-dev bench, in place of scaling and bench-latency - #5576

Merged
max-sixty merged 4 commits into
mainfrom
grind/bench-one
Nov 6, 2026
Merged

max-sixty merged 4 commits into
mainfrom
grind/bench-one

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Max asked for one benchmark that takes variables, rather than two that each serve
pages from this tree and a base, drive inputs, time them and profile them. This
replaces leaf-dev scaling and leaf-dev bench-latency with one leaf-dev bench,
and deletes both, with every caller cut over and no alias.

uv run leaf-dev bench [PAGE ...] [--sizes 32,64,128,256] [--input NAME ...]
    [--read cpu|paint|server ...] [--rounds N] [--base [REF]] [--browser firefox] [--profile]
  • The page is a generated collection (COLLECTIONS, measured at each size beside the
    BASE page) or any example or the corpus by name.
  • The inputs are one table, INPUTS: scaling's click, key, leave, Tab, wheel and
    revision; bench-latency's comment, card move, agent reply, agent status and stamped
    revision (stamp); and a triple-click selection of the title (select), which
    replaces Time a selection in leaf-dev scaling, and hold it to a budget on a large page daily #5472. A page without what an input needs (an option, a card) reads none of
    it and the report names it missing.
  • The arms come from arms.choose_arms, as before.
  • What to read: cpu (scaling's CPU pass), paint (bench-latency's time to the
    painted result, the POST's answer, the server's reading on screen, and the requests
    and bytes caused), server (the in-process server paths, server_paths.py, the
    renamed server_scaling.py), for this checkout's generated pages only, as before.
    Default cpu and paint, and in Firefox cpu.

Scaling is the same benchmark over several sizes: with three sizes or more the table
gives each reading's exponent, marked ! past 1.5. Every reading of every page goes in
one table, a row per reading and a column per size and arm, and results.json keeps
each round's readings and the table's lowest (lowest), which the daily chart reads.

Each measurement's method

Kept as it was:

  • CPU: thread ticks (or Firefox's OS count), the load until the main thread goes quiet,
    idle subtraction, the mean over each input's count, per-window ready for inputs that
    need setup, interleaved rounds and the lowest reading.
  • Paint: painted.js goals from the input event or the agent's first write, the POST's
    answer by attempt, request attribution against what the page started while left
    alone (starters pooled across rounds), long-frame owners, and --profile's trace and
    attribution.
  • Server: unchanged code.

What changed, each a call Max may reverse:

  • Each pass reads a fresh page. The CPU pass and the paint pass of each round each
    build and serve the page anew, so no input meets what another pass or round left on
    it. Scaling served one page through every round, and bench-latency's runs piled up
    each other's comments, questions and moves. Each pass pays a page build.
  • The paint pass starts with the panel folded, as a page loads, and the reply
    opens the views it needs. bench-latency opened the Threads view first, a habit from
    the classic chrome's always-visible thread list (Remove the classic chrome: the floating panel is Leaf's only chrome #3100). An open Threads view slows
    the server's reading on screen: a click's shown on the asks page at 128 sections
    read 59–61 ms with it open and 43–47 ms folded, three fresh pages each, interleaved.
  • The paint pass times each input as many times as the CPU pass reads it (a click
    four times, a revision twice, the conversation's inputs once) and keeps the median,
    as scaling read shown over four clicks. Every round's samples are in
    results.json.
  • One statistic across rounds: the lowest, for every reading. bench-latency
    printed median [min-max] over runs.
  • Both passes open browser.tab's window, which reduces motion, as scaling's did;
    bench-latency's context used no preference, which may be why a card move painted
    sooner here (not checked).
  • revision saves only, inserting a paragraph under the title, as an agent's
    ordinary save does (scaling's input inserted and then removed one). bench-latency's
    revision, a save followed at once by leaf page stamp, is the stamp input, and
    the note's stamp-route analysis now runs as
    leaf-dev bench corpus --read paint --input stamp --base.
  • Targets are found on any page. The comment selects the first paragraph after
    the title (the triage board's lede, as before; on the corpus its own lede rather
    than the triage lede deep inside it). A move takes the first card with a column left
    of it (card-tz on the triage board, bench-latency's first move). The agent's
    thread is a general one, made at the first reply and taken in by the page before the
    reply's window opens; bench-latency anchored one on the triage lede before the page
    loaded. An anchored agent thread made every click on the asks page cost about 70 ms
    more CPU (13 → 82 ms at 8 sections), so it would have changed every other input's
    reading.
  • Input order: the page's own inputs, then the two revisions, then the selection,
    then those that add threads and to-dos. A selection standing on the title holds a
    revision back (after a triple click on the title, a save left the page on its old
    revision for 5 s), so the selection follows the revisions.
  • --read paint also counts requests and bytes, from the same window, so they
    have no read of their own.
  • --browser firefox reads only cpu: the paint pass needs Chrome's DevTools
    protocol for its requests, and bench-latency ran only in Chromium.
  • The daily run takes every input with the default reads
    (leaf-dev bench --sizes 64,128,256 --rounds 2). Its chart is now "Bench at 64
    sections" and holds the load's and each input's main-thread CPU and each gesture's
    shown (asks: click cpu, asks: click shown, ...); request counts and single
    paints stay in the summary, the log and the artifact. gh-pages holds no reading
    yet, so the rename loses nothing.
  • The reply reads its delivery in parts: on a page seeded with many events,
    the first leaf wait delivers them all with the question, in parts (14 on the
    threads page at 64 sections). The reply follows each part's leaf delivery read <id> --part N, as the delivery tells an agent to, and joins their text, leaving
    the seeded threads queued as the page was generated.
  • compare_profiles is gone: its side-by-side window and render times repeated
    what the table and each arm's profile already print.
  • Whether an input posts is read from its goals: an input waits for its POST's
    answer in the CPU pass where its goals include the server's reading of its event.
    Whether it paints stays declared (Input.paints), since a run refuses --read paint with no painting input before it builds a page, and the paint pass skips an
    input without running its ready, whose setup moves the page.

Equivalence

Old and new on the same page, inputs and sizes, back to back on this Mac. The old
commands ran from untracked copies of main's scaling.py and bench_latency.py.

CPU, asks page, lowest of two rounds (leaf-dev scaling asks prose --sizes 64,128 --rounds 2 at load 6 against leaf-dev bench asks prose --sizes 64,128 --rounds 2 --input click --input key --input leave --input tab --input scroll --input revision at
load 4), ms at 8 / 64 / 128 sections:

Reading scaling bench
load 180 / 388 / 627 181 / 404 / 640
click 11.8 / 21.2 / 28.0 19.8 / 22.7 / 28.5
key 4.1 / 4.6 / 5.3 5.0 / 5.7 / 4.9
leave 11.2 / 28.8 / 48.0 16.2 / 30.9 / 40.8
Tab 9.0 / 11.5 / 11.0 12.4 / 9.4 / 10.9
wheel 1.2 / 2.5 / 3.9 1.5 / 2.4 / 3.3
revision 26.2 / 131.9 / 241.6 29.1 / 126.9 / 242.3
event 4.9 / 7.8 / 10.5 6.6 / 8.5 / 10.5
click shown 28.4 / 28.7 / 29.3 29.8 / 30.9 / 32.7

The prose page reads alike (load 146 / 159 / 172 against 147 / 158 / 168, revision 12.6
/ 23.3 / 36.6 against 15.5 / 27.9 / 39.6). A click at 8 sections spreads from 11 to 21
ms between passes on one served page (cpu_pass three times on each of two pages read
14.0, 11.4, 16.9 and 18.7, 21.4, 11.8), so its 19.8 is one pass's draw.

Two readings sit consistently above scaling's, here and in an independent A/B: shown
by about 2 ms, and leave at 64 sections by about 3 ms. For shown, the likely cause
is a colder page: scaling clicked for shown after its whole CPU pass, and here the
first of four clicks on a fresh page reads 40–46 ms and the rest 29–33. The paint tab's
instrumentation isn't it: with and without Chrome's network domain and the long-frame
observer, three fresh pages each, the medians were 31.7–32.2 and 30.6–32.7 ms. A quick
look found no cause for leave.

Paint, triage board, three rounds (leaf-dev bench-latency --page triage-board --runs 3 against leaf-dev bench triage-board --read paint --rounds 3 --input comment --input move --input reply --input status --input stamp, both at load 4), median
[min–max] ms over the runs:

Input bench-latency painted bench painted bench-latency Sent bench shown requests, KB
comment 51 [49–89] 73 [71–76] 66 [66–89] 93 [92–96] 1, 5.5 / 1, 5.4
move 11 [10–21] 11 [10–14] 32 [26–45] 33 [32–35] 1, 6.2 / 1, 6.1
reply 94 [55–176] 68 [62–72] 2, 4.6 / 2, 4.5
status 79 [56–91] 110 [91–115] 1, 1.5 / 1, 1.7
revision / stamp 234 [228–277] 251 [248–264] 2, 160 / 2, 147

The comment and status differ because every bench round reads a fresh page, so each
is the page's first: bench-latency's first run read the comment at 89 ms, the status
at 91 and the move at 21, and its later runs, on a page that already held them, 49–51,
56–79 and 10–11. The panel's state doesn't explain the comment: with the Threads view
open and folded, three fresh pages each, it painted in 73 and 72 ms; the status read
93 and 114. The stamped revision's bytes differ because it now inserts a paragraph
where bench-latency's appended words to the lede.

Server paths (leaf-dev scaling --server events options --sizes 128,256 against
leaf-dev bench events options --read server --sizes 128,256): the same code, reading
within 0.5 ms on every path (append on events 1.7 / 6.9 / 12.1 against 1.9 / 7.1 /
12.1).

Selection (leaf-dev bench asks document --sizes 512 --input select --read cpu): 24.9 → 159.2 ms on asks and 31.9 → 45.0 on document, from 8 to 512 sections;
#5472 read 26 → 152 and 32 → 40 on main.

Callers

.github/workflows/ci.yaml (the daily job is now bench, charting the load's and
each input's CPU and each gesture's shown at 64 sections: the readings it charted
under new names, less the server's event time and size, plus the new inputs' CPU
and the comment's shown), root AGENTS.md ("Responsiveness" names the command),
tests/AGENTS.md (the rule #5522 wrote names it), dev/AGENTS.md,
browser/AGENTS.md, notes/user-feedback-responsiveness.md,
notes/shift-watch-cost.md, and comments in floating.js, toc.css,
test_interact_layer.py, painted.js/py, main_thread.py, profiles.py and
browser.py.

Size and checks

bench.py is 2,175 lines where scaling.py and bench_latency.py were 2,241 together;
the whole change is +2,257 / −2,315. The two commands shared little code after #5546
(arms, painted.js, profiles), so the saving is one CLI, one orchestration and one report
in place of two; what this buys besides is every input on every page, every read on
every input, and one place to add the next.

The daily job's two steps ran locally at one round and exited 0:
uv run leaf-dev bench --sizes 64,128,256 --rounds 1 in 723 s at load 6–7 over asks,
document, prose and threads, and uv run leaf-dev bench --read server in 163 s; the
chart step's jq over their results.json gave 56 series (asks: load cpu 468.91
ms, ...). The rows page #5567 added, now in COLLECTIONS and AXES, ran alone in
168 s at load 4–5 (leaf-dev bench rows --sizes 64,128,256 --rounds 1, exit 0) and
adds 14 series, so the chart holds 70. The job runs two rounds of all five pages, so
expect about 30 minutes on this Mac under its 120-minute guard.

Also run on this Mac: the equivalence runs above; --profile (asks at 16 and 32, the
CPU growth listing and the paint attribution); --base (triage-board's move and
status on the merge base and the head); --browser firefox, whose default read is
cpu; --read paint --input move --input click on asks, which names move missing;
the reply on threads and messages at 64; the refusals of --read paint with no
painting input, of --read server with --base or an authored page, of Firefox with
--read paint or --profile, and of an unknown PAGE; uv run pre-commit run on
every changed file, including ty, vulture and actionlint.

Not verified: the corpus page; WebKit, which the command refuses as before.

Supersedes #5472.

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

…ling and bench-latency

Max asked for one benchmark taking variables rather than two that each
serve pages from this tree and a base, drive inputs, time them and
profile them. `leaf-dev bench` takes the page (a generated collection
at sizes, or an example or the corpus), the inputs, the arms and what
to read (`--read cpu`, `paint`, `server`), with `--profile`; scaling is
the same benchmark over several sizes, with the exponent in its table.
Both old commands are deleted and every caller cut over.

Each input is one entry in `INPUTS`: scaling's click, key, leave, Tab,
wheel and revision, bench-latency's comment, card move, agent reply,
status and stamped revision, and a triple-click selection of the
title, which replaces #5472. Every input runs in every pass where the
page holds what it needs: the CPU pass keeps scaling's method (thread
ticks, idle subtraction, means over several inputs, interleaved rounds
and the lowest reading), and the paint pass keeps bench-latency's
(painted.js goals, the POST's answer, request attribution against what
the page starts alone, long frames, and --profile's trace). Each pass
reads a page built afresh, so no input meets what another pass or round
left on it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branch now conflicts with main: #5567 (e99fc3aa6) edited dev/leaf_dev/commands/scaling.py, and this PR deletes that file. The edit added a rows collection (table_rows, one ask and an n-row table) to COLLECTIONS and to the browser's default AXES, so the daily job and its chart would cover the quadratic table restyle that #5567 fixed. If you resolve the modify/delete conflict by removing the file, rows disappears with nothing to flag it: bench.py's COLLECTIONS has no rows entry, and its AXES is still ("asks", "document", "prose", "threads"). When you rebase, move table_rows into bench.py and add "rows" to COLLECTIONS and AXES. The daily bench job then keeps measuring tables, under the new chart names.

…an't read

The daily command crashed on the threads page at 64 sections: the reply's
`leaf wait` delivery carried every seeded event, in 14 parts with no
`batches`. A generated page whose log holds pending input is now delivered
and acknowledged as it is built, as the session holding a page would have
taken it in, so the reply reads only its own question. results.json is
written after each page, so a failure keeps the pages before it.

The review's other fixes:
- Firefox reads cpu by default, and each refusal names only the option
  that caused it.
- The paint pass reports the inputs a page lacks, as the CPU pass does,
  and `--read paint` with no painting input is refused before any page is
  built; `table` takes an empty set of readings.
- `--read server` refuses `--base` and authored pages again, as
  `leaf-dev scaling --server` did.
- The chart is "Bench at 64 sections" and holds only the load's and each
  input's CPU and each gesture's `shown`; the step's guard is 120 minutes.
- One `lowest` serves the browser and the server; whether an input posts
  comes from its goals; the header says why each pass reads a POST its
  own way.

Checked: the daily job's two steps at --rounds 1 and its jq; the refusals;
`--read paint --input move --input click` on asks naming move missing;
Firefox's default reads; reply on threads and messages at 64.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
max-sixty and others added 2 commits November 5, 2026 17:28
… log at build

Acknowledging a seeded page's pending input as it was built changed the
page the benchmark measures: it wrote a pickup per seeded comment and a
receipt, which turned each seeded thread from Queued to Delivered, and
read the threads page's click about 20% cheaper, while the server pass
read the page unacknowledged. The page now stays as generated, and the
reply's setup follows each part of its delivery (`leaf delivery read
<id> --part N`), as the delivery tells an agent to, and joins their text.

Checked: `leaf-dev bench threads messages --sizes 64 --input reply`, and
the daily job's browser step at one round.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…TIONS and AXES

#5567 added a rows page (table_rows) to scaling.py, which this branch deletes; it now lives in bench.py's COLLECTIONS and AXES, so the daily run measures tables.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@max-sixty
max-sixty marked this pull request as ready for review November 6, 2026 01:37
@max-sixty
max-sixty merged commit b205ff9 into main Nov 6, 2026
6 checks passed
@max-sixty
max-sixty deleted the grind/bench-one branch November 6, 2026 01:54
max-sixty added a commit that referenced this pull request Nov 6, 2026
…ge (#5580)

Sending a comment on the generated asks page at 256 sections now paints
in a
median 184 ms rather than 435, and entering or leaving a comment box
that floats over
the page no longer restyles every element on it.

## Cause

While focus is in a `leaf-text` inside a box standing in a plane, such
as the comment
box on selected words or a margin card's reply, `floating.js`
(`readFloatingEditor`)
sets `data-lf-floating-editor` on the root, and `base.css` zeroes the
root's scroll
padding with `scroll-padding: 0 !important`. At rest the root's
`scroll-padding-top` is
`var(--lf-landing-top)`, a registered custom property, so the zero made
the root stop
reading that token, and leaving the box made it read the token again.

On Leaf's pages in Chromium 156, that flip restyles every element. On
the 256-section
asks page (14,257 elements), with the box open, it cost 174 ms of style
at each entry
and each exit. A change between two literals, between two reads of the
token, or to
and from an unregistered `var()` cost 0.1–0.2 ms. The review narrowed
the trigger to
the root ceasing to read this token. On a plain 4,000-element page, no
flip to or from
a registered token restyled more than 4 elements. On Leaf's asks page at
64 sections, main's flip
restyles 12,103 elements, and only 8 when another root property keeps
reading
`--lf-landing-top` or the token is a constant.

The send keystroke pays it: the trace of `Control+Enter` in the comment
box at 256
sections showed one forced style recalc of 47,805 elements (237 ms
traced), read by
`letGo` → `landingPlace` → `pageReading` → `readingBounds` →
`shownWindow`
(`geometry.js`), after `readFloatingEditor` removed the attribute as
focus left the
box (Chromium's invalidation tracking names `data-lf-floating-editor` on
`HTML`). The
same restyle ran when the user entered the box. It is the 255 ms of
forced style and
layout under `field-keys.js` `LEAF-TEXT.onkeydown` that the first full
`leaf-dev bench`
run of #5576 read on that page.

The flip arrived with #5417, which moved the override into `base.css` as
`!important`
so that it wins the top edge again. Before that, the unlayered override
lost the top
edge and changed only the literal bottom edge, which costs nothing.

## Change

The zero is now a product of the same token, `calc(0 *
var(--lf-landing-top))`, so the
root reads `--lf-landing-top` in both states. The computed padding in a
floating editor
is still `0px` on all four sides, checked in Chromium, Firefox and
WebKit, and Leaf's
landings still read `--lf-landing-top` directly. The rule's comment in
`base.css` says
what was measured and names the test that guards it.

`render_harness.restyle_counts` reads the elements each style recalc
restyled from
Chromium's trace. The new test and
`test_code_copy_reads_sources_before_positioning_many_controls` both use
it in place of
their own copies.

## Evidence

Main against this branch on the asks page at 256 sections, the comment
input of
`leaf-dev bench` run by a scratch script: drag-select the first
paragraph, open the
box, type, then `Control+Enter`. "Painted" is `painted.js`'s message
goal from the
keystroke; CPU is the main thread's thread ticks over the keystroke and
the 1.5 s after
it, less the idle rate. Eight interleaved sends each, at load 4–5:

| | painted ms, median (range) | send CPU ms, median (range) |
| --- | --- | --- |
| main | 435 (403–515) | 517 (494–593) |
| this branch | 184 (179–281) | 270 (262–275) |

In these eight sends main paid the restyle every time (CPU 494 ms or
more). In the
review's eight interleaved sends, main restyled the whole page in 6 of
8, painted median 421 ms (187–533), and this branch in 0 of 8, median
190 ms (184–309). At 64 sections, the lowest of three rounds read 152 ms
painted on
main and 95 on this branch.

Firefox (review): the flip costs at most 1 ms with the box open, on main
and on this
branch alike.

On the corpus,
`uv run leaf-dev bench-latency --page corpus --transition comment --runs
3 --base HEAD`
reads 173 ms painted on both arms; its comment follows bench-latency's
open Threads
view, where the send's focus moves to the panel's reply and the root
keeps the
attribute.

The send still grows with the page (95 → 184 ms painted from 64 to 256
sections). Most
of the rest is the margin's two layout passes per send, each over every
row, and the
new comment's mark adds Chromium's per-frame cost of a text-decorated
custom highlight.
Neither is changed here.

## Test


`test_entering_and_leaving_a_floating_comment_box_restyles_only_the_chrome`
(`tests/browser/test_chrome_contracts.py`) opens the box on a
600-paragraph page, then
Tabs out of its field and clicks back in. It counts the elements each
style recalc
restyled in a trace, against a control that restyles the whole page (a
custom property
set on the root). With main's `base.css` both moves restyle the whole
page (3,973 and
3,982 elements against the control's 3,807), so the test fails; on this
branch it
passes. Unthrottled, 18 `leaf-dev flake` copies failed 18 of 18 with
main's
`base.css`; on this branch 18 copies passed 18 of 18 at `--cpu-throttle
10` and at 20
(review).

It depends on CPU speed in one direction. With main's CSS at
`--cpu-throttle 10` under
six concurrent copies, 2 of 18 and then 6 of 18 copies passed, so on a
slow machine
main's flip isn't always expensive. It never fails falsely on this
branch.

Ran: that test (before and after the helper),
`test_code_copy_reads_sources_before_positioning_many_controls`,
`test_a_compact_comment_keeps_no_room_for_send_under_a_mouse`; the
floating-editor,
caret-reveal and landing tests #5417 named, `-k "caret or reveal or
resume or floating
or foot or reply_row or follows or wheel_return or grows_back"` over
`tests/browser/{drafts,margin,threads,navigation}`,
`test_render_send_placement.py`
and `test_chrome_contracts.py` (85 passed). Two of those fail the same
way with main's
`base.css`:
`test_a_caret_is_drawn_at_a_lines_end_and_after_a_list_bullet[firefox_browser]`
(a `wait_for_function` timeout) and
`test_a_zoomed_floating_draft_and_sent_comment_fit_a_narrow_window` (a
`ResizeObserver loop` window error). Pre-commit on the changed files.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
max-sixty added a commit that referenced this pull request Nov 6, 2026
…ails without it (#5589)

While the user writes in a floating comment box, the root drops its
scroll padding (`data-lf-floating-editor`, `browser/base.css`), because
the browser's caret reveal through a box anchored to the page applies
that padding and moves the words beneath a box already in view (#4821).
Nothing in the suite failed with that rule removed: #4833's
`test_a_card_at_the_windows_foot_grows_back_to_how_it_stood` stands its
card in the window plane, which writes no `position-anchor`, so the
reveal stops at the box there. This adds a test that does fail, and
records why the rule has no structural replacement.

- **Test.**
`test_writing_in_a_comment_box_over_the_window_foot_moves_no_words`
(`tests/browser/test_chrome_contracts.py`, Chromium and WebKit) opens a
comment box on words low in a 1512×860 window, so the box stands over
the foot band the panel states, types four letters, and asserts the page
didn't scroll. It also asserts the caret stands inside that band, so a
layout change that moves the box clear of it fails the test rather than
passing it vacuously. With the rule's declaration removed, the words
move 16 px in Chromium 156 and 14–21 px in WebKit 27.2.
- **Why the rule stays.** Chromium stops a scroll-into-view at a fixed
box only when the box has no anchor scroll adjustment (`IsFixedToFrame`,
`scroll_into_view_util.cc`); since crbug.com/469481151 an anchored fixed
box bubbles to the root and takes its padding, pinned by WPT
`css-anchor-position/scroll-to-anchored-fixed-001…006`. WebKit does the
same (`adjustForScrollByAnchor`, `LocalFrameView.cpp`). Firefox 157
reveals nothing through a fixed box. An agent tried, on a plain anchored
contenteditable and in Leaf: the field or the box as its own scroller,
`overflow`, `contain`, `overscroll-behavior`, the top layer (popover),
`position: absolute`, `scroll-margin` on the caret's text, and taking
typing in `beforeinput`. Each either still moved the page in Chromium or
WebKit, or stopped the box following its anchor. The comments in
`base.css` and `floating.js` now name WebKit and say what was rejected.
- **Engine note.** `notes/browser-support.md` records a Chromium bug
found on the way: each reveal of an anchored fixed box made before the
next frame scrolls the full amount again (three `scrollIntoView` calls
scroll 270 px where one scrolls 90; four keys in one frame 240 px where
one scrolls 60). WebKit reveals once. It is the overshoot #5417
accepted, and the note gives the check that shows when Chromium fixes
it.
- The rule's comment now names `leaf-dev bench`, which replaced
`leaf-dev scaling` in #5576.

Checked: the new test passes on both engines at the head and fails on
both with the rule's declaration removed (Chromium 2076 → 2092, WebKit
2075 → 2096, rerun independently); #5580's restyle test passes;
pre-commit on the changed files.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
max-sixty added a commit that referenced this pull request Nov 7, 2026
…s only the row (#5623)

The margin layout pass wrote each row's seat as `--lf-margin-x` and
`--lf-margin-y`, which `annotation-theme.css` turned into the row's
`margin-left` and `margin-top`. Those custom properties are
unregistered, so they are inherited, and every row the pass moved
restyled its whole subtree. The pass now writes `margin-left` and
`margin-top` on the row directly. Nothing else in the tree, packages and
theme included, read the two properties.

Moving every row by a pixel on `leaf-dev scaling`'s asks page at 64
sections took 11.1–17.7 ms in Chromium through the custom properties and
2.2–2.9 ms through the margins (least of 11 moves, two rounds); a
registered, non-inherited custom property took 6.3–7.4 ms. In Firefox it
took 5 ms against 1. An agent's revision adding or removing one
paragraph spent 59.5 and 67.8 ms in its margin passes at 64 sections in
Chromium, against 41.0 and 42.3 with this change. These readings were
taken on the base before #5576 renamed the benchmark `leaf-dev bench`.

## The write watch needs no exception

The custom properties kept the seat's text exact. A style attribute
prints a plain length to six significant digits, so from 10,000px down a
long page a sub-pixel move can leave the attribute's text as it was.
Layout reads the full length: in Chromium and Firefox a row at
1,234,567.578125px follows 1, 2 and 4px moves of its target exactly
either way, and setting a margin to the length it already holds records
no mutation. Only the suite's write watch (`tests/write_watch.js`),
which judges a write by its text, misreads such a move as a write that
changed nothing.


`test_distant_margin_coordinates_follow_small_moves_without_restatement`
stood its target at 1,234,567px, where the text rounds to
`1.23457e+06px` and a 1px move doesn't show, so the watch failed it. The
test now stands the target at 123,456px. There the text prints whole
pixels, so each of the test's 1, 2 and 4px moves changes it, and the
watch judges the passes over an unchanged layout as it does on every
other page. At the old distance the test still fails the watch
(checked). An earlier version of this branch added a margin-specific
exception to the watch instead.

This leaves one known false finding. An independent review moved the
test's target to 12,345.578125px by 1/64, 2/64 and 4/64px: the row
followed exactly, and the watch then reported an unchanged write on the
row. No test in the tree places content 10,000px or more down a page
apart from this one, and a watched test that does meet it fails loudly
and names the row. So the watch keeps no rule for it until a test needs
one, and the `margin-layout.js` header says why the watch would misread
such a move.

## Checks

- Ten margin browser tests by node id (rail, pins, clusters, scrollers,
the distant test) pass on current main.
`test_keyboard_arrival_at_a_cluster_shows_all_its_entries_for_the_keys_to_walk`
fails both with and without this change, and on main's latest finished
push run; it is inherited.
- Before the rebase onto current main: `leaf-dev stills` over 30 margin
and thread states gave byte-identical screenshots in Chromium and
Firefox, and `pnpm run check` and `pnpm run test:runtime` passed.
- Pre-commit passes on the changed files.

> _This was written by Claude Code on behalf of max-sixty_
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