Skip to content

test_new_reply_leads_to_the_reply_once_one_follows_the_work: shift watch doesn't credit the thread view's 1 px carry #6553

Closed

Description

@leaf-agent

tests/browser/test_render_floating_panel.py::test_new_reply_leads_to_the_reply_once_one_follows_the_work errored at teardown in run 44626119467 (2d6e1f69d). The test body passed, but the shift watch reported the thread view's latest message moving up 1 px with no input:

div.lf-msg-head moved without input by (0, -1)px
#text in b in div.lf-msg-head moved without input by (0, -1)px
#text in span in time in span.lf-msg-meta moved without input by (0, -1)px
#text in p in div.lf-msg-text moved without input by (0, -1)px

Every node's residual equals the motion of a translate on its ancestor div.lf-fp-messages.lf-fp-outlet. The watch records that translate as a box-motion carry (carry: true, owned: false, ended: null), which began at 3092 ms and went from 0px 1.02365px at the comparison's before reading (3398 ms) to 0px 0.0216777px at its after reading (3658 ms). This matches the ride #6382 added, which carries an arriving answer into the thread view. Nonetheless animation_credit is 0 and scroll_terms is empty. Each node's layout equals its drawn rect, so the watch did not net the carry out of either reading. In other words, the carry drew the outlet the last pixel toward its layout, and the sensor didn't credit it. According to the carriesWithin rule in the tests/shift_watch.js header, a node "first read in the step or after rides a carry only as far as one draws a node read before it". My unconfirmed guess is that on CI's slower runner, the message nodes were first read after the carry began, so neither the credit nor the resting-layout netting applied.

The only commit between this run and the previous run (which passed this test) is #6542, a pre.terminal rule in the reading package's CSS. It doesn't touch the panel.

Not reproduced locally on 72535c1c4 (which contains 2d6e1f69d) with leaf-dev suite flake: 12 of 12 passed plain, 12 of 12 at --cpu-throttle 8, and 12 of 12 at --cpu-throttle 16 --load 2. The next step is to instrument the watch's carriesWithin and resting decisions for these nodes in a throttled run, or read the run's pytest-results-* artifact, to learn whether the nodes were first read inside the carry. After that, decide whether the watch should credit a carry seen only mid-flight, or whether the ride really draws a pixel the user would see as motion.

Cause of a failure tracked in #6418.

Activity

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

    @leaf-agent
    CollaboratorAuthor

    Still unreproduced, but one fact narrows it: the carry in the evidence can't be a single 300 ms effect that began at 3092 ms. Box carries run for --lf-motion-box-resize, 300 ms (chrome.css L140), and that ease leaves almost nothing in its last tenth. Yet at 3398 ms, 306 ms after the recorded began, the outlet was still drawn 1.02 px off and reached 0.02 px only at 3658 ms. So the effect that drew the motion started well after 3092 ms. There are two ways the watch can record an earlier began than that:

    • began is taken when animate() is called (shift_watch.js L1296), not at the effect's startTime. On a starved main thread a pending play can start hundreds of ms later.
    • A re-timed continuation copies the cancelled effect's beganAt (L1576), while beginsOwned gives the replacement its own carrySteps entry with a later began and step. carriesWithin reads the step through carrySteps.get(continued(animation)), so it would pick its "reading before the step" from the replacement's later frame. The evidence's began would still say 3092. In CI, the reply's step or the press's rendering landing mid-carry would produce exactly this.

    Either way, the reply's message nodes may have been first read inside the original carry. That sends them down the rides() path, which credits them only when the carry's target (the outlet) has its own readings before the step and passes carriesWithin itself.

    What ran locally and what it showed

    On 72535c1c4, which has the same shift_watch.js and chrome.css as the failing 2d6e1f69d:

    • leaf-dev suite flake passed every run: 12/12 at --cpu-throttle 6, and 24/24 at --copies 24 --workers 6 --load 3 --cpu-throttle 4.
    • With carriesWithin instrumented, a plain run and throttle 8 and 16 runs each saw one carry. Every call returned true. The reply's and press's nodes went through the index < 0 and "reading already holds the step" branches, both of which call rides(). So locally rides() does credit these nodes. The CI timing is what differs: the carry is still running, or re-timed, when the run that teardown judges begins.
    • Stretching the carry to 1.5 s or 3 s (--lf-motion-box-resize overridden in the test) makes the teardown fail every time, with a much larger uncredited carry. The panel's head controls and the latest message move 112 px and 310 px, carry: true, animation_credit 0. In that run carriesWithin never returned false. Its began (3118.5) differed from the evidence's began (3113 and 3117), and the evidence's before sample was none, so the credit was lost to an empty carried.terms rather than to carriesWithin. This is an artificial timing and may be a different shape from CI's. It does show that the watch records a carry's began and its carrySteps.began differently once carries overlap.

    The next experiment is to log, for each carry, beganAt, the carrySteps entry and animation.startTime, then rerun the stretched-carry case. That shows whether the overlap re-times the carry (the second explanation) or the start is only delayed (the first). If it is the re-timing, the fix belongs in the watch: a continuation should take over its cancelled carry's carrySteps entry the way it takes beganAt and rendering ownership in continueMotion. If the stretched case shows motion a user would see, that decision belongs to the ride from #6382 instead.

  3. leaf-agent commented on Nov 21, 2026

    @leaf-agent
    CollaboratorAuthor

    It was the re-timing, and the fix is in #6649. When box-motion cancels a running carry and continues it, the replacement kept the original's beganAt but got its own carrySteps entry, dated at the re-time. carriesWithin judged against that later step. On a stretched run, the original carry recorded {began: 3180, step: 3128} and the replacement {began: 3595, step: 3481}. Every uncredited comparison carried terms but failed carriesWithin against the replacement's step. The replacement now keeps the cancelled carry's step whenever it is a carry too.

    #6649 adds test_a_reply_that_lands_mid_carry_continues_it, which stretches the carry so the second message always lands inside it. It fails on the old watch (110 px uncredited) and passes with the fix. The CI case's 1 px residual matches this signature, but it was never replayed at its own timing. If it comes back, it will arrive as a new report. CI and landing on #6649 are with tend-land.

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