Repository navigation
Accept classic and async scripts by deferring them, report scrollbar room as advice, and let a fixed box cross the column - #4554
Merged
Conversation
…oss the column's edge The render gate refused a horizontally scrolling row with less than 15px below its last line, and a position: fixed box that straddled main's content edge. The first is now advice: the overlay bar covers the row only under the pointer, the page shows it outside Leaf, and the room is the author's call. A fixed box now answers for itself wherever it stands, since it hangs off the window and can't scroll the page sideways. The plain-page corpus drops both obstacles.
… its source `page check` refused a classic script that wasn't `defer src` (`parser-blocking-script`) and any `async` script (`async-script`), the commonest scripts on the web, because each can run before the runtime's module: the runtime took its authored baseline from the live `main` and heard page errors only once its own modules listened. By the user's decision both refusals and their finding text are gone, and the runtime now reads the authored page from its source and hears errors from the document's first script. - Delivery marks a document whose scripts can run before the runtime (`lf-early-scripts`, `revision_delivery.early_scripts`). On such a page `version.js` reads the delivered document back with `force-cache`, the navigation's own response in the browser's HTTP cache, parses it as a comparison parses another version, and matches it to the live copy with the patch's own `matchNodes`. A node a script made stands for nothing authored, as a module's output does; a source node a script removed stands for no live node. The `html`/`body` attributes and head nodes come from the source too. Boot waits for that read beside the overlay import it already awaits. Pages without the mark are unchanged. - The prepaint keeps every window error and unhandled rejection from the first script until `layer-client.js` takes them, and the runtime reports them once it knows its revision (`reportEarlyFaults`), so plain `page check` and the agent's log hear a parse-time throw with its throw site, as they hear a module's. Measured on the plain `script` page: the source read is one fetch answered from the HTTP cache (transferSize 0 in Chromium and Firefox), 185 KB parsed, no long frame, and presentation within noise of the same page written as a module (257-274 ms against 254-261 ms, three runs each). Tests: the refusal tests now pin that every script kind activates, and a delivery test pins which scripts carry the mark. The script-words diff test runs for a classic script as for a module, and now also checks that a content-only revision keeps the script's words standing, which fails with the live baseline. A new readiness test has `page check` report a classic script's parse-time throw and rejection, which fails without the early-fault report. The plain-page corpus drops the obstacle; its four pages written as modules for this refusal are plain `<script>` again, and the `script` page now pins the two theme obstacles it reveals. Shipped instructions no longer steer page code to modules except for imports.
# Conflicts: # tests/browser/test_plain_pages.py
…ng the authored page from a second fetch Accepting classic and async scripts first moved the runtime's authored baseline to a re-fetch of the delivered document from the HTTP cache, matched against the live copy, with an early error buffer in the prepaint. That added a second baseline path, a cache dependency with a fallback on a miss, and a fault hand-off across three modules. Delivery now holds each script until the runtime has read the page instead, which keeps the one rule the refusal stood for: every page script runs after the runtime's module and while it listens. A classic script gains defer, an inline one by moving its text to a deferred data: file (global scope and sloppy mode kept, lines padded and sourceURL naming index.html so errors name their line), and async goes. Leaf's own runtime scripts are untouched. What a page gives up is running mid-parse, so document.write is ignored; page-behavior.md says so. The runtime, prepaint and version changes are reverted. The diff and early-fault browser tests pass with deferral and fail without it.
…ferring a script changes for an author The column journey asserted past-column for a fixed box crossing the column's edge, which the exemption lifts; it now asserts that box isn't read as a spill (it is still named for the prose it covers). page-behavior.md says that a deferred script sees the whole page and that an inline handler can fire before the function it calls exists.
leaf-agent
approved these changes
Oct 28, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 28, 2026
… delivery uses (#4619) `page check` now reports everything wrong with a page in one run, and the CSS it refuses is decided by the same reader delivery uses, so nothing passes the check and then fails at delivery. Part of the "Primitives, not a template" survey (`SOUL.md`), after #4490, #4546 and #4554. ## Behavior that changes - **Markup errors no longer hide page-file problems.** A page with a markup error stopped there, so a missing `page/` file or broken stylesheet surfaced only on the next run. Capture now runs beside markup validation over one walk of the document, and each problem is reported once, by the check that owns it (`validation/source.py`, `revision_artifact._collect`). - **A broken `page/registry.json` reports one problem per declaration.** The registry stopped at its first error. It now collects the first problem in each widget entry and each missing layer fact (`registry/state.gathering()`), so a registry with several bad entries takes at most a few runs instead of one per entry. `RegistryError` and the layer refusals carry a list of findings. A boolean attribute schema (`true`/`false`) reads as typeless instead of crashing the check. - **One reader judges CSS syntax.** `revision_artifact._read_css`, the reader delivery rewrites sheets with, decides `css-syntax` for pages, messages, templates and declarative shadow roots alike; the walk check and delivery share (`structure.delivered_elements`/`delivered_sheets`) means a sheet the check skips is one delivery skips too. - **A declaration the browser drops is advice on a page.** `css-dropped` (for example `color: ;` or a stray `broken;`) no longer refuses a page: the browser ignores the declaration, the page renders the same outside Leaf, and the author sees the finding. A package's stylesheet still refuses it, since packages are maintained code (`layer._stylesheet`). `validation.md` says so. ## Checks The model tests for authored markup, the layer and registry contracts, media, vocabulary, document and layer inspection, module delivery and page inspection (885 passed, after merging current `main`), and `pnpm run check`. Codex reviewed each commit; its findings (the two CSS parsers disagreeing, a problem reported twice, the template and shadow-root walks diverging, a crash on boolean schemas, several missing layer facts merged into one finding) are fixed here. > _This was written by Claude Code on behalf of max-sixty_
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.
Three more refusals lifted under "Primitives, not a template" (
SOUL.md), each decided by the maintainer after the plain-HTML corpus from #4546 surfaced it.Behavior that changes
asyncscripts are accepted.page checkrefused a classic script that wasn'tdefer src(parser-blocking-script) and anyasyncscript (async-script), because either could run before the runtime's module read the page and before it listened for errors. Delivery now holds every authored script until then instead (revision_delivery._deferred): a classic script gainsdefer, an inline one by moving its text to a deferreddata:URL that keeps its global scope (lines padded andsourceURL=index.html, so errors name their line), andasyncgoes. Leaf's owndata-lf-runtimescripts are untouched. A page gives up running mid-parse:document.writedoes nothing, a script sees the whole page, and an inlineonloadcan fire before the function it calls exists;page-behavior.mdsays so. The runtime is unchanged.past-columnread aposition: fixedbox overlappingmain's edge, such as a badge pinned to the window's corner, as content spilling into the margin. A fixed box hangs off the window and can't scroll the page sideways, so it now answers for itself wherever it stands. One drawn over the prose is still named bycovered-words.The plain-page corpus drops all three obstacles, and its four pages written as modules only because of the script refusal are plain
<script>again.Design note
The first implementation of the script change read the authored page from a second, cached fetch of the delivered document and matched it to the live DOM, with an early error buffer across the prepaint and layer client. Deferring at delivery keeps the one rule the refusal stood for (every page script runs after the runtime has read the page) with about 40 lines in delivery and no runtime change, so it replaced that.
Checks
pnpm run check,pnpm run test:runtime, the delivery and document model tests, the corpus (8 expected failures, every pin matching), and the render-gate, column and journey tests each change touches. The script diff test and the early-error test pass with deferral and fail without it; the fixed-box assertion fails on the old rule. Codex reviewed both commits; its two findings (a journey still expecting the fixed-box refusal, and the author guidance understating what deferral changes) are fixed.