Repository navigation
Credit a node that a native size animation's box carries, so the shift watch judges it at any frame rate - #6169
Merged
Merged
Conversation
…t watch judges it at any frame rate A box lays out its content as it grows: a button centres its label, a flex box aligns its items. At 60 fps a short height transition moves the label less than the 3 px Chrome reports as a layout shift in each frame, so the shift watch never judged it. On a starved host a 110 ms frame moves it 4 px, Chrome reports the shift, and the watch had no credit for it: it credited a size animation's reflow only of boxes after the animated one in its flow. `innerReflow` credits a node inside the animated box by its move beyond its other credits, where that move lies between the moves of the box's two edges beyond the box's own credits, the box grows or shrinks rather than being carried whole, and the node moves with the box. That covers a box growing at its foot, one standing on its foot and growing at its head, one centred in its parent, and a logical size in a vertical writing mode. The box's alignment isn't readable (a button centres its label by no property), so another move within that span is credited too, as `sticky_inset` credits one within its span. The placement walk `sizeReaches` used moves into `unplacedBy`, which both credits share. The credit follows the watch's ownership rules, as translation and following-box reflow do: only an animation an input began is credited. The header's scope now says so. A transition a script starts with no input, as the swap-watch fixture before #6166 did, moves the label without input, which browser/AGENTS.md ("The page holds still under the user's aim") forbids. The watch still reports that only when Chrome reports the shift, so on a starved host and not at 60 fps. Starved runs (`taskpolicy -b` beside busy loops), base -> head, 4 runs each: a click-started height transition on a centred button failed 3 -> 0; the script-started one failed 4 -> 4; the same growth with no transition failed 4 -> 4. Unloaded, the first two pass and the third fails, on both. `test_a_size_animation_carries_what_its_box_lays_out` seeks a press's paused height animation to its end in one frame, so every host sees the step a starved host does. Words re-centred in a box growing at its foot or at its head pass; words a script carries farther than the box grew, and words re-centred by a size change no animation of their box makes, fail. On the base watch the first two arms fail; dropping the bound, the ownership checks or the box's head-edge term each turns the matching arm. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 16, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
…ved Firefox (#6197) Max's direction for tests whose result depends on CPU: design them so it can't, confirm that in the nightly runs, and keep starved runs out of the merge pipeline. This makes the macOS nightly that run: it now uses four workers on the runner's three cores, which starves every test. A trial at four workers ([run 43780587059](https://github.com/max-sixty/leaf/actions/runs/43780587059)) took 4h11m against 4h12m at two, with the CPU at 0% idle throughout and memory peaking at 7.1 of 7.5 GB, no swap. `tests/AGENTS.md` now names that job as the slow-machine rule's check. In a starved Firefox, PageUp in a live log can do nothing: Firefox applies the key's scroll 280–800 ms late, after the reader's 80 ms wait for it, and no event says the browser won't scroll, so ending the loss needs a deadline. Max accepted it as a corner case, so the Firefox cases of `test_a_page_up_in_a_log_a_stream_feeds_leaves_its_end` whose scroll the browser applies (PageUp, PageUp on a link, wheel, wheel across) are now non-strict expected failures; this PR's first CI run lost a wheel the same way. They pass at normal load, as they did locally here and on main's last three push runs. `u`, which Leaf's own glide scrolls, stays a plain case. To weigh: the trial run at four workers had 30 failures against 21 at two. #6154, #6155, #6166 and #6169 fixed the load-dependent ones found then, but the first nightly after this may still turn up more; each is a test whose result depends on speed. > _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 shift watch now credits a node inside a box that a native size animation is growing or shrinking, so a press-begun transition that re-centres a button's label passes at every frame rate. Before, at 60 fps each frame moved the label less than the 3 px Chrome reports as a layout shift, so the watch never judged it. On a starved host one frame moved it 4 px, Chrome reported the shift, and the watch had no credit for it, because it credited a size animation's reflow only of boxes after the animated one.
innerReflowintests/shift_watch.jscredits the node's move when:unplacedBy, whichsizeReachesnow shares).That covers a box growing at its foot, one standing on its foot and growing at its head, one centred in its parent, and a logical size in a vertical writing mode. The box's alignment isn't readable (a button centres its label by no CSS property), so a script move that stays within the box's growth in the same frame is credited too, as the sticky-inset credit already allows within its span.
For the reviewer: a script-started transition still depends on frame rate
The credit applies only to animations an input began, as the watch's translation and following-box credits do; the header's scope paragraph now says so. The swap-watch fixture as it was before #6166 started its transition from a script, with no input, so it still fails starved and passes unloaded. browser/AGENTS.md ("The page holds still under the user's aim") lets news grow a box but keeps reading content still, so the starved verdict is the one that rule asks for. The 60 fps pass comes from Chrome's paint signal, which every passive verdict starts from and which leaves out a frame's move under 3 px. Two ways to close that, both outside this PR:
A width animation that rewraps text, moving words to another line, is also still uncredited, as it was before.
Evidence
Scratch fixtures, the button row from the swap-watch test, 4 starved runs each (
taskpolicy -bbeside self-ending busy loops):test_a_size_animation_carries_what_its_box_lays_outseeks a press's paused height animation to its end in one frame, so every host sees the step a starved host does. Words re-centred in a box growing at its foot or at its head pass; words a script carries farther than the box grew, and words re-centred by a size change no animation of their box makes, fail. On the base watch the first two arms fail. Dropping the bound, the ownership checks or the box's head-edge term each turns the matching arm.Focused checks pass, unloaded and the new test starved: the shift watch's size and animation credit tests, the swap-watch module, and four real-page fold and growth tests (97 in all). An independent Codex review found the vertical-writing-mode gap, unmemoised recursion through nested resizing boxes, a crash path for a box that turns
display: contents, and the scope paragraph's overstatement; this PR fixes all four.