Skip to content

test_a_website_turn_posts_its_answer_when_the_move_is_settled_first[here]: the panel's Back button moves 77 px without input on macOS #6609

Closed

Description

@leaf-agent

tests/journeys/test_website_server.py::test_a_website_turn_posts_its_answer_when_the_move_is_settled_first[here] errors at teardown on macOS (render_harness.py:1552): …/versions/v1.html: button.lf-icon-action.lf-fp-back.lf-ui.lf-ui-face moved without input by (0, 77)px; the same frame moved leaf-floating-panel.lf-ui.lf-floating-panel, svg.lf-action-icon.

It shows in 1 of 18 copies on main (d714c2e60, run) and in 1 of 18 on #6608's branch (run), both on CI's Mac with --workers 1 --load 4. #6608 changes only when the test reads a box, so this finding doesn't come from it. No scheduled run has shown it yet.

The thread view's Back button jumps 77 px in one frame with no user input, and the whole floating panel moves in the same frame. That fits the panel's box changing height when a server write (the turn's working step, the Gone quiet receipt or the resolve) arrives, without the glide that normally carries the change. The next step is the frame's full report (the [+20 more lines] in the copy's log, in the run's pytest-results-test-macos-* artifact) to see which write moved it.

Cause of a failure tracked in #4225.

Activity

  1. added
    tend-ci-cause
    on Nov 20, 2026
  2. leaf-agent commented on Nov 20, 2026

    @leaf-agent
    CollaboratorAuthor

    The frame's full report narrows where the 77 px move happens, but it doesn't yet show which write causes it. The issue stays open for the next experiment below.

    What the reports show. The failing copy on main (run, copy 05) and the one on #6608's branch (run, copy 17) carry the same signature:

    • The move happens about 2.5 s after the reload, while the new thread's name still reads "Generating thread name…" (span.lf-thread-name-pending is among the moved nodes). That puts it in the send that opens the thread, before turn.begin(). The later server writes this issue guessed at (the working step, Gone quiet, the resolve) don't fit.
    • Everything in the thread view moves down by exactly 77 px in one painted frame: the head's Back, Resolve and Close, the user's message head and words, and the panel itself. No scroll or animation accounts for it, and no carry covers that frame.
    • About 80 ms later, box-motion starts carries on div.lf-fp-head and div.lf-fp-messages with translate: 0px 77px. The drawn rects still stand at the moved place (723 → 800). So it looks as though the layout returned to its earlier height and the carry is gliding back from the dropped position. I take this from the carry's sign and the rects; the report doesn't state it.
    • Read that way, the view loses about one message's height (the user's message head is at 765 and its words at 799) for one rendering, and regains it on the next. Box-motion carries the regain but not the loss.

    Local reproduction. On a 4-core Linux sandbox, leaf-dev suite flake with 12 copies, --workers 2 --load 2 --cpu-throttle 4 passed all 12. So far only the Mac runner shows it.

    Next experiment. Dispatch ci with flake on macOS on a branch that adds a frame-by-frame record of the thread view's children (keys and heights) around the send. That would show which child leaves for a frame, for example the tab's own sent message being dropped before the server's reading of it draws. It would also show why box-motion reads no change on the frame where it leaves. A plain dispatch would only reproduce the 1-in-18 failure again without telling the writes apart.

  3. added 2 commits that reference this issue on Nov 21, 2026
  4. leaf-agent commented on Nov 21, 2026

    @leaf-agent
    CollaboratorAuthor

    The frame records place this failure in the test's shift watch, not in a 77 px move the page paints. In each failing copy whose readings were logged, box-motion carries the working step's growth from the first frame that draws it. The issue stays open for the watch fix described below.

    What the page does. I ran the test 3 × 54 times on CI's Mac (--workers 1 --load 4) on exp/6609-frames. That branch adds a per-frame record of the panel, a log of each boxMotion reading, Chrome's layout-shift entries, and a sample taken after each frame. 4 of the 162 copies failed: runs 44876550449 (copies 24 and 46), 44880045297 (copy 40) and 44882966907 (copy 48).

    • The 77 px is the working step "Looking at the page." joining the transcript after turn.begin(). It grows the thread view by one row (53 px plus the gap), so the open part of the bottom-anchored panel rises from 715 to 638.
    • Exactly one frame callback runs between the insertion and box-motion's reading, in each of the 108 copies of the last two runs, which log those readings. That reading comes in the same frame's size delivery.
    • In the two failing copies whose box-motion readings were logged (40 and 48), and in 61 passing ones, no gesture is under way at that reading (theirs() is null), so box-motion starts the carry from 715. In copy 48, the sample taken after that frame painted shows the Back button at 723, where it stood before, carried by translate: 0px 77px. The glide-back the earlier comment inferred is this ordinary carry of news.
    • In the other 45 copies, the reading falls while the rendering of the typed "While you look" is still open, about 200 ms after the last key. Box-motion's typing rule then draws the growth at once, and the watch credits it to typing, so those copies pass. That is the documented rule (box-motion.js, "News landing before the gesture's rendering settles … is taken as theirs"), but on a loaded machine it makes the panel jump for news that arrived well after the key.

    What the watch does. Chrome reports the step as a layout-shift entry about 1–2 ms after the insertion. That is before the next frame, which in copy 48 ran its callbacks 66 ms later. So the entry comes from a lifecycle update that painted nothing. Locally, document.elementFromPoint right after a DOM change produces such an entry, stamped before the frame. When the entry arrives before that frame, the watch treats it as a paint:

    • received takes a reading for it (L4660). That reading shows the grown layout, because the carry hasn't begun yet. In copy 48 the reading is at 2269 ms, and the carry begins at 2311 ms.
    • judge credits only the carries that began by the time of that reading, so it credits none. Copy 48's findings carry paint_at 2239.1, which is the entry's own startTime.
    • carriesWithin also steps back over only one reading that already holds the step. With the extra reading there are two, so its "before" is already the grown layout.

    Copy 40 failed through the other path (paint_at is the next reading, not an entry), with the same extra reading at 2274 ms. On a loaded runner the entry's task often runs before the delayed frame, which explains why only some copies fail.

    Next step. Fix this in tests/shift_watch.js, not in the runtime: a layout-shift entry stamped between two frames is not a paint, so the carry begun in the next frame's size delivery has to count for it. Neither change I tried locally reproduces the failure yet. In test_render_shift_watch.py::test_a_carry_draws_the_way_of_a_step_news_may_take, I added a hit test right after the append, then the same with the frame delayed 60 ms. The entry arrived early both times, and the watch still passed. The next experiment is that test with the watch's received reading forced in before the frame, so the fix has a red test to turn green.

    Copy 48's timeline (ms since reload)
    2237.4  working step inserted into div.lf-thread-transcript
    2239.1  layout-shift entry: leaf-floating-panel 715 → 638  (no frame yet)
    2269.3  watch reading (first one that holds the working step)
    2303.5  frame callbacks run for the frame stamped 2234.1
    2310.7  boxMotion reading: gesture null, from 715 to 638 → carry
    2311.8  carry begins on div.lf-fp-head, div.lf-fp-messages (translate 0 77px)
    2327.3  sample after that frame: Back at 723, head translate 0px 77px
    2463.8  sample: Back at 677, translate 30.6px … settles at 646
    

    Each copy's record is frames-here.txt in its copy-NN-screens directory of the run's pytest-results-test-macos-* artifact.

  5. leaf-agent commented on Nov 22, 2026

    @leaf-agent
    CollaboratorAuthor

    Fixed by #6729, which max-sixty merged. The shift watch's carriesWithin read where the step put a node at the carry's first animation sample. That sample can come from a read that reads no nodes, such as the cancel that re-times a carry, so the node's ledger still held it before the carry drew, and the watch refused box-motion's carry. It now reads the landing at the node's first reading once the carry drew.

    Verification:

    • Logged inputs on CI's Mac (run 44995326673, 1 of 54 copies failed): landed was 569 against the held 646 for a 77 px carry, so the comparison started from the grown layout.
    • Local regression test: the new retimed case of test_a_carry_draws_the_way_of_a_step_news_may_take fails on the old watch 3 of 3 runs and passes with the fix.
    • The journey test on the fix branch: a 54-copy macOS flake dispatch (run 45000174715, --workers 1 --load 4) passed every copy, where main had failed 1 in 54 and 4 of 162 before.

    The earlier comment's theory that received's early reading needed a fix of its own turned out to be wrong: that reading only exposed the bad landing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tend-ci-cause

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions