Skip to content

fix: Credit the carries of a growing thread view in the shift watch - #7257

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-7180
Nov 26, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-7180

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

The thread view's "moved without input" teardown failures are false positives in the shift watch (tests/shift_watch.js). In both shapes in #7180, the watch misreads motion that dom/box-motion.js draws correctly, so the user sees nothing move. The change is to the watch and its tests. On a 4-core runner, test_an_answer_the_user_waits_for_grows_the_view_up_to_its_cap failed 14 of 48 copies run four at a time before this change, and passes 48 of 48 after it (and 24 of 24 again at this head).

New reply shape (lf-new-reply … moved without input by (0, 22–92)px). When news grows the view, streamContent carries the outlet down 318 px and slides it back. It also moves each sticky box's inset against that carry on the same clock, so the stuck .lf-awaited that holds New reply stays at its line. A per-frame log showed New reply at y=798 throughout, with bottom animating 308px → 0 beside the outlet's translate of 318px → 0. The watch credited the outlet's translate to New reply. It did not credit the inset effect, which no rendering owned and which is not a carry. So it reported the translate as a move. The watch now credits an inset effect on a sticky box inside a running carry, beside that carry (countersCarry). It seeds the effect's reading from before it began, as it already does for a carry, and underlying now records right and bottom with left and top. The existing stickyInsetMotion still bounds that credit.

Whole-panel shape (lf-fp-back … (0, 318)px; the same frame moved leaf-floating-panel). The watch's y=146 reading was never painted. The long answer is inserted in a state-feed.js task. The next frame's rAF callbacks, the watch's tick among them, then read the grown layout before any carry exists. The same frame's ResizeObserver delivery (fit → followBox → follow) starts the head's carry from 318 px before that frame paints, so the head stays at y=464 on screen and slides up. The watch did not credit that carry: a widget preparation's landing was still open, which news had already sealed (told, set when data-lf-reading changes). beginsOwned lets an effect count as a carry once news has sealed the open input rendering, but it refused while any landing was open, sealed or not. Sealed landings no longer block a carry, matching the rule for the open rendering. A carry that starts a frame after its step paints still fails (a-frame-late arm below).

Verification
  • New tests in tests/browser/test_render_shift_watch.py:
    • test_a_stuck_foot_holds_its_line_through_a_carry_of_what_holds_it: the countered arm fails on main's watch and passes here. Its two fault arms still fail on both: a stuck box left to ride the carry, and an inset moved with no carry under it.
    • test_a_carry_news_begins_after_it_seals_a_landing_carries_its_step[in-its-frame]: fails on main's watch and passes here. It asserts that the landing was still open when news sealed it.
    • …[a-frame-late]: begins the same carry two frames after the port grows, so a frame paints the head at its risen place before the carry draws it back down. The watch reports the head's move.
  • 143 watch tests passed: pytest tests/browser/test_render_shift_watch.py -k "carry or carries or landing or preparation or sticky or news or rides or inset or animation or transition or translat". They include test_a_carry_a_landing_s_own_layout_begins_is_the_input_s_though_news_lands, which covers a carry begun before news.
  • 11 floating-panel browser tests passed: -k "grow or answer or stream or new_reply or covers".
  • Reproduction: uv run leaf-dev suite flake --copies 24 --workers 4 'tests/journeys/test_render_floating_panel.py::test_an_answer_the_user_waits_for_grows_the_view_up_to_its_cap'.
Per-frame trace of the whole-panel failure

Recorded with temporary instrumentation in the journey (not committed): a rAF loop reading .lf-fp-back's top, a wrapper on Element.prototype.animate logging the head's carry with its stack and document.timeline.currentTime, a ResizeObserver on the panel created after the panel's own (so it delivers after follow's), and Chrome's long-animation-frame and layout-shift entries. Under suite flake --copies 24 --workers 4 four copies failed with the 318 px shape. One failing copy, times in ms:

what time head y
rAF, frame before the answer 7351.5 464
task Response.text.then (host/state-feed.js) inserts the answer 7362–7405 146 (layout, unpainted)
same frame: rAF callbacks, the watch's tick among them 7405–7474 146 (layout, unpainted)
same frame: style and layout 7474.5
same frame: ResizeObserverCallback → fit → followBox → follow starts --lf-box-carry: 0px 318px → 0 7477–7511 464 after the call
same frame: the trace's observer, made after the panel's, the last script before paint 7511.1 464
frame presented (LoAF end) 7511.9
next rAF 7501.4 (frame time) 464
following rAFs 185 → 156 → 146

