Repository navigation
Read the margin's residents from the upgraded page, and fit a sample's frame as it presents - #1444
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The first sensor read Chrome's Layout Instability API and failed a keystroke that shifted any element holding the field or standing before it. On a find that narrowed the Threads panel's list, the API reported page paragraphs 60px below where every frame drew them, so its entries are not evidence of a move. The sensor now measures the field itself. At each trusted `beforeinput` it records the field's edges in the coordinates of every scroller that moves it, stopping at a fixed ancestor, and every frame until the keystroke has rendered compares them. A field whose opposite edges both moved was carried; one that grew at an edge was not, so a composer pinned to the panel's foot may grow upward. The watch ends at the runtime's settled reading, at news (a change to `data-lf-reading`), at another key or press, or after a second, and it skips a keystroke whose field an animation is already carrying. Each exclusion answers a false report in the suite: replies arriving right after a test typed (`test_incoming_reply_follows_*`), the Threads panel still sliding in when a test typed into it (`test_a_settled_delivery_*`, `test_a_website_turn_posts_*`), and a widget a test removed by script just before `fill`. With `data-lf-folded` dropped from the Draft chip, the defect #1393 fixed, the sensor fails `test_a_thread_keeps_submit_in_its_field_and_resolve_with_its_metadata` with "typing in leaf-text.lf-ui moved it by (0, 12)px". Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Summing the scroll offsets of the field's ancestors misread the MCP app's `position: sticky` composer, which stays at its frame's foot while the frame's document scrolls: under load, 13 of 18 concurrent copies of `test_snapshot_app_renders_general_and_anchored_feedback_without_claiming_delivery` reported "typing in textarea#comment moved it by (0, -131)px". A scroll of the document or of an element holding the field now ends the watch, as news, another key or press, and an animation already carrying the field do, and the field's viewport box is compared directly. `leaf-dev flake` runs that test, the incoming-reply follow test and the delivery activation test clean in 18 copies each, and the Draft chip without `data-lf-folded` still fails three of four `test_a_thread_keeps_submit_in_its_field_and_resolve_with_its_metadata` cases. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The earlier commits on this branch said Chrome's Layout Instability API reported page paragraphs 60px from where every frame drew them. That was wrong. A buffered observer shows those paragraphs really moved, by +54, -32 and +131px, while the preceding diff comment was sent and the Threads panel opened. The last shift painted just after the first keystroke, and the per-frame read that seemed to contradict it started after the moves ended. The API is right about what moved but not about why: it compares painted frames, so a move laid out before a keystroke and painted after it is charged to the keystroke. Rebuilt on the API with the same rendering window, `test_package_thread_widgets_keep_local_filters_and_independent_subscriptions` failed that way: the test removes a widget by script and then types, and the removal's 27px move painted in the keystroke's first frame. Reading the field's box with a forced layout at `beforeinput` folds every earlier change into the baseline. The header now says so, along with the cost: a move painted and undone between two animation frames goes unseen. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The API is the better evidence of a move. It compares painted frames, nets out scrolling, and sees a move painted and undone between two animation frames, which a box read at each frame cannot. What it cannot say is why a box moved. It charges a move laid out before a keystroke but painted after it to the keystroke's frame, as it did for the widget `test_package_thread_widgets_keep_local_filters_and_independent_subscriptions` removes by script just before it types. So each keystroke still reads the field's box, and the box of every element holding it, with a forced layout at `beforeinput`. A shift during the keystroke's rendering counts only where it names one of those elements at a box whose opposite edges both moved the same way from that reading. Moving the same way leaves out a field gaining its focus ring, which grows its painted box on every side. The report lists every other element the same frame moved, as a lead for finding the cause. Because the API nets out scrolling, the rule for an animation already carrying the field is gone: the Threads panel slides in with a transform, and a transform is not a layout shift. The rendering still ends at another key or press, at news, and at a scroll of a holder, since a scroll moves every box after the reading at the key. The observer hears a frame's shifts a task or more after the paint, so a test whose last act was a keystroke used to end before the report. `conftest.py` now judges the queued shifts (`takeRecords`) as each test body returns, while the pages' servers still answer. Judging at fixture teardown instead let every round trip deliver failed fetches from pages whose server had stopped. With `data-lf-folded` dropped from the Draft chip, all four `test_a_thread_keeps_submit_in_its_field_and_resolve_with_its_metadata` cases fail, and so does `test_agent_reply_arrivals_keep_open_panel_drafts_and_summarize_batches`, whose own assertions pass. The full suite passes, and `leaf-dev flake` runs each test that gave a false report on an earlier version clean in 18 concurrent copies. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The watched() docstring still described the first version, which also failed typing that moved what stood before the field. The header now says Chrome names at most five moved elements per frame. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The typing watch becomes `tests/shift_watch.js`, which reads Chrome's Layout Instability API for both halves of the "Stability" rule: a shift Chrome reports without recent input fails the test, as typing that carries its field already did. `EXPECTED` lists the shifts the page makes today, by the elements they move, each a defect whose lines go when it is fixed: the bottom bar as news lands, the runtime root, a diff's section at first reading, a package Ask and the paragraphs after it, ship-review's tasks, the process page's screenshot, the MCP App's frame, a sample frame, and the gallery column. A trusted `beforeinput` is typing whatever Chrome's input flag says: Chrome does not count text inserted without a key (`fill`, `insert_text`) as input, so a carry by `fill` had fallen outside the typing rule. The fixture now lets the frames a test's last act changed paint before it judges, since Chrome hands a frame's shifts over only once it paints; the review on #1432 showed a `fill` that carried its field going unreported. `test_render_shift_watch.py` holds both rules and that last keystroke. A typing report now gives the box the key found and the two Chrome painted, to say why on a machine where it cannot be reproduced. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Linux CI failed `test_a_settled_delivery_activates_one_fresh_document_with_continuity` on a carry that was not one: the key read the panel's foot at its box, 1171,835 419x65, and Chrome's rect for it was 1108,835 92x65, since Chrome reports what a node paints (here a shadow reaching 63px left) clipped to the viewport. Held against each other the two differ at both edges. The typing rule now reads the same boxes again at the start of each frame of a keystroke's rendering, and holds Chrome's named node's box there against the key's. A rendering also ends at a frame that finds still running an animation that moves a box, where one was running on the field or a holder at the key: a panel sliding in carries the field for the press that opened it. A trusted `beforeinput` counts as input for as long as Chrome counts a key, so a frame after `fill` whose reading is missing is not judged as a shift without input. Chrome names the five nodes a frame moved most, which differ between runs and between macOS and Linux (CI found a margin cluster, the gallery's tabs, a task's `::before`, and a package's thread filter under names the list did not hold). Each `EXPECTED` pattern now names the region a known shift moves and matches any node in it, and applies to shifts without input only, so it never hides typing's carry. Thread cards moving as a reply lands above thirty later ones join the list. `test_render_shift_watch.py` adds a composer standing past the viewport with a shadow, which the old comparison failed, and a holder still sliding in. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The review on #1432 showed a `fill` followed 120ms later by an unrelated scripted move going unreported: a trusted `beforeinput` excused every frame for the 500ms Chrome counts a key. Now only the frames of that keystroke's rendering are the typing rule's; a frame after it is judged like any other. A rendering that finds the motion it began under still running no longer ends there, which would hand its remaining frames to the no-input rule: it stops reading and judges none of them. CI found the feature gallery's sections moving 32px as its options draw, beside the column and tabs already listed, so that line now names the gallery's region. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Chrome credits no input to a frame nested in another page: in the MCP App's nested Leaf page, a trusted click opened the versions menu and the shortcut bar's More moved 18ms later in a frame Chrome marked `hadRecentInput: false`. A trusted key or press in the frame's own document now counts for the same half second Chrome counts one. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The revised offscreen-sample test fails the browser shift gate. uv run pytest -n 0 tests/test_render_read_state.py::test_offscreen_sample_cannot_acknowledge_child_viewport -q passes its read assertions, then fails at teardown with body in html moved without input by (-8, -21)px in the sample child (versions/v1.html). The same failure occurred in the focused selection with the semantic-news tests. Because this PR removes the sample's shift exceptions, the new journey needs to leave the child page stable before this change can land.
|
@leaf-agent I can't reproduce
A body at (8, 21) is a document painted with no theme: the UA's 8px body margin, plus the h1's 21px margin collapsing through an unstyled
|
|
I reran this at You’re right that the PR’s Linux |
leaf-agent
left a comment
There was a problem hiding this comment.
The Linux test job now reproduces the shift in test_offscreen_sample_cannot_acknowledge_child_viewport: its read assertions pass, but browser teardown reports versions/v1.html: body in html moved without input by (-8, -21)px (failed job). This is the CI reproduction you asked for. The job log has the shift report but no browser console or network trace to explain the stylesheet timing, so the cause remains unverified. The failing gate withdraws my approval of this head.
CI failed — the offscreen sample test reports a layout shift in the Linux test job.
leaf-agent
left a comment
There was a problem hiding this comment.
The new trace records a theme-loading shift in the far sample child: at interactive, the body is at (8, 21.4375) with no loaded stylesheet; when theme.css appears, it moves to (0, 0) and Chrome records the move. The parent page shows the same unstyled-to-styled geometry sequence, though this probe did not record its shift entry. The focused test's read assertions pass, but browser teardown still reports the parent's body in html moved without input by (-8, -21)px. This evidence points to stylesheet startup timing; the removed shift exceptions need a stable startup path before this head passes the browser gate.
The new diagnostic code also leaves lint red: ruff format inserts a blank line between the local import and print in test_render_read_state.py. Remove the temporary probe once the investigation is complete, or format it while it continues.
This reverts commit 29de9be.
…me's root (#1446) News no longer moves the banner's status chevron, the bottom status or the chrome's root, and the shortcut line no longer moves More as the page presents. I measured each move with `PerformanceObserver({type: "layout-shift"})` and per-frame readings of the moved boxes. The `lf-status-button`, `lf-bottom-status` and `lf-chrome` patterns leave `EXPECTED` in `tests/shift_watch.js`. `/lf-shortcut/` stays, for the reason given at the end. - **The chrome's root.** `.lf-chrome` is `position: static` and stands after `main`. Its `padding-bottom` was the document's room under the bottom bar, so any growth or shrinkage of the content above it moved the root, e.g. `(0, 32)` as an Ask grew at presentation and `(0, -683)` on a version change. That room is now the body's `padding-bottom` in `theme.css`, beside the banner's `body::before`, where the theme's own comment and `skills/leaf/assets/AGENTS.md` ("the render-blocking theme reserves the banner and bottom bar") already said it belonged. The root now takes no room. It has the same geometry, and `leaf-dev stills` shows no page difference in any of its 22 states. The bar's room is also there before the runtime mounts. - **The status chevron.** It trailed the status sentence, so every status the page wrote moved it, e.g. "Connecting…" at 129px becoming "Server offline — reconnecting; keep page open" at 346px. It now stands between the leaf and the sentence, which is the only difference the stills show. The sentence is the press's one changing part, and the press still grows rightward into its room. - **The shortcut line before presentation.** The line was drawn from the commands live before the page presented ("c comment on the page", "d / u page down / up"). Presentation then replaced that with "s comment on target", and More moved `(-5, 0)`. No page key acts before presentation, since the bootstrap holds each press for the presented page. So `renderShortcutBar` draws nothing until `pagePresented()`, and `presentPage`'s repaint draws the first true reading. - **The bottom status.** It is held at the bar's right end, so a new notice of a new width, such as "Saved — sent" giving way to "Updated to v4", moved its start edge `(-5, 0)` or `(-39, 0)`. The Layout Instability API takes a box's start as its flow-relative inline start. The status now states that its start is the edge it stands by (`direction: rtl`), and each sentence keeps its own direction (`unicode-bidi: plaintext`). It looks the same as before. Tests that moved focus, a selection or a modal by script now drive the page as a user does: - `test_a_repaint_unsettles_the_rendering_until_it_lands` presses the Threads toggle, and reads the settled state as the press goes down and after its click. - The two read-state tests that select "new route" in a diff drag across it with `select`, through one helper. - `test_the_arrows_say_which_way_the_section_under_the_user_goes` tabs to the summary. - `test_native_top_layers_bound_the_keyboard_stack` opens its modal and popover with presses. - The contents and excerpt tests select their words by triple-click and by drag. - The navigation and pane tests read the bar's room from `body`. What's left: - `/lf-shortcut/`: 43 nightly tests still move More or a hint when the scope the line reads changes without a press. Most move focus or the selection by script. A few are news, such as a margin entry arriving beside a focused one, which adds "← / → move through margin entries" to the line. Stopping those means reordering the line to More, then the way out, then the contextual hints, so that news changes only the last item. That is a visible change to every page, left for a separate decision. This branch also carries 8926f31 from `draft-label-no-shift`: the sensor now keeps every recent press in a nested frame, and counts a press in a same-origin page holding the frame. Before it, the key after a sample's Enter un-credited the Enter, so #1444's two sample tests reported the bottom status rising over the child's Threads panel. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
A nightly run on Linux CI (36659812215) found 58 tests the local survey had not, most of them a margin cluster placed after presentation. So the nightly-marked tests stay off the watch, as #1451 had them, now decided beside the lists (`known_shifts.watches_shifts`); the lists hold what the surveys and that run saw, for whoever takes up each defect, and the reports #1446 and #1444 fixed are out of them. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Removes two groups from the shift watch's
EXPECTEDlist: the feature gallery's column and the offscreen sample's frame, clip and panel foot.The gallery's column moved twice at load. The margin's residency pass (
margin-layout.js,settleResidency) ran as soon as chrome layout asked for it, which was before the widgets had upgraded. The authored fallback of a rootlf-tabsstacks every panel, so the pass counted the sidenote in the gallery's unchosen "Page & layout" tab as a resident. It wrotedata-lf-margin="rail map note"and--lf-shift: -168px, and then took both back oncelf-tabshid that panel. Residency now waits for startup:openResidency, called instartPageonceupgradeWidgetsreturns, takes the first reading right there and answers every ask made before it. Because that reading is synchronous, the margin rows placed at presentation read the decided posture; they never stand as pins for a frame and then move to the rail.A live sample's frame is sized before the page paints it.
lf-samplegave the frame its child's height one frame after the child's firstResizeObserverdelivery. That write could land after the page's presentation, so the frame appeared at the stylesheet's 32rem placeholder and then moved everything below it. The first fit now happens as the child presents, inside the promise the widget presents, and later changes still follow a frame behind.The offscreen-sample test drove geometry no user or server can.
test_offscreen_sample_cannot_acknowledge_child_viewportgot its three cases by script: it translated the frame 1200px down, gave its containerheight: 100px; overflow: hidden, set a 2000pxmargin-top, and appended a 3000px spacer inside the child. It also clicked the child's toggle and Next unread withelement.click(). The 2887px move came from that spacer: a block sample's viewport is the whole frame, so the child's fixed thread-panel foot and bottom status move with its height. Thediv#read-clipmove was the margin collapse that the scriptedoverflow: hiddenbroke, and theiframemove was the frame coming back from its clipped transform. Each geometry is now authored on a page of its own.test_clipped_sample_cannot_acknowledge_child_viewportputs the sample inside a 100px clip.test_offscreen_sample_cannot_acknowledge_child_viewportputs it below a 2000px gap. In both, the child's own stylesheet makes it taller than the window. The user reaches the child's first unread by key (focus, Enter,u) and scrolls the containing page. The assertions are the same three: offscreen shows nothing, clipped shows nothing, and the tall frame is read only once a scroll shows the message. The tests now also check that the key opened the thread.One sample per page is needed on Linux, not just tidier. In CI's Linux headless shell, a script that reads a sample child's layout before its
theme.cssapplies makes Chromium take the unstyled body (8, 21) as the baseline, so the theme arriving reads asbody in html moved without input by (-8, -21)px. A probe that read the child body atreadystatechangereproduced that every time in CI's Linux image, while macOS never showed it. With two samples on one page, it showed up intermittently without any probe (1 of 4 local Linux runs, every CI run). One sample per page passed 10 of 10 runs in the Linux image.The gallery's
#bg-sections still move aslf-tabsand the options' add row upgrade after first paint. That move is the first-paint group's, so/#bg-/stays inEXPECTEDfor that fix.🤖 Generated with Claude Code