Skip to content

test: keep a carry's first step when the shift watch sees box-motion re-time it - #6649

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-6553
Nov 21, 2026
Merged

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

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

When box-motion re-times a running carry (it cancels it and begins a replacement from where it was drawn, as when a second message lands in the thread view mid-carry), the shift watch now keeps the cancelled carry's step on the replacement. Before this change, continueMotion handed the replacement the cancelled carry's ledger, beginning and owners, and then beginsOwned gave it a fresh carrySteps entry dated at the re-time. carriesWithin reads that entry, so it judged the whole trajectory against a mid-carry reading instead of the reading before the step that began it. It then refused the credit, and the run comparison reported the thread view's head and messages as "moved without input".

The new test test_a_reply_that_lands_mid_carry_continues_it stretches the thread view's --lf-motion-box-resize to 1500 ms so the second message always lands inside the first carry. On the old watch it fails every run (button.lf-fp-back … moved without input by (0, 110)px); with this change it passes. Instrumenting the old watch on that run showed the mechanism directly: the original carry was entered as {began: 3180, step: 3128}, the replacement as {began: 3595, step: 3481}, and every uncredited comparison had carry terms but failed carriesWithin against the replacement's entry.

The CI failure in #6553 (1 px, test_new_reply_leads_to_the_reply_once_one_follows_the_work) has the same signature: its carry was still 1 px off 306 ms after its recorded began, which a single 300 ms carry can't produce, so it had been re-timed. That run wasn't reproduced at its original timing, so the link to the CI failure is inferred from the evidence rather than replayed.

Checks run
  • The new test and test_new_reply_leads_to_the_reply_once_one_follows_the_work and test_a_streaming_answer_grows_the_view_until_it_outgrows_its_cap, 3 runs each: all pass.
  • tests/browser/test_render_shift_watch.py -k "carr or cancel or continu or replac or replay or news or step or ride or resum or revers": 95 passed.
  • pre-commit on both files: clean.

Closes #6553 — automated triage

When box-motion cancels a running carry and begins a replacement from where it
was drawn, as when a second message lands in the thread view mid-carry, the
shift watch's continueMotion gave the replacement the cancelled carry's ledger,
beginning and owners, but beginsOwned then gave it a carrySteps entry of its
own, dated at the re-time. carriesWithin read that entry, so it judged the one
trajectory against a mid-carry reading instead of the reading before the step
that began it, and the run comparison found the thread view's head and
messages moved without input. The replacement now keeps the cancelled carry's
step whenever it is itself a carry.

New test: test_a_reply_that_lands_mid_carry_continues_it stretches the thread
view's carry to 1500 ms so the second message always lands in it. It fails on
the old watch (the back button and messages "moved without input by (0, 110)px")
and passes with this change.

Closes #6553
@leaf-agent
leaf-agent merged commit 84db652 into main Nov 21, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6553 branch November 21, 2026 07:00
max-sixty pushed a commit that referenced this pull request Nov 22, 2026
…ding in the shift watch (#6729)

The shift watch refused box-motion's carry of the thread view's growth
when the carry's first animation sample came from a read that reads no
nodes. It then reported the panel's head and messages as "moved without
input" by the whole step. This is the 1-in-40 failure of
`test_a_website_turn_posts_its_answer_when_the_move_is_settled_first[here]`
on CI's Mac. `carriesWithin` now reads where the step put the node at
the node's first reading once the carry drew, instead of at the carry's
first sample.

**Cause.** When the last reading before a carry already holds the layout
step, `carriesWithin` steps back one reading to find where the node
stood before it. It recognises that reading by comparing it with
`landed`: the node's layout at the carry's first sample
(`animated[1].at`), net of the carry. Some reads sample animations
without reading nodes, such as the cancel that re-times a carry
([`Animation.prototype.cancel`](https://github.com/max-sixty/leaf/blob/3da4a81ee84139cfa1e881780038fa0c2ead2a18/tests/shift_watch.js#L1473)).
When the first sample comes from one of those reads, the node's ledger
at that time still holds it where it stood before the carry drew. So
`landed` came out as the step less the carry, the held reading never
matched it, and the comparison started from the grown layout.

**Evidence.** A [macOS flake
run](https://github.com/max-sixty/leaf/actions/runs/44995326673) on main
plus logging (`exp/6609-carries`) failed 1 of 54 copies. For the Back
button it logged readings 723 → 646 → 723, carry began 1890.4, first
sample 1941.3, and the node's carried reading at 1942.9. That gives
`landed` 569 = 646 − 77, which doesn't match the held 646, so the carry
was refused. The same comparison with the landing read at 1942.9 gives
723 − 77 = 646, which matches.

**Test.** The new `retimed` case of
`test_a_carry_draws_the_way_of_a_step_news_may_take` cancels the carry
and begins it again in the delivery that began it. It fails on main 3 of
3 runs (`button#head` moved without input by (0, 40)) and passes with
the change. The other carry cases, including the faulted ones that must
still fail, and #6649's `test_a_reply_that_lands_mid_carry_continues_it`
pass (61 tests). Whether the journey test is clean on the Mac is left to
a 54-copy flake dispatch on this branch.

Closes #6609 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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_new_reply_leads_to_the_reply_once_one_follows_the_work: shift watch doesn't credit the thread view's 1 px carry

1 participant