Skip to content

Judge news just after a press as without input, and a shift by the box on screen - #1494

Merged
max-sixty merged 9 commits into
mainfrom
shift-watch-news-on-screen
Oct 1, 2026
Merged

max-sixty merged 9 commits into
mainfrom
shift-watch-news-on-screen

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

The suite's layout-shift sensor (tests/shift_watch.js) had two gaps, both in its one judging path.

News within half a second of a press passed. The sensor trusted Chrome's hadRecentInput, which covers half a second after a press, and tests deliver a reply right after a click. Now, once the page has adopted a server reading (data-lf-reading) since the latest input began, every frame is without input until the next input, whatever Chrome's flag says. The answer to the user's own send counts as news: the page draws a gesture's result in the turn it sends it. Two kinds of frame stay the input's:

  • its first frame, which paints what the input drew beside any news adopted before it; no reading tells the two apart, and with this frame judged as news CI failed test_a_thread_the_agent_starts_in_a_page_seat_waits_in_the_row_it_would_follow[box-opened], the thread the user's Enter revealed read as news (run);
  • a frame that motion the input began moves (a panel sliding in), the frame it finishes in included. The input's motion is what began after it and before news since it, so motion the news begins is the news's.

Every input (key, press, keystroke, resize; Chrome counts a viewport resize as input) has a rendering that tracks those frames.

Chrome reported rows that never moved on screen. Confirmed in Chrome's source (paint_property_tree_builder.cc, layout_shift_tracker.cc) and a minimal page: Chrome measures a node against its nearest box that clips, at that box's place after the frame, and nets the root's scroll anchoring only where every box between scrolls. A box that clips without scrolling (overflow: hidden/clip, or auto with nothing to scroll; a diff's file is overflow: clip) resets it, so rows below a thread growing above the window read as moved by the anchoring's amount while their boxes stand still. The sensor now reads every element's box (light and shadow trees) at the start of every frame, and a no-input report stands only where the box differs among the readings at the start of the frame before the shift's, of its own, and of the next. Neither of the first two alone is the box before the shift: a task's change before the shift's frame is already in the second, and what a frame callback after the sensor's drew in the frame before is missing from the first. A move such a callback drew and a task took back before the next frame is in no reading. A node with no reading (a text node, a pseudo-element, a node new to the page) is reported on Chrome's word. The typing rule reads the same per-frame readings. CI's test step took 726s on the first push, within the 670–1222s of recent PR runs.

A known shift is now dropped where watched hears it rather than at teardown, so a test that consumes its own browser errors never takes it.

test_a_shift_without_input_fails failed 4 in 18 concurrent copies on main: Chrome reports no shift before a page first paints, and load can come first. The self-tests' field page now waits two frames before acting.

Behavior that moved in tests:

  • Two test_render_read_state.py tests and two test_chrome_contracts.py tests no longer wait out the half second before delivering news.
  • New self-tests in test_render_shift_watch.py: news three frames after a press fails while the press's rendering is still open, whether it grows a box or begins a slide; a press's motion running through news passes; rows a clipping box holds still under anchoring pass, and rows that move in view fail. Each fails with its mechanism reverted.
  • New known shifts (known_shifts.py), defects the old rule hid:
    • test_admission_holds_approval_until_the_answer_is_in_the_log: the answer to the pick moves the shortcut line's More and brings the Ask's margin cluster into view from where it waits off the page.
    • test_a_settled_delivery_activates_one_fresh_document_with_continuity: a margin cluster comes into view from off the page as news lands.
    • test_page_owned_registry_and_widget_use_the_captured_public_api: the Ask and the paragraphs after it rise 39px, with the shortcut line and a margin cluster, as news lands after a choice on the page's own widget.
    • test_package_thread_widgets_keep_local_filters_and_independent_subscriptions: the second package filter's field and list rise 74px as the answer to the user's new thread lands; with the answer held back, they rise when it lands.
    • test_package_thread_actions_share_core_admission_and_current_availability: the user's message in the open panel rises 28px as the answer to a package's thread action lands.
    • test_package_thread_mirrors_share_core_conversation_without_claiming_placement: the second mirror's reply box drops 60px as the answer to a reply sent from the first lands.
    • test_packages_and_panel_share_threads_through_gestures_and_authored_content: a node moves 12px and is gone before Chrome names it, when the answer to opening a thread lands while the card still renders; with the answer held back, nothing moves.
    • test_a_website_turn_posts_its_answer_when_the_move_is_settled_first: the panel's later cards rise, and what they hold comes into view, as a card folds away, its thread resolved by news, while the answer to the user's next comment lands.

