Skip to content

Fix seventeen tests that fail only on the nightly macOS runner, and count a card's carry as motion for a key - #5978

Merged
max-sixty merged 21 commits into
mainfrom
fix-mac-only-tests
Nov 14, 2026
Merged

max-sixty merged 21 commits into
mainfrom
fix-mac-only-tests

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Fixes the causes of 17 tests that fail only in the nightly test-macos job. Most of them reproduce on a Mac when the suite runs on the efficiency cores (taskpolicy -b), which tests/AGENTS.md now says. Each fix below rests on a page-side trace of the cause, and on a before/after run under the condition that reproduced it.

Runtime. After a t, box-motion can carry the card's list over from where the previous card was drawn, which may be off screen. A T pressed while the list is still moving should act on the card. But focusPlace recognised motion only from transform/translate keyframes, never box-motion's --lf-box-carry, so the key let go of the card and T reopened the thread the user was on. slides() now counts the carry. A new test holds the carry for 600s and fails without the clause. A user on a slow machine can hit this one.

Test infrastructure. Firefox's own smooth scroll follows the host's reduced-motion setting, which Playwright's reduced_motion emulation doesn't cover. With ui.prefersReducedMotion=1, all three of the runner's Firefox smooth-scroll failures reproduce with its exact readings. The suite's Firefox, and leaf-dev's, now launch with the pref at 0.

Tests. Every other test raced its own setup:

  • a click inside a card's 300ms reveal;
  • a script scroll before a queued caret reveal or a place restore had run;
  • a key or read before a resize's placement had run;
  • a status read before the reading that answers it;
  • a page move inside the shift watch's credited frame;
  • a refocus faster than the runtime records focus leaving;
  • a click onto a hover preview;
  • a cleanup that pressed close on a card already fading out;
  • a frame count on a glide whose length is fixed in time.

The merge film's unchanged data-lf-more-below write also reproduces on efficiency cores, and stays open. Within one script, reach.js paints the cue, then a composition's after restore scrolls the terminal to its end, and the cue paints again. The zoomed-draft ResizeObserver loop no longer reproduces since #5846.

Closes #5134. Closes #5188. Ref #5711, #5744, #5780, #5921, #5942, #5950.

Asked for by max-sixty. pnpm run check passes, and so does each changed test, by node id and in leaf-dev flake.

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

…icking Reply

The answer's arrival reveals the card's foot with a 300ms clip-path reveal,
and a press on the clipped part of the reply box hit-tests to the thread.
On a fast Mac the click landed inside the reveal; Playwright saw the thread
intercept it, and its retry scrolled the box into view with
scrollIntoView({block: 'end'}), moving the page 460px, so the card read 612px
where the test expected 152px. A user can't press what the clip hasn't drawn,
so the page is right; the test now waits for the card to rest
(restingIn), as it already does before its later reads.

Fails 2 of 2 locally on macOS before; 18 of 18 copies pass after.
…ing itself under CSS zoom

A card that has stood keeps its width by pinning min-width and max-width to
the client width it stood at, divided by its positioning scale and rounded
to 1/64px by layoutPx. Under a CSS zoom, layout resolves the zoomed length,
so rounding the local length at 1/64px lays the card out 1/64px off the
width it was read from. Under html zoom 1.25 each pin shrank the card by
1/64px inside its own ResizeObserver delivery, and every fresh placement
unpinned it again, so the page reported 'ResizeObserver loop completed with
undelivered notifications' (test_a_zoomed_floating_draft_and_sent_comment_fit_a_narrow_window,
macOS-only because macOS font metrics give a width that rounds wrong).

layoutPx takes an optional zoom and rounds the zoomed length; the card
passes its currentCSSZoom for both pins. Measured over 399 text widths at
zoom 1.25, the old rounding missed the box's width for 41% in Chromium and
18% in Firefox, and the zoomed rounding for none in either.

The zoomed-draft test fails 3 of 3 locally on macOS before; 18 of 18 copies
pass after.
…it to its top

Forty lines grow the comment field to its cap, and that resize queues one
more reveal of the caret at the field's end, which CodeMirror runs at its
next measure. The test scrolled the field to its top before that measure, so
the scroll event ran it, the reveal scrolled the field back to its end, and
the wheel that should scroll the field chained to the page instead. Traced:
the test's scrollTop = 0, then setScroll(top 695) from text-field.js's
size-observer measure, called from CodeMirror's onScroll.

