Skip to content

test: check the thread walk's page jump in the press's task, not its first frame - #5518

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5476
Nov 5, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5476

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

test_a_thread_walk_starts_one_page_trip_and_reveals_its_nested_passage has failed on main since #5285 because its threshold was built for the browser's smooth scroll, and #5285 replaced that on purpose. The test now checks the regression it was written for, a page jump in the press's own task, instead of how far the first animation frame goes.

Cause. #5285 moved every landing onto Leaf's own glide: 140 ms of cubic ease-out (glideTo in browser/runtime/scrolling.js). Even when its first frame comes on time, that covers about a third of the trip, roughly 390 of the 1224 px here. Native smooth scroll started slowly, so firstPage < 100 used to tell a jump from a smooth start, but against the glide it can't. On this runner the frame after t came 70–90 ms after the press, so the first page scroll event already read 1025–1146 px, and the frames after it eased monotonically to 1224.

Change. The old bug was scrollIntoView moving the document to its nearest edge before the centred landing, and that move happens in the press's task. A keydown capture listener registered after the runtime's reads the page, the rail and the local scroller once the walk has handled t. At that point the nested scrollers have moved and the page has not. Once the passage is centred, the test also checks that the page's scroll positions only ever increase, so the page makes one trip. The interface and #5285's intent are unchanged; only the test moved.

Verification. On current main the test fails as reported (firstPage: 1025). With this change it passes three runs in a row. Reintroducing the nearest-edge reveal on the page (dropping if (box === targetScroller) inside = false; in innerMoves) makes the new check fail with page: 830.

Not changed here: the glide's clock and a late first frame

glideTo starts its clock at the press. When the press's work holds the next frame back, as it did here by 70–90 ms, most of the ease runs out before anything is drawn, and the first frame that moves the page shows it about 90% of the way there. The first tick's rAF timestamp also came before the press (about 2845 ms against 3011 ms), so it was clamped to t = 0 and wrote no movement. Starting the clock at the first frame would change how long every landing and reading key takes, which is a product decision for #5285's line of work and not part of this test repair. Whether that delay also happens on a desktop, rather than this headless runner, hasn't been measured.

Closes #5476 — automated triage

…first frame

#5285 moved landings onto Leaf's own 140 ms glide. Its ease-out covers about
a third of the trip in its first frame, and here the frame after `t` arrives
late enough that the first page scroll event already reads ~1100 of 1224 px,
so the test's `firstPage < 100` threshold, which assumed the browser's slow
smooth-scroll start, no longer told a jump from a glide.

The jump the test guards against, `scrollIntoView` moving the document to its
nearest edge before the centred landing, happens in the press's own task. The
test now reads the page, rail and local scroller at the end of the keydown
dispatch: the nested scrollers have moved and the page has not. It then checks
the page's scroll positions only ever increase on the way to the centre, one
trip. Reintroducing the nearest-edge reveal on the page fails the new check
with the page at 830 px in the press's task.

Closes #5476
@leaf-agent
leaf-agent merged commit be27342 into main Nov 5, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5476 branch November 5, 2026 17:55
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.

test_a_thread_walk_starts_one_page_trip_and_reveals_its_nested_passage fails on main since #5285

1 participant