Skip to content

fix: decide a margin card's scrollbar gutter in its fit, outside the transcript's size delivery - #5934

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5933
Nov 13, 2026
Merged

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

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

A margin card's transcript holds a scrollbar gutter once its turns overflow (data-lf-overflows → scrollbar-gutter: stable, annotation-chrome.css), which narrows its content box. Only the reach pass's paint decided that gutter (paintContinuation in thread-preview.js). That paint runs inside reach's own ResizeObserver delivery for the transcript, so marking the gutter resized a box the delivery had just reported, and Chromium raised ResizeObserver loop completed with undelivered notifications. The nightly journey test_a_second_margin_reply_grows_below_the_first_line hit this at teardown.

Before #5811, the card's fit scrolled a reader at the end to the new end, and that scroll ran the same paint in the placement's script, before the frame's layout. #5811 (intended: one keeper, followEnd, for a reader at the transcript's end) removed that scroll, so the decision waited for reach's delivery. This PR keeps #5811's design. The gutter decision is now one function, and the card's fit (measureThreadCard) calls it right after changing the card's room, before the frame's layout. The paint still calls it for overflow that no fit answers. What the gutter is and when it changes are unchanged.

Verification

  • The journey errors on main 415cf1d6f and passes three of three runs with the change.
  • 33 card and margin-journey tests pass: scrollbar room, end-following, New reply, ride and bounded draft (-k "scrollbar or follows_its_last_turn or new_reply_once_its_picture or grows_below or bounded or end or ride" over tests/browser/margin/test_card_reply.py and tests/journeys/test_render_margin.py).
  • pnpm run check:browser and pnpm run test:runtime pass.
How the delivery was traced

I wrapped ResizeObserver and added a document MutationObserver in an init script. On main, in the frame that errors, the order is:

  1. The card's max-height drops from 534px to 260px.
  2. reach's observer (reach.js:419) is delivered the transcript at 413px wide.
  3. data-lf-overflows is set during that delivery.
  4. The next round reports the transcript at 403px, and the error fires.
  5. reach is delivered the 403px reading one frame late.

At #5811's parent, the same trace shows data-lf-overflows set right after the max-height write, before any delivery in that frame.

One path is left. If the gutter's answer changes when a turn grows inside a card already at its cap, with no new fit, the decision still lands in a size delivery. That path predates #5811, and nothing currently reports it.

Closes #5933 — automated triage

…transcript's size delivery

A card transcript whose turns overflow holds a `scrollbar-gutter`
(`data-lf-overflows`), which narrows its content box. Only the reach
pass's paint decided it (`paintContinuation`), and that paint runs inside
reach's ResizeObserver delivery for the transcript. Marking the gutter
there resized a box the delivery had already reported, so Chromium
reported "ResizeObserver loop completed with undelivered notifications".

Before #5811 the card's fit scrolled a reader at the end to the new end,
and that scroll ran the same paint in the placement's script, before the
frame's layout. #5811 moved end-following into `followEnd`'s size
delivery, so the decision waited for reach's delivery.

The gutter decision is now one function the card's fit calls after it
changes the card's room (`measureThreadCard`), in the script before the
frame's layout, and the paint still calls it for overflow no fit answers.
What the gutter is and when it changes are unchanged.

`test_a_second_margin_reply_grows_below_the_first_line` errored at
teardown with the loop on main and passes three of three runs after.

Closes #5933
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.

Margin reply journey errors at teardown with a ResizeObserver loop since #5811

1 participant