Repository navigation
Carry what news moves in a growing thread view, and credit the carry in the shift watch - #6382
Merged
Merged
Conversation
…working message's arrival When the agent's answer to the user's turn arrived in a thread view at its height cap, as in the floating panel's view of a long thread, the view jumped to its end in one frame, so every turn above moved up at once. It now glides there (`scrollToEnd(…, "smooth")` in `#fitAnswer`, Leaf's 140 ms glide), so the turns slide up as the answer comes into sight. The user asked for arrivals to slide rather than jump. Measured per frame in the panel's view with the work's first step arriving: the turns moved 77 px in one frame before, and now travel over about 140 ms in both Chromium and Firefox. Reduced motion still jumps, as every glide does. The working message's face (the dim line showing the agent's current step) now wears the arrival tint a message wears, the yellow ground that fades over `--lf-motion-flash`. It previously appeared untinted, while the answer replacing it was tinted. `arrivalTint` in messages.js is the one home for that tint; a new step in a face already drawn plays none. Not covered: news that grows a floating box rather than scrolling it, as a short thread's panel view or a margin card grows to hold an answer, still moves the box's contents in one frame. box-motion.js shows news where it stands while only the outline glides, and the shift watch credits travel only to an input, so carrying news needs the watch to judge a news carry by the layout move it draws. Checks: selected floating panel, margin card, agent reply, shift watch, read state and page-holds-still cases (139 passed, 6 xfailed as before), `pnpm run test:runtime`, `pnpm run check:browser`.
… view's end An answer that grows again while the view still glides to its end, as a streaming reply's next words can within the glide's 140 ms, read the box mid-glide as short of its end and put New reply up in place of following it. `#fitAnswer` now reads where the box is headed (`scrollGoal`), as the end keepers do.
… reply's turn from where it lands An independent review of #6338 found the new 140 ms glide could leave a thread view in the wrong place when more arrived before it landed; probing that with the glide slowed to 4 s found a third case, in the margin card: - After the user's own send, a margin card's landing moves its transcript to its end at every refit (reply-landing.js, `keepThreadLanding`), and an instant `scrollToEnd` stopped any glide: the answer's glide was cut to a jump in the first frame, so the card never slid. `scrollToEnd` now leaves a glide already headed to the end alone, and turns one whose end has moved toward the new end. A glide records whether its goal was the end (`end`). - The card's end keeper (`followEnd`) counted the reader at the end only once the box's offset reached it, so growth the thread doesn't re-render, such as a picture loading during the glide, left the reader short of the new end with no New reply. The keeper now reads where the box is headed; a glide headed away from the end, as `u` starts, still reads as leaving it. - When an answer outgrew the panel's view mid-glide, `#fitAnswer` measured the user's turn against New reply mid-way, and either skipped the placement or moved the box from where it stood and stopped the glide, so the view came to rest at 91 px or 148 px depending on frame timing (148 px is where the instant version rests). It now measures from where the box is headed and glides there; with no glide under way, the placement glides rather than jumps. The tint comments now name what the code tints: a progress run's face. Checked with SCROLL_MS at 4000 in `leaf-dev probe` journeys (panel at cap: working line then a long answer 0.2 s later; margin card: answer after a send, picture growth 2.5 s in): the card now glides from the answer's arrival and rests at its end; the panel rests at 148 px in every run.
A runtime case: a move to a box's end leaves a glide already headed there going, turns it toward the end's new place when the box grows, and is instant with no glide under way. It protects the margin card's glide after the user's own send, which the card's send landing cut to a jump at every refit. With the previous rule restored, the case fails at "a move to the end cut the glide to a jump".
…in the shift watch along the step it draws
Max chose this on the arriving-lines page (option "Carry news where a box grows"): in a thread view that grows to hold an arriving line, a short thread's panel view or a margin card below its cap, the turns above slid nowhere; they jumped up in one frame while only the box's outline travelled. box-motion.js now carries news as it carries a send: every part news moved is drawn where it was and travels to where it stands, and a scroller's content rides from where the last reading drew it. A part news adds is revealed where it stands. This reverses the earlier decision that news shows each part where it now stands, which box-motion.js's header recorded.
The shift watch failed four floating panel tests on that carry ("moved without input by (0, 577)px"), since it credited a translation only to an input that began it. It now credits an effect a ResizeObserver delivery begins with no input owning it as a carry of the layout step it draws ("Carries of a step" in its header):
- Its sampled translation is credited only while it keeps each node between where the reading before the step drew it and where the node's layout stands net of the carry, so a carry may not draw a node beyond either end of the step. A node first read in the step rides it.
- The step is judged as if drawn at once: append growth's permission and a size change's reflow are asked of layout net of the carry, and a step is asked even where the carry draws the node where it was, so no reading shows it move.
- Append growth's permission now stands whether or not the node shows at its step, since a carry keeps the run going until a later frame shows the node: a message's pencil hidden at the step and shown mid-carry was otherwise judged without it.
- A carry draws from its underlying style before its first sample, so a comparison from a reading before it began credits its first frame, and the paint a layout-shift entry reports credits a carry begun after that frame's reading.
New watch cases (test_a_carry_draws_the_way_of_a_step_news_may_take): a carry of a standing port's rise passes, as does one that draws part of the step at once; a carry of a step the port may not take, one that draws the head below where it was, and one that ends past its place fail. On the watch before this change the two passing arms fail.
Measured painted poses, read after each frame's paint, in leaf-dev probe journeys: a short thread's panel view growing for the working line moved its turns 77 px in one frame in Firefox before, and travels for about 200 ms after (Chromium the same); a margin card in Firefox holds its turns where they were and slides them 109 px; the panel at its cap still glides with no carry riding.
Tests: test_render_shift_watch.py (378), the floating panel, margin card reply and opening, sending, go-to, bounded log files, journeys test_page_holds_still.py and test_thread_response_continuity.py: 820 passed, 1 failed (test_an_open_view_covers_the_page_beneath_it, the known flake #5744); pnpm run test:runtime; pnpm run check:browser.
…he shift watch's carry credit An independent review of the carry credit found that it let real motion through, and two panel and card cases showed where it was too narrow: - A placed margin card begins its carry where its placement lands, in a promise after the ResizeObserver delivery, so its carry went uncredited and the card rising past the window's foot failed (test_a_card_grows_past_a_region_that_does_not_scroll_its_subject). A carry is now recognised by what it draws rather than where it begins: a translation no rendering owns, begun while no input's rendering is open, whose last keyframe draws its target where its layout puts it and whose first draws it elsewhere. A size tween is never one, which also removes the review's infinite recursion through `restingLayout` for a height carried in a ResizeObserver delivery. - An unpermitted step a carry hid was lost when input started a new run before a later reading showed it, and a move the step made that a carry then drew back read as a roundtrip. A move pending judgement under a carry that begins now stands, since the carry ends where layout puts the node. - The bound vanished after a run boundary, since the ledger retired the readings from before the step. The readings back to each moving carry's step are now kept. - A node first read in the step rode any translation. It now rides a carry only as far as one draws a node read before it, as a turn news adds rides the stream it joins. - A placed card's rise was counted twice in a run that continues, once as its placement's floating-plane credit and once in the standing port's append permission. The permission now records only what the step's placement and anchor credits leave. - An effect a rendering owned that resumes after a test seeks it stays that rendering's (test_a_line_the_field_gives_up_rides_the_box_s_top_edge). Stale prose the review found: floating-panel.js still said news shows what it moved where it now stands; scrolling.js said only a send's stream rides. box-motion.js's stream now gives no ride when its recorded first child is hidden since, which read a top of 0. New watch cases: test_a_carry_draws_the_way_of_a_step_news_may_take gains a key pressed mid-carry and an overshoot; test_a_line_news_adds_rides_only_the_stream_it_joins; test_a_box_s_height_tween_is_no_carry. On the reviewed version's watch five of these arms fail (the key-pressed strays, the overshoot with a key, the lone new line, the height tween); all pass now. The reviewer's ten probes behave as each expects. Tests: test_render_shift_watch.py (386) with the floating panel, send placement, margin card, composing, reactions, aim, sending, go-to, bounded log and chrome contract files, and journeys test_page_holds_still.py, test_thread_response_continuity.py and test_floating_box_motion.py: 1231 passed; failed test_an_open_view_covers_the_page_beneath_it (#5744) and test_a_drawing_names_its_proxies_and_keeps_its_place_among_the_page, which fails on the pre-carry code too, and test_a_line_the_field_gives_up_rides_the_box_s_top_edge errored only with the watch file alongside, passing alone five times and in the same selection without it; pnpm run test:runtime; pnpm run check:browser.
…es-in # Conflicts: # browser/styles/components/surfaces.css # tests/runtime/scrolling.test.mjs # tests/shift_watch.js
leaf-agent
approved these changes
Nov 18, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 18, 2026
A Tab pressed while an arriving answer rides into the panel's thread view took New reply away before the next Tab could reach it. Since #6382 ("Carry what news moves in a growing thread view"), news rides in drawn translated from where it stood. Chromium scrolls the control a Tab focuses into view by where that control is *drawn*, and it does so before `focusin` fires: logging showed the view's `scrollTop` at 0 on the Tab keydown and already at 348 when `focusin` arrived. The thread card's `#sawAnswer` reads that scroll as the user going to the answer and removes New reply. #6382's author meant news to slide into place rather than jump, and that slide is kept. A Tab keydown during a ride now finishes the box's motion (`finishRide` in `browser/runtime/box-motion.js`), as a user turning on reduced motion mid-tween already does. The browser then scrolls by layout, and in the failing case no scroll is needed. The issue suggested finishing on focus instead, but that runs after the browser's scroll, and I tried it: no change. Pointer presses keep the ride, since they aim where things are drawn and finishing would move the target out from under the pointer. The send's ride had the same exposure before #6382, and this covers it too. Verification, with `uv run leaf-dev suite flake --cpu-throttle 6` on `test_render_floating_panel.py::test_the_thread_walk_stands_on_each_thread_it_opens`: | tree | passed | failed | |---|---|---| | main at `667b6c76b`, no change | 2 | 16 | | this change, rebased on `4fbd34593` | 18 | 0 | Also passing on this branch: the thread news, held-news and streaming-answer tests in `test_render_floating_panel.py`, `tests/journeys/test_floating_box_motion.py`, `pnpm run test:runtime`, the browser type check, and pre-commit on the file. Closes #6425 — automated triage Co-authored-by: leaf-agent <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a thread view that grows to hold an arriving line (the floating panel's view of a short thread, a margin card below its cap), the turns above the line jumped up in one frame while only the view's outline travelled.
box-motion.jsnow carries news as it already carried the user's own send: each part news moved is drawn where it was and travels to where it stands, over about 200 ms. Measured frame by frame after each paint in Firefox: 77 px in one frame before, travel after; Chromium the same. This follows #6338, which made a view that scrolls glide to its end.Most of the diff is
tests/shift_watch.js, which credited a translation only to an input that began it, so the carry failed panel tests as "moved without input". Its new "Carries of a step" reads as a carry a translation no rendering owns, begun while no input's rendering is open, that ends with its target where its layout puts it. It credits that translation only while each node stays between its pose before the step and its layout net of the carry, and judges the step itself as if drawn at once. An independent review found four ways the first version let real motion through: a step the carry hid lost to a key press, the bound lost once readings were retired, a new line riding any translation, and a height tween recursing. All four are fixed, and each has a case intest_render_shift_watch.pythat fails on that version. The carry reversesbox-motion.js's earlier rule that news shows each part where it now stands.Requested by Max, who chose carrying news in growing views over keeping the jump. Tests:
test_render_shift_watch.py, the floating panel, send placement, margin card, composing, reactions, aim, sending, go-to, bounded log and chrome contract files, and journeystest_page_holds_still.py,test_thread_response_continuity.pyandtest_floating_box_motion.py, passing but fortest_an_open_view_covers_the_page_beneath_it(#5744) andtest_a_drawing_names_its_proxies_and_keeps_its_place_among_the_page, which fails without this change too; two cases,test_a_line_the_field_gives_up_rides_the_box_s_top_edgeand one arm oftest_send_grows_thread_around_the_words, each failed once under the heaviest load and pass alone;pnpm run test:runtime;pnpm run check:browser.