On this Mac the race hit about one serial run in three, and every nightly
macOS run since Nov 11; rendered() after the write drains the queued reveal.
0 of 15 serial runs and 18 of 18 flake copies fail after.
…ontexts do

Playwright's context emulates prefers-reduced-motion: no-preference for the
page's media queries, but Firefox's own smooth scroll reads the host's
setting. On a host asking for reduced motion, a smooth scroll lands in one
step while the page reads no preference, so a test that needs a scroll under
way never gets one. The nightly macOS runner failed three Firefox cases this
way: smooth-reply-above-firefox and smooth-revision-above-firefox on every
run since Nov 7, and
test_a_landing_that_moves_nothing_stops_a_scroll_still_under_way[firefox_browser]
on three of the last four. Launching Firefox with ui.prefersReducedMotion=1
on this Mac reproduces all three with the runner's exact readings
([300, 570], [300, 495], 7653).

The suite's Firefox and leaf-dev's Firefox engine now launch with
ui.prefersReducedMotion=0 (leaf_dev.browser.FIREFOX_PREFS).
…not two

The glide runs for a fixed 140ms (scrolling.js, SCROLL_MS), so how many
frames show it depends on the frame rate. The nightly macOS runner draws
one frame inside it ([0, 2007, 2317, …] on Nov 14, [0, 1490, 2317, …] on
Nov 13), which the three-position assertion read as a missing glide. A jump
still fails: it shows the destination alone.
The search status says "1 of 1" as the search finds the match, and the
marks over each piece's words follow a frame or two later as their boxes
are placed: traced on this Mac, the status at 454ms, the first mark at 463ms
and the second at 495ms. The test read the marks once, right after the
status, so a slower runner read [1, 0] (nightly macOS, Nov 14). It now waits
for rendered() first.
… its box

test_an_edit_above_the_paragraph_read_holds_it_with_the_reply_box_scrolled_away
failed on 3 of the last 4 nightly macOS runs with the reply box back in view,
its precondition. CodeMirror reveals a typed edit's caret in its next measure,
an animation frame later, through Leaf's reveal (editor-view.js). The test
scrolled away by script in the next two driver calls, about 10 ms after
typing, and on the macOS runner that frame came later still, so the reveal
ran after the scroll and brought the box back to the band above the panel,
371 px down. A page-side trace with the frame held across the scroll shows
that write (scrollIntoView from editor-view.js:163 inside CodeMirror's
measure) and reproduces the CI screenshot pixel for pixel.

The test now waits for the edit's rendering, as its sibling test did in
#4977, before the scroll that stands in for the user's. No product behavior
changes. A scroll made within one frame of a keystroke still loses to that
keystroke's reveal; a person's scroll after typing comes later than that
unless the machine's frames lag far behind its input.
test_new_rail_keeps_a_pin_reachable failed on 3 of the last 4 nightly macOS
runs in its cleanup, after every assertion had passed: it pressed the close
button of a card its own Escape had already closed. A closed card fades out
for 120 ms, inert, before it hides (thread-preview.js, `close`), and
Playwright counts it visible meanwhile, so `card.is_visible()` read the
fading card as open; the card hid under the click, which then waited 120 s
for a button that was gone. On the macOS runner the cleanup reached that
check inside the fade; pausing the fade at its start reproduces the failure
in both subtests.

`put_card_away` now owns the step for this test and for
test_a_card_is_one_press_to_leave_however_it_came_to_its_thread, which had
the same check: it presses close only on a card that isn't inert, then waits
for the card to be hidden. No product behavior changes.
…he walk reached

The thread walk (`t`, `T`) focuses the card it reaches, and box-motion.js can
carry the card's list from where the old thread's card was drawn to the new
one's place. Walking back from the figure's thread to the first, that old place
lies below the window once the page has scrolled up, so for the length of the
carry the focused thread and its reply box are drawn there. `focusPlace`
(user-place.js) counts a key pressed while a motion carries the user to their
stop as meant for the stop, but it recognised a motion only by keyframes naming
`transform` or `translate`, and box-motion moves a part through its registered
`--lf-box-carry`, which the part's `translate` reads. So the keyboard let go of
the card first, and the walk started from the card it had just left: `T` opened
thread 1 again instead of stepping back to thread 3.

box-motion.js now exports the property as `CARRY`, and `carried` counts an
animation of it as a motion carrying the node.

