Repository navigation
Find declared shadow roots from the stage registry, and row direction without style - #3266
Merged
Merged
Conversation
… without style The corpus comment painted in 238 ms (paired bench-latency, five runs, load 8-10 on 18 cores) against the 100 ms budget, and the server's reading reached the screen in 539 ms. `leaf-dev profile corpus comment` put most of that in script, not in the theme's `:has()` rules: - An obligation whose widget stands in an unopened thread message has no node in the document, so each `elementById` of its id fell through to `shadowRootsIn`, which queried the whole document for every x-shadow tag. Each atlas worker's goal and each read of where the user stands asks for every obligation's source, so one comment ran hundreds of those queries. `shadowRootsIn` now filters the stages' registry (`liveStages`), keeping roots whose host is `root` or in `root`'s own tree, as the query found them. - `rowArrows` read the computed `direction`, so each diff file's key availability recalculated style for whatever the frame's pass had written before it, up to 5,700 elements at a time. It reads `:dir(rtl)` now, which the `dir` attributes decide, as the theme's direction rules already do. A declared root is now exactly a stage: `declaredRoot` also requires the root to be one (`isStage`), so the page reading, `elementById` and the composed-range capture agree about a root a module attached itself, against module-authoring.md, and read its host by its own children. The drift test widget and three runtime tests built their roots that way, and now stage them through `shadowStage`. `arrivals.js` imports `under` from `shadow-tree.js`, and the keyboard dispatcher's closure admits `arrivals.js`, which reaches only modules already in it. Behavior change: a page that sets `direction: rtl` in CSS without a `dir` attribute now gets left-to-right arrows on its rows, matching how the theme already draws such a page. After both, the same paired run reads painted 91 ms [83-98] and Sent 179 ms [171-190]. `notes/browser-reactivity.md` records the finding, the commands and what still holds Sent over 100 ms. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 20, 2026
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 corpus page's comment painted in 238 ms against the 100 ms budget (paired
leaf-dev bench-latency --page corpus --transition comment, five runs, load 8–10 on 18 cores), and the server's reading reached the screen in 539 ms.leaf-dev profile corpus commentput most of that in script, not in the theme's:has()rules, whichnotes/browser-reactivity.mdhad blamed:elementByIdof its id fell through toshadowRootsIn, which queried the whole document for every x-shadow tag. Each atlas worker's goal and each read of where the user stands asks for every obligation's source, so one comment ran hundreds of those queries.shadowRootsInnow filters the stages' registry (liveStages,arrivals.js), keeping roots whose host isrootor inroot's own tree, as the query found them.rowArrowsread the computeddirection, so each diff file's key availability recalculated style for whatever the frame's pass had written before it, up to 5,700 elements at a time. It reads:dir(rtl)now, which thedirattributes decide, as the theme's direction rules already do.A declared root is now exactly a stage:
declaredRootalso requires the root to be one (isStage), so the page reading,elementByIdand the composed-range capture agree about a root a module attached itself againstmodule-authoring.md, and read its host by its own children. The drift test widget and three runtime tests built their roots that way and now stage them throughshadowStage.arrivals.jsimportsunderfromshadow-tree.js, and the keyboard dispatcher's dependency-cruiser closure admitsarrivals.js, which reaches only modules already in it.Behavior change: a page that sets
direction: rtlin CSS without adirattribute now gets left-to-right arrows on its rows, matching how the theme already draws such a page.After both, the same paired run reads painted 91 ms [83–98] and Sent 179 ms [171–190]. Sent is still over 100 ms; the note records what holds it.
leaf-dev stillson the catalogue showed no visual change beyond the layer fingerprint inshare-link; four other states that differed once read unchanged when recaptured on the final commit.