Repository navigation
Give chrome and geometry one settled reading - #1145
Merged
Merged
Conversation
Every runtime and package rendering callback and size observer now goes through runtime/rendering.js (`nextRender`, `cancelRender`, `sizeObserver`); lint refuses the bare globals. The module counts what is queued and reads settled after one rendering update with nothing pending and no counted observer delivery, checked from a task after the update so that update's ResizeObserver deliveries count. A hidden page, and a child page whose frame is not rendered (an inactive tab, a closed disclosure), read settled, since they get no updates. The validation entry exposes it as `lfRenderingSettled`. BOTH_STAMPS now requires it, and `RENDERED` waits one update and then for it, instead of counting two frames; every test reading chrome after a gesture moves with it. `shortcut_bar_text` reads after `RENDERED`. `data-lf-presented` stays at the interaction boundary. Stamping it from a settled update deadlocks any host that hides or scrolls away the frame until the page presents: the MCP app keeps its cross-origin frame hidden until then, and Chrome runs no rendering updates there. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`rendered(page)` replaces the `RENDERED` in-page loop: one rendering turn, then a driver-side wait on `lfRenderingSettled`, failing at once on a page without it and naming a reading that never settles. The three fold tests that read while a held animation keeps the place hold correcting every frame wait `ONE_FRAME`, the one update their claim is about. The render gate's resize sweep and its page-code pass wait on a new `renderingSettled` probe instead of counting frames. lf-specimen cancels the host-side height write a replaced child queued. The code-comparison example measures through `nextRender`; lint also refuses `window.`/`globalThis.` rendering globals. The rendering.js header states that playback loops, IntersectionObserver deliveries and vendored code are not counted, and tests/runtime/rendering.test.mjs covers the fold. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 25, 2026
max-sixty
added a commit
that referenced
this pull request
Sep 25, 2026
#1145 replaced RENDERED with rendered(page); the band's new check in the g-chord test still called the old name. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Sep 25, 2026
Leaf's chrome and geometry had about 20 owners, each asking the browser for its own animation frame. Work one frame callback queued for another ran a frame later, so anything that follows the page — target boxes, the design-mode legend, the action bar — painted one frame behind a repaint that moved the page, and the settled reading (#1145) needed an extra frame to say so. `runtime/rendering.js` now owns the one frame Leaf asks for: - `nextRender` queues into one pass per frame. Asked for from inside the pass, it runs in that pass, before the frame paints; asked for anywhere else (an input handler, a ResizeObserver delivery), it runs in the next frame's pass. A chain that keeps asking stops after eight generations and finishes on the next frame. - The pass waits one microtask step between callbacks, so a publication a callback makes has rendered before the next callback reads the page, and reports a callback's error without stopping the owners after it. - `nextFrame` is for a step that must not run in the pass that asked for it. The scroll glide (`navigation.js`), the place-hold follow loop (`user-place.js`) and the interaction gallery's frame pause move onto it, since each re-asks from inside its own callback. It is exported through the widget API for a package's own animation tick. No other caller changes. Every other `nextRender` caller was checked: those reached from inside a pass are coalescing paint and placement (repaint, page geometry, target paint, the legend, margin layout and projection, the FAB, the TOC) and run correctly in the same pass; the rest are asked for from input or observer callbacks, whose timing is unchanged. Measured on `triage-board` with design mode on, narrowing the window: the settled reading holds two frames after the resize against three on main, in all 20 paired trials. This replaces the planned move of target and legend boxes to CSS anchor positioning, which Chrome 154 can't carry: an anchored box isn't clipped by its target's scroll container, an anchor inside a widget's shadow root is invisible to chrome outside it, and a `display: contents` element is no anchor at all. Checks: `npm run test:runtime`, the everyday suite, and the complete nightly suite (3150 passed) on the branch before the merge of main. > _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]>
max-sixty
added a commit
that referenced
this pull request
Sep 27, 2026
… reader (#1250) Four Python readers waited on different subsets of the runtime's readiness facts. The suite's `BOTH_STAMPS` required upgrade, an applied stamp, presentation, the coordinator's current reading, settled rendering and deferred arrivals (#913 and #1145 added the last two, but only there). The render gate's `wait_for_presentation` waited on data version, log coverage and current presentation, with neither arrival nor rendering. `scripts/example-previews.py` and `record-demo.py` checked the three body stamps alone, and `record-demo.py`'s stills waited on upgrade and a count of `action` lines in `events.jsonl`, with no presentation, where the gate counts the reading's served coverage (#1235). `pageReadiness` in `runtime/presentation.js` now names the first fact a page has yet to state, in the order a page reaches them: `upgraded`, then `data` and `log` against an `/api/state` reading the caller holds, then `presented`, `arrived` and `rendering`. It returns null once the page is ready. The entry script exposes it as `lfReadiness`, replacing `lfCurrentPresentationReady` and `lfPageArrived`; `lfRenderingSettled` stays for waits after input. `leaf.render_checks.wait_until_ready(page, state=None)` is the one Python wait. It raises `PageNotReady` naming the stage, and every reader uses it: the suite (`open_page`, `navigate`, `restarting`, the arrivals case and each direct wait), the gate's scheme pass and page-code run, the catalog stills, and the demo recording. The stills now wait against the server's reading, so they count served coverage. Behaviour that moved: - `leaf version check` now also waits for deferred arrivals and settled rendering before it reads a page, and reports either stage by name. A failure at either still keeps the projection findings, as `pageSettled` did. - The gate requires the applied stamp even when the reading covers no records; before, it skipped the log stage then. - The page-code run reads `/api/state` straight after navigation, not after the upgrade stamp, since the readiness wait includes upgrade. - The catalog stills and demo frames are shot after deferred arrivals land and rendering settles, not at first presentation. - A timed-out wait names its stage in the runtime's own words, and reports a page that cannot answer within 5s as `answering`. The render-check probes `initiallyPresented`, `currentPresented`, `dataApplied` and `logApplied` are gone, along with `validationPresentationReady` and `pageArrived`. The tests that read them now assert the readiness stage, or the coordinator's `applicationPresented` directly. A new gate test holds a page's first state answer and checks that the wait fails at `log` with that wording, then passes once the answer lands. The scheme pass keeps its `upgraded` probe as a barrier before the visual-provider check, which must run before presentation can hang on an invalid inventory. `scripts/verify_site.py` and the MCP app still wait on `data-lf-presented` alone. That is the interaction boundary a host shows the frame at, and it stays their fact. > _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]>
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.
The runtime had no single fact saying its chrome and geometry had caught up with the input it had handled. About twenty separate
requestAnimationFramecoalescers and a dozenResizeObservers each ran on their own timing, so a test reading chrome after a keypress guessed a frame count (RENDEREDwas two frames), and the flakes came from reads landing in the gap.skills/leaf/assets/runtime/rendering.jsis now the one place Leaf schedules a rendering callback or watches a size:nextRender,cancelRenderandsizeObserver. Lint refuses the browser's own in the runtime and the bundled packages, includingwindow./globalThis.forms. The module counts what is queued.renderingSettled()turns true after one rendering update in which nothing counted was pending and no counted observer delivered. That check runs as a task queued from a callback, so it runs after the update's ResizeObserver delivery. Any counted request or delivery turns it false synchronously. A hidden page, and a child page whose frame is not rendered (inactive tab, closed disclosure), read settled because they get no updates. Playback loops (the example films), IntersectionObserver deliveries and vendored bundles are not counted; the module header says why.Test and gate readers now wait on the reading instead of counting frames:
lfRenderingSettled, andBOTH_STAMPSrequires it.rendered(page)replacesRENDERED: one update, then a driver-side wait on the reading. It fails at once on a page that doesn't expose the reading, and names a page that never settles. All ~115 call sites move with it.ONE_FRAME, because one update is what they claim.renderingSettledprobe.data-lf-presentedstays at the interaction boundary. The plan was to stamp it from inside the first settled update. That deadlocks any host that hides or scrolls away the frame until the page presents. The MCP app keeps its cross-origin Leaf framehiddenuntil then, and Chrome runs no rendering updates in such a frame, sotest_adaptive_app_renders_the_complete_page_payloadhung. A cross-origin child cannot detect this from inside, so the stamp cannot wait on rendering. The settled reading is its own live fact instead.Also in the diff:
nextRender.tests/runtime/rendering.test.mjs, and a browser contract test: a click that queues a repaint reads unsettled in the same turn and settled afterrendered.Local runs: the everyday suite is green on the merged tree. A full
--run-nightlypass on the first commit had three failures, the held-fold tests fixed above. A rerun of the touched nightly files had one failure,test_every_base_corpus_tab_stop_has_a_visible_focus_indicator, which passed alone and in six concurrent copies.🤖 Generated with Claude Code