This is why `test_the_page_marks_the_comment_the_user_is_located_in` failed on
the nightly macOS job (Nov 7 and Nov 14). Page-side traces of its steps under
`taskpolicy -b` caught the failing `T` each time: the controller let go
(`focusPlace` null) with the page at rest, the card at 471-609 px and its reply
box at 1173-1203 px while the carry ran. The carry ran in the failing runs and
in none of the passing traces from an idle machine; box-motion takes a change as
the user's, and so carries it, while the key's rendering is still settling
("Whose change it is"), which is presumably why it shows on slow machines, where
a user pressing `T` soon after `t` meets the same misstep. A probe that holds a
carry mid-flight and presses `T` reopens thread 1 on main and reaches thread 3
here. `leaf-dev flake` under `taskpolicy -b`: 3 of 18 copies failed on main, 0
of 18 here.
…s back

`test_any_focus_on_a_note_rings_its_block_and_follows_it_redrawn` focuses a
block's comment note by script after a click, presses Tab, which takes focus
out of the page, and focuses the note again, so that arrival is the keyboard's:
the margin opens the note's card and traces its block. focus.js reads a
departure for nowhere a task after its `focusout`, so a window losing focus is
not taken for one, and a focus that comes back to the same node before that
reading is no change, which `publish` drops. Under load the scripted focus came
first, the margin heard no arrival, and the block never wore the trace: 3 of
the last 4 nightly macOS runs, and 1 of 4 runs here under `taskpolicy -b`, where
a page-side trace shows the note's `focusin` before the departure's reading and
no margin reading after it. Blurring and refocusing the note in one task
reproduces it every time. Only script or assistive technology can put focus
back that fast, so the runtime's reading stands; the test now waits for the
ring to come off the block, which that reading paints, before focusing the note
again. The behavior the test protects is unchanged.

`leaf-dev flake` under `taskpolicy -b`: 13 of 18 copies failed before, 0 of 18 now.
…e below it

`test_marked_words_are_seen_and_told_apart` rests the pointer on one marked
passage, captures its paint, and then presses the marked passage on the next
line to open its thread. A pointer resting on a mark shows its preview after a
200 ms dwell (preview.js), standing below the line, over that next passage, and
a press there lands on the preview, which puts it away and opens nothing. On
Linux CI each capture's screenshot takes about 31 ms, so the press beat the
dwell; on the macOS runner about 190 ms, so the preview stood first, and the
test waited out its 120 s for a thread that never opened (Nov 14). Here under
`taskpolicy -b`, 4 of 4 runs pressed `.lf-preview-detail`. The test now takes
the pointer off the passage and waits for the preview to go before the press,
as `preview_parts` does. The paint each state is checked for is unchanged.

`leaf-dev flake` under `taskpolicy -b`: 16 of 18 copies failed before, 0 of 18 now.
…e source

test_primary_arrival_records_a_return_place_only_when_travelling shrank the
window with a bare set_viewport_size and scrolled to its source at once. The
short window moves the package workspace's reading regions, and the page puts
back the place it recorded before the move on the next frame
(version.js, restoreShifted). Where that frame came after the test's scroll,
the restore took the page back to 0: the contextual cases then found the
thread's passage already shown, so the trip pushed no return stop
(history.length 2 where 3 was expected), and the primary cases ended at
scrollY 0. A page-side trace on efficiency cores shows the scrollTo(0) from
restoreShifted after the test's scroll to 1000. A reader's own scroll is a
choice restoreShifted keeps; the test's script scroll isn't.

The test now resizes with resized() and waits for rendered() before it
scrolls. On efficiency cores (taskpolicy -b) the [False-True-1000-False-True]
case failed 2, 9 and 2 of 18 flake copies before, and it and
[True-True-200-False-False] pass 18 of 18 after.
# Conflicts:
#	browser/runtime/annotation-overlay/thread-preview.js
#	browser/runtime/user-place.js
#	tests/browser/test_render_anchors.py
…ect drawing

`test_drawing_preview_contains_page_content_and_freezes_it[light-False]`
narrows the window from 1280px to 390px, focuses the composer's "Inspect
drawing" button and presses Enter. `set_viewport_size` returns before
the page has handled the resize: the `resize` event fires in the page's
next rendering update, and the composer is placed for the new window in
the updates after that. When the driver got there first, as on the
macOS runner and on a Mac's efficiency cores, the focus landed on the
button where the 1280px window had put it, outside the 390px window, and
scrolled the root sideways to its end. The Enter then reached a focused
control the user cannot see, which the keyboard controller lets go of
(`focusPlace`, `letGo`), so the image viewer never opened.