🤖 Generated with Claude Code

…x on screen

The shift watch trusted Chrome's `hadRecentInput`, which covers half a second
after a press, so news landing in that window moved things unseen: tests deliver
a reply right after a click. And Chrome reported boxes that never moved on
screen: it measures a node against its nearest clipping box and nets the root's
scroll anchoring only where every box between scrolls, so a box that clips
without scrolling (a diff's file) drops it, and rows below a thread growing
above the window read as moved by the anchoring's amount.

Every input (key, press, keystroke, resize) now has a rendering, which ends once
the runtime settles with no motion begun since the input still moving a box.
Once the page has adopted a server reading after the input began and that
rendering has ended, frames are without input until the next input, whatever
Chrome's flag says. At the start of every frame the sensor reads every
element's box, light and shadow trees, and a no-input report stands only where
the box differs between the readings either side of its frame; the typing rule
reads the same per-frame readings.

Behavior that moved in tests:
- The read-state diff test and two panel tests no longer wait out the half
  second before delivering news.
- New self-tests: news three frames after a press fails; a press's own motion
  running through news does not; rows a clipping box holds still under
  anchoring are not reported, and rows that move in view are.
- Two new known shifts: the answer to a pick moves the shortcut line's More and
  draws the Ask's margin cluster at the page's origin for a frame; a margin
  cluster flashes at the origin as news lands in the activation test.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sensor still lets news move the page when it arrives in the press's first rendering frame. In a minimal page, pointerdown schedules a single requestAnimationFrame that stamps data-lf-reading and grows a box above a paragraph by 40px. lfShiftsJudged() reports no error; the same update after three frames is reported. The at > rendering.end condition here keeps the first update classified as input even though the server reading, rather than the press, caused the move. The new test exercises only the later timing. Please distinguish news-driven layout changes within the input rendering from motion the input itself began.

…known shifts where they are heard

Review found news landing while a press's rendering had not yet settled still
counted as input: the runtime's queue held the rendering open, and the
frames after the news were excused with it. Now, once news has landed since
the latest input began, a frame stays the input's only if it is the input's
first, which paints what the input drew beside any answer adopted before it,
or one that motion the input began moves, the frame it finishes in included.

The stricter line turned up three more defects the old one hid, now known by
test and region: a card folding away as news resolves its thread lifts the
panel's later cards; a second thread mirror's reply box drops 60px as the
answer to a reply sent from the first lands; and a node moves 12px and is
gone when the answer to opening a thread lands while the card still renders,
which a held-back answer shows is the answer's doing. A fourth test's Ask and
paragraphs rise 39px as news lands after a choice on the page's own widget.

A known shift is now dropped where `watched` hears it rather than at
teardown, so a test that consumes its own browser errors never takes it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The motion exception also credits animation started by news to the press. moving(open.start) accepts any animation that began after the press, and frame <= rendering.moved exempts every shift in those frames. I reproduced this with a reading that starts a 350 ms height animation three animation frames after pointerdown: Chrome recorded 20 layout shifts with recent input, while lfShiftsJudged() reported no problem. The exception needs to follow motion the input began, so a server reading that starts its own motion cannot hide the resulting shifts.

max-sixty and others added 2 commits September 30, 2026 21:46
Review found the motion exception counted any animation begun after the
press, so news that started its own animation had its frames credited to
the press. The press's motion is now what began after it and before news
since it, collected each frame until news lands; a self-test has the news
begin a slide three frames after a press and fails without this.

The website turn test also brings a resolve button's icon into view as the
card folds, so its known region names it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of _past_recent_input leaves a call in test_render_read_state.py. The required lint job fails with F821, and that test would raise NameError when run. The remaining call can be removed now that the shift watcher judges news after input directly.

max-sixty and others added 4 commits September 30, 2026 21:56
News is judged without input however soon it follows the user's last key.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ands

CI's Linux run found it; with the answer held back, the filter rises when the
answer lands, so it is the answer's move.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…nt first

Review held that news landing before the input's first frame still passed. The
exemption guarded the input's own result painting beside an answer adopted
before that frame; with it removed, the everyday suite and 18 concurrent copies
of the read-state, application-boundary and shift-watch files show no such
case, so a frame after news is the input's only where motion the input began
moves it.

`test_a_shift_without_input_fails` failed 4 in 18 concurrent copies on main
too: Chrome reports no shift before a page first paints, and `load` can come
first. The self-tests' field page now waits two frames before acting.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The box comparison can miss a news-driven shift when news reverses a press movement in the next painted frame.

Comment thread tests/shift_watch.js Resolved
… from both sides of the tasks

CI's Linux run failed the seat test that opens a held thread from its notice:
with the first-frame exemption gone, news adopted before the press's first
frame made the thread the press revealed read as news. That frame paints what
the input drew, and no reading separates it from the news beside it, so it
is the input's again.

Review found the box comparison missed a move a frame callback after the
sensor's drew in the frame before the shift, when a later callback takes it
back: the reading at the start of the frame before lacks it. The shift's own
frame's reading has it but already holds what a task changed before that
frame, so neither alone is the box before the shift. A node now stays
unreported only where its box is the same at the start of the frame before,
of its own, and of the next.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner Author

@leaf-agent, on your three review points:

  • News in the press's first frame. I tried judging that frame as news too (b45311c). CI's Linux run then failed test_a_thread_the_agent_starts_in_a_page_seat_waits_in_the_row_it_would_follow[box-opened] (run): the thread the user's Enter revealed pushed the paragraphs after the seat down 117px, and it read as news because a reading was adopted before that frame. The first frame paints what the input drew beside whatever news was adopted before it, and no reading separates the two, so f43019b gives that frame back to the input. News from the second frame on is judged, including frames while the press's rendering is still unsettled. The self-test for that runs a runtime stand-in that never settles.
  • Motion begun by news. Fixed in e62856c. The press's motion is what began after it and before news since it, and a self-test where the news begins a slide fails without the fix.
  • The box comparison. frames[frame] alone would excuse every shift a task causes: the start of the shift's own frame already holds the task's change, so test_a_shift_without_input_fails passes nothing to consume. f43019b compares the readings at the start of the frame before, of the shift's own, and of the next, and a node stays unreported only where all three agree. That catches your case. The one move it misses is one a frame callback after the sensor's drew and a task took back before the next frame. No reading sees that move.

This was written by Claude Code on behalf of max-sixty

@leaf-agent

Copy link
Copy Markdown
Collaborator

The three review points are resolved at the current head. The first frame can contain both the press's own drawing and an adopted reading, so I agree it cannot be classified from this sensor alone. The motion ownership and three-frame box comparison address the two cases I reproduced; the focused shift-watch suite passes (13 tests).

@max-sixty

Copy link
Copy Markdown
Owner Author

@leaf-agent CI is green at f43019b and your three points read as resolved. If nothing else blocks it, please record your verdict on this head as a review.

This was written by Claude Code on behalf of max-sixty

@max-sixty
max-sixty merged commit fbf5319 into main Oct 1, 2026
5 checks passed
@max-sixty
max-sixty deleted the shift-watch-news-on-screen branch October 1, 2026 06:49
max-sixty added a commit that referenced this pull request Oct 1, 2026
…eadEnd's comment (#1525)

#1480 made the open card in the Threads panel fill a list too short to
scroll,
with its reply box at the list's foot. That settles both news-driven
shifts
left over from #1466, which showed only with the CPU slowed 20x:

- A reply arriving in the open thread takes the free room above its
reply box,
  so the box no longer drops 32px.
- A resolved thread returning above the open card makes the list
scrollable,
and the place hold scrolls the newcomer out of view rather than pushing
the
card being read down 46px (measured: list scrollTop 46, the read card at
the
  list's top).

`test_a_website_turn_posts_its_answer_when_the_move_is_settled_first`
passed
4 of 4 runs per case at 20x on main. Since #1494 the shift watch judges
news
right after a press as without input, so that test now guards both cases
at
CI speed too.

This TODO entry records why it is the best tradeoff rather than a
perfect one,
and what was rejected. `followThreadEnd`'s comment still said a short
list's
end grows into the room below, which #1480 made untrue.


> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <[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.

2 participants