All of it is one long-animation-frame entry (7362.1–7511.9), so nothing paints between the insertion and the carry. No error event fired, so no ResizeObserver delivery was skipped. All 32 copies of the earlier run, passing and failing, show the same order: the tick reads 146, and the same frame starts the carry and paints 464. So every copy has the unpainted 146 sample, and a copy fails where the watch denies the carry its credit.

The issue's two macOS-only findings did not reproduce on Linux: 24 of 24 copies of each passed under the same load. The macOS test_a_streaming_answer_grows_the_view_until_it_outgrows_its_cap finding has the same signature as the whole-panel shape, but nobody has shown it has the same cause. Nobody has reproduced the TypeError in test_an_open_view_covers_the_page_beneath_it, and its next failure in a scheduled test-macos run will bring it back to triage.

Closes #7180 — automated triage

…ce news seals a landing, in the shift watch

test_an_answer_the_user_waits_for_grows_the_view_up_to_its_cap failed 6 to 8 of
24 copies run four at a time on a 4-core runner, in two shapes, both from the
shift watch misreading motion dom/box-motion.js draws correctly:

- A news-begun ride moves each sticky box's inset against the carry, so a stuck
  New reply holds its line. The watch credited the outlet's translate to New
  reply but not the inset effect, which no rendering owned and which was no
  carry, and reported the difference as a move. It now credits an inset effect
  begun on a sticky box inside a running carry beside that carry, seeds its
  reading from before it began as a carry's is, and records `right` and `bottom`
  among the underlying insets.
- A preparation's landing still open when news arrived blocked any later effect
  from counting as a carry, even once news had sealed the landing (`told`), as
  it already does the open input rendering. The head's carry of the 318 px
  growth went uncredited. A sealed landing no longer blocks a carry.

Two new watch tests fail on the old watch and pass now; their fault arms (an
uncountered stuck box, an inset moved with no carry) still fail. The journey
passes 48 of 48 copies under the same load.

Refs #7180
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The sticky inset accounting has a controlled test and looks sound. The whole-panel arm still needs correction: #7180's frame trace reports the panel head painted at y=146 before the carry starts and at y=464 after it starts, a 318 px jump. This PR changes only the shift watch, so accepting a carry that starts after that layout step would hide the observed motion. Please keep that arm detectable and fix the carry timing in dom/box-motion.js, or provide a per-frame painted trace showing why those samples did not represent visible motion. The sticky inset change can stand alone.

This was written by Codex on behalf of max-sixty

…ews sealed a landing

The sealed-landing credit for a carry must not hide a carry that starts late. The
new `a-frame-late` arm begins the carry two frames after the port grows, so a frame
paints the head at its risen place and the carry draws it back down; the watch
reports the head's move.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

I went with the second option. A per-frame painted trace shows that the y=146 sample was never painted. The carry starts in the frame that first draws the grown layout, before that frame paints, so I left dom/box-motion.js as it is. I also added a fault arm that keeps a late carry detectable: test_a_carry_news_begins_after_it_seals_a_landing_carries_its_step[a-frame-late] begins the carry two frames after the port grows, and the watch still reports the head's move.

In one failing copy (times in ms), all of the following is one Chrome long-animation-frame entry, 7362.1–7511.9:

  1. A Response.text.then task in host/state-feed.js inserts the long answer (7362–7405). The layout now puts the head at 146.
  2. That frame's rAF callbacks run, the watch's tick among them, and read y=146 (7405–7474). No carry exists yet.
  3. The same frame's ResizeObserverCallback runs fit → followBox → follow, which starts --lf-box-carry: 0px 318px → 0 (7477). The head reads 464 right after.
  4. The last script before paint is an observer I created after the panel's. It reads 464 (7511.1).
  5. The frame is presented at 7511.9. The next rAF reads 464, then 185, 156 and 146 as the head slides up.

So the frames painted show 464, then 464, then the slide. The 146 pose exists only between the layout and the observer delivery. No error event fired, so no observer delivery was skipped. Every copy of a 32-copy run, passing or failing, shows this same order. A copy fails where the watch's tick takes the 146 sample as a pose and then refuses the carry credit because a sealed landing is still open.

The full table and the method are in the description. The instrumentation was temporary and is not committed.

At 29f5c320d, the journey passed 24 of 24 copies run four at a time, and 143 watch tests passed. CI and landing are with tend-land.

@leaf-agent
leaf-agent merged commit 0fcf2eb into main Nov 26, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-7180 branch November 26, 2026 08:16
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.

Floating panel thread view moves without input at teardown after an answer grows it, under load

2 participants