A page-side trace of two failing copies under `taskpolicy -b` shows the
order: the Enter's keydown focuses `h1#title` and blurs the button, and
the page's first `resize` event arrives 15 to 25 ms later. Holding the
page's frame callbacks until after the Enter reproduces the failure on
every run. The macOS failure screenshot shows the same sideways-scrolled
layout.

The product behaves as designed. Only a script can focus a control and
press a key between a resize and the page's next rendering update, and a
key pressed there acts from what the window shows. The test now waits
for `rendered(page)` after the resize, as the other drawing tests do, so
it presses the button where the narrow window places it. No product code
changes.

Under `taskpolicy -b uv run leaf-dev flake`, the old test failed 14 of
18 copies with the macOS message; with this change it passes all 18.
…ick's send

`test_obligations_sharing_context_keep_their_source_identity` read the
first obligation's status right after `round_trip`, and the nightly
macOS job failed it on Nov 14 with `'open' == 'answered'`.

Whether a pick answers an obligation is a fact of the server's reading
(root AGENTS.md, "Responsiveness"). The outbox clears the pick's attempt
as soon as the POST's answer arrives, and the page applies the reading
that answer carries in later tasks: `applyState` first waits for the
frame that paints the gesture (`afterOwedFrame`). `round_trip` waits only
for the attempt to clear. A page-side trace of a run under
`taskpolicy -b` shows the ledger reading heard-back at 6837 ms with the
status still `open`, `round_trip` returning at 6849 ms, and the status
turning `answered` at 6949 ms. The user sees the pick at once and the
obligation answered when the reading lands, as designed; only the test
read too early.

The test now waits for that reading with `expect_obligations_answered`,
after each pick. No product behavior changes.
…dering

`test_an_input_owns_the_landing_of_a_widget_preparation_it_began` failed
on the nightly macOS job on Nov 8, 9, 11 and 14. It opens a diff file,
holds the markdown grammar, moves `#control` by script and expects a
`moved-without-input` report; the watch reported nothing.

The shift watch credits a press with every frame up to the first one
whose tick reads the runtime's loop settled, since that frame's own
callbacks may still answer the input. The test moved the control as soon
as `rendered` had read `updatesSettled`, which can come before that frame
paints. A page-side trace of a failing run under `taskpolicy -b`, where
frames often came more than 100 ms apart: the ticks at 4326, 4400 and
4511 ms read the loop unsettled, the move came at 4562 ms, and the tick
at 4628 ms was the first to read it settled. That tick extended the
press's rendering through 4628 ms, so the shift painted in that frame
was the press's. In passing runs the move came after the watch had
closed the rendering. Holding the watch's frame ticks while the runtime
settles reproduces the failure on every run. Leaf moved nothing here and
the watch followed its own rule; the test's setup raced the watch's next
frame. The trace shows the credit coming from the press's rendering, not
from #5638's popover anchor credit.

The watch now exposes `lfInputRenderingOpen()`, and the test waits for
it to read false before each move it makes, so the move paints after the
press's rendering has closed. The watch's header and tests/AGENTS.md say
so for the next test that moves the page after an input. No product
behavior changes.
The fix in df830ea (box-motion's --lf-box-carry counts as motion in
user-place.js's slides()) was covered only by a test that hits a running
carry on slow machines. This one sets the card's --lf-motion-box-resize to
600s, walks t, t down a long page and presses Shift+T while the card's list
is still carried in from above the window: T steps back to the first thread.
With the CARRY clause removed it fails (the key lets go of the card and the
walk reopens the thread it left); with it, 18 of 18 flake copies pass.
…er failures

taskpolicy -b runs a test, its server and every engine on the Mac's
efficiency cores. It reproduced ten failures only the nightly test-macos job
had shown (primary arrival, three comment-mark tests, the drawing preview,
the framed page, the shift watch's preparation landing, the obligation walk,
mark churn and the merge film's cue), where --cpu-throttle 8 reproduced none
of the twenty it was tried on.
test_a_commented_block_says_so_to_a_screen_user watches #p1 for mutations
right after pressing Enter on its note and expects a poll that changes
nothing to write nothing. On efficiency cores the Enter's own repaint, which
takes the margin's trace (data-lf-traced) off the block once focus has moved
into the card, landed after the watch started: the one mutation the test
counted was that removal. It now waits for rendered() first.

On efficiency cores (taskpolicy -b) 12 of 18 flake copies failed before and
18 of 18 pass after.
leaf-agent
leaf-agent previously approved these changes Nov 14, 2026
Comment thread browser/runtime/box-motion.js Resolved
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.

Primary arrival does not add the expected history entry Tall-target comment never reaches its expected viewport state

2 participants