Skip to content

Hold panel_settled until the update that starts the panel's motion has run - #7404

Merged
max-sixty merged 1 commit into
mainfrom
agent-a5bff45c3ff58ef2e
Nov 27, 2026
Merged

max-sixty merged 1 commit into
mainfrom
agent-a5bff45c3ff58ef2e

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

test_an_open_view_covers_the_page_beneath_it failed intermittently (about 7 runs in 10 under three concurrent loops): after Escape put Threads away and panel_settled returned, seenRect read the paragraph that had stood under the view as unseen. The page behaves as designed. Escape removes the view in its keydown task, and the panel's box starts shrinking only in the next rendering update, when its size observer reads the change (dom/box-motion.js). panel_settled took "no running animation on the panel" as "its motion has finished", so a poll landing between the keydown and that update returned before the motion existed, and the test read the motion's first frame. A per-frame log of the cover's top and the panel's animations showed exactly that ordering in failing runs and the opposite in passing ones.

panel_settled now also waits for the runtime's updatesSettled reading, which turns settled only after the update that starts the motion and a quiet one after it. Every caller of panel_settled shares the race, so the fix sits there. rendered would have done the same but hangs on an occluded sample frame, which gets no animation frames.

Tests: the target test failed 21 of 30 runs before and 0 of 60 after; 58 callers of panel_settled that hold routes, motion or clocks or drive a child frame, and a random 67 others, pass.

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

…ion has run

`test_an_open_view_covers_the_page_beneath_it` failed intermittently: after
Escape put Threads away and `panel_settled` returned, `seenRect` read the
paragraph that had stood under the view as unseen (null), so the test's
`shown.right` threw.

The page behaves as designed. Escape removes the view in its keydown task, and
the panel's box starts its shrink only in the next rendering update, when its
size observer reads the change (dom/box-motion.js, `follow`). From then on the
panel's declared cover is the outline that motion draws, which starts at the
open view's top. `panel_settled` took "no running animation on the panel" as
"its motion has finished", so a poll that landed between the keydown and that
update returned before the motion existed, and the test's read fell on the
motion's first frames.

A per-frame log from Escape on (cover top in px, the panel's running
animations; the paragraph spans 458 to 512, the row starts at 842):

  failing run                               passing run
  t=11 view gone: cover 842, none           t=13 frame: cover 842, none
  t=14 panel_settled returns: 842, none     t=17 size delivery: cover 404, 7 at 0
  t=23 size delivery: cover 404, 7 at 0     t=20 panel_settled finds the 7,
  read in that update: seenRect null             finishes them: cover 842
                                            t=28 read: paragraph whole

In that gap the runtime's rendering reading (`lfRenderingState`,
runtime/base/rendering.js) already says updates are unsettled, and it turns
settled only after the update that starts the motion and a quiet one after
it. `panel_settled` now also waits for `updatesSettled`. It doesn't call
`rendered`, whose first step waits for an animation frame: an occluded child
gets none, and `test_offscreen_sample_cannot_acknowledge_child_viewport`,
which calls `panel_settled` on an offscreen sample, timed out at 120 s that
way. The runtime reads an occluded document as settled at once.

The fade-out of a leaving view plays no part: in all 32 logged runs, every
reading that showed the panel closed showed no view in it.

Reproduction: three concurrent serial loops of the test at normal priority
failed 21 of 30 runs before the change, all with the same null read, and 0 of
60 after. `leaf-dev suite flake --copies 20 --workers 4 --load 2` and
`--cpu-throttle 6` passed 20 of 20 before the change: in the background band
the driver slows as much as the page, so its poll seldom lands in the gap.

Tests run: the target test (60 runs); the 58 callers of `panel_settled` that
hold routes, motion or clocks or drive a child frame, the offscreen sample
included; a random 67 of its other callers; tests/model/test_suite_source.py.
Two journeys fail with and without the change:
`test_the_chrome_a_key_opens_has_no_serious_violations` (#7393) and
`test_a_finger_reaches_the_page_commands_its_keys_reach` (#7401).
@max-sixty
max-sixty merged commit 2523b7e into main Nov 27, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-a5bff45c3ff58ef2e branch November 27, 2026 17:41
max-sixty added a commit that referenced this pull request Nov 27, 2026
…r left it on Back (#7420)

The panel faded a view out for 60 ms before the next faded in. #7367
fixed a flake in that fade by keeping the fading view as it last drew,
but drawn that way it stood past the edge of the box shrinking under
it: a still 20 ms into Threads → On Me shows Threads' rows over the
page's text. Thread and On views already skipped the fade, since the
thread reader empties them as the next view comes, and
test_a_resolve_s_notice_stands_for_that_resolve_alone accepted a move
of the Resolved heading inside the fading Threads as the one move a
refused Resolve makes without input.

A view now goes in the paint that draws the next, which still fades in
over 90 ms while the box takes its size. Removed: the `leaving` state,
the view's second keyed node, `data-lf-leaving` and its CSS rule,
`--lf-motion-view-out`, the rendering hold that kept the fade inside
the gesture, `playMotion`'s `delay` with Go-to's wait for a delayed
motion (`heldUnseen`), and `:not([data-lf-leaving])` from every view
selector in the tests and dev/leaf_dev. The resolve test no longer
expects a move, and the Go-to test reads its chips once on the
arriving view instead of slowing the page's animations.

Back drew the list afresh at its top, so in a list the user had
scrolled, the row Back focused often sat out of view; only the menu
revealed its row, since #7367. The panel now keeps where the user
stood in a list as a view opens over it (`placeOf`): the row focus is
on, or on a control of, where that row stood in the list, and how far
the list was scrolled. History's record of the entry (`listShown`)
reads the same place. Back (`returnTo`) stands the user on that row
and scrolls so it stands where it stood in the window, as far as the
list's ends allow, so a row a reply carried to the head of Threads
stays in sight. Where focus wasn't on a row, as after a press that
left it on the list, the list scrolls as far as they left it and they
stand on the row that leads to the view they leave, brought into view
where none of it shows; without either row the list holds focus
itself. Browser Back over a list takes the same path with history's
record, so it keeps the place after a reload, when the panel holds
none. An On line, which carries no key of its own, takes its item's.
A landing that focuses the row of the thread the user was in, as
`g T` from a thread does, now reveals that row rather than the list's
first thread.

What the user sees differently: the view being left no longer fades
out; the next one fades in as the box changes size. Back from a thread
returns Threads, On Me or the menu scrolled as the user left it, on
the row they opened. `g T` from a thread far down Threads shows that
thread's row.

Tests: test_back_returns_a_list_as_the_user_left_it is new and fails
on main (the list at 0 for 243 px); test_threads_fades_out_where_it_stood
goes with the fade. The menu's way-back test now scrolls to its row in
the short window, since Back returns the menu as the user left it
rather than revealing the row. `pnpm run test:runtime`, the runtime's
type check, pre-commit, and 108 panel, On, history and Go-to tests the
change reaches pass, apart from
test_an_open_view_covers_the_page_beneath_it, whose harness race #7404
fixes. Codex reviewed three rounds; its findings are fixed here, apart
from a mouse press on an On Agent item's Discuss in WebKit or Firefox,
which leaves focus on the list rather than the line, so Back stands on
the list, scrolled as left.

> _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