Skip to content

Keep the control face out of declared trees, and give a self-positioning part one place - #848

Merged
max-sixty merged 6 commits into
mainfrom
fix-ci
Sep 19, 2026
Merged

max-sixty merged 6 commits into
mainfrom
fix-ci

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

#847 fixed the seven nightly failures on main. Two of its choices have effects no test covered. Both are measured here, and both are corrected without reopening those failures.

The control face reached lf-diff's shadow tree

#847 restored .lf-ui's rank by moving it to the head of shadow.css, the earliest part of the composed page sheet. shadow.css is also copied into every declared shadow tree, and inside lf-diff's, offer() marks more than controls. The line numbers, hunk separators and toolbar labels wear lf-ui, and until #847 they took the widget's own face. Now they take the control's. Line numbers go from 12.5px monospace in the diff's added, removed and context colours to 14px sans ink. Rows grow from 19px to 20.3px, and the toolbar labels grow from 11.5px muted to 14px ink. In all, 76 of the 199 .lf-ui faces in examples/pr-walkthrough.html change, and leaf.page has served this since publish-site deployed #847.

The rule keeps #847's position and its class specificity, and its selector is now :where(:root) .lf-ui. A declared tree copies the rule, but none of its elements descends from the document's root, so it matches nothing there. In the document it matches every element it did before, at the same rank. So the face still stands before every component rule, and Send keeps the accent. It still outranks the page's own element rules, and lf-diff's nodes keep their host's face.

An earlier revision of this PR used :where(.lf-ui) in theme.css instead. leaf-agent's review measured what that costs: with no specificity, a page's own button, a rule took the family and ink of 131 of corpus.html's 264 widget controls.

Measured against the commit before #847, the computed family, size, line height and colour of every .lf-ui element at rest are unchanged, in the document and in shadow trees, on examples/corpus.html (1013 elements) and examples/pr-walkthrough.html (199). With <style>button, a { font-family: cursive; color: red }</style> in corpus.html's head, 0 of its 264 widget controls take the page's family, the same as on main.

Three readings pin the three properties, and each fails only on the variant that breaks its own:

skills/leaf/assets/CLAUDE.md says the same beside its description of shadow.css.

A part could have two position authorities

#847 starts the ownership walk above the part, so a container can place a part that records a facet of its own, which is what the nightly case needed. The same change also admits a container's move of a part whose own contract records its position. The browser folds the two into different maps (projection/model.js), so it would place one node twice. The door now refuses a container's move of a part that positions itself: a node has one place, and the widget that records it is the node itself when its contract records its position, otherwise the nearest recording widget above it.

test_the_widget_that_records_a_parts_position_is_the_one_that_places_it posts a board move through /api/event against three registries. A card that records a facet of its own is admitted. A column that records, standing between the board and the card, is refused, and so is a card that records its own position. Dropping the new clause admits the third. No shipped package declares any of these arrangements.

The rule is stated where a package author reads it: $state.record in skills/leaf/assets/registry.json already said that body and position are each one slot within a tag and unit, and now says that a node has one place across tags as well. The refusal names that cause rather than ownership: position record unit 'card' records its own position, so action widget 'board' cannot place it.

Verification

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

🤖 Generated with Claude Code

max-sixty and others added 4 commits September 19, 2026 03:28
…aces outrank it

#830 moved the rules that refine `.lf-ui` into shadow.css, which the composition puts
ahead of theme.css, so `.lf-ui` came after them and won at equal specificity: a
composer's send glyph drew ink instead of the accent. `:where(.lf-ui)` ranks it below
every component rule wherever the composition puts it, and keeps it out of declared
shadow trees, where lf-diff's code lines wear `lf-ui` and take their face from the host.

test_a_coined_class_cannot_reach_the_chromes_rules enumerates the class surface #830
changed on purpose: the aim floor's seven controls join it, and the chip, margin entry,
reaction surface and trigger icon leave with the chrome rules #830 removed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…t one place

#847 put `.lf-ui` at the head of shadow.css, which also carried it into lf-diff's
shadow tree: the line numbers, hunk separators and toolbar labels wear `lf-ui` there and
took the control's 14px sans ink instead of the widget's face. `:where(.lf-ui)` in
theme.css ranks it below every component rule wherever the composition puts either, and
keeps it out of declared trees.

#847's ownership walk also admitted a container's move of a part that records its own
position, which the browser folds into two maps. The door refuses that move now.

Co-Authored-By: Claude Opus 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.

:where() removes the face's rank against the page's own <style>, not only against the layer's component rules. The cascade has no way to say "lose to the layer, beat the page", so dropping to zero specificity hands every page-local element rule authority over widget-injected controls.

Measured on examples/corpus.html served with <style>button, a { font-family: cursive; color: rgb(255,0,0); }</style> added to its head — an ordinary page-local rule for the page's own links and buttons:

tree button.lf-ui / a.lf-ui taking the page's face
a6c73f3d (this PR's merge base, #847) 0 of 264
fba18ee3 (before #847) 0 of 264
8b748a8b (this PR) 131 of 264

A component's own class rule is no defence, because it holds only the properties it states: .lf-ref states color and font-size, so its font-family goes to the page's a rule, and .lf-btn, .lf-compose-submit, .lf-react and .lf-board-destination move the same way. This is the failure runtime/chrome.css already names from the other side — "the 💬 button shipped that way, at 17px" in the @layer lf-reset comment, and test_the_adopted_sheet_decides_nothing_by_standing_last's "what the runtime lays over the page has to beat page and widget alike". The PR reopens it through the page's <style> rather than through sheet order, and the same blind spot applies: nothing reads a rule that never applied, so no case in the suite serves page CSS that collides with the chrome face.

Everything else holds. The lf-diff correction and the new door clause are both sound, and the finding is only the specificity.

Two directions that keep #847's fix without the page-side cost, both more than a one-line change — which one the layer wants is your call rather than mine:

  • Give the default a composition slot of its own. A per-root sheet that composed_sheets lands at the head of /theme.css and does not copy into declared trees is the fourth option the new theme.css comment doesn't consider. It restores rank by position — #847's correct instinct — while keeping lf-diff's tree clear and the page outranked.
  • Split the marker from the face. lf-diff adds lf-ui to Pierre's line numbers and separators as a marker — "useful chrome, but not source a comment can quote" — and the face follows only because one class answers both questions. A separate face class on what offer() builds lets .lf-ui keep class specificity and never reach vendored nodes.
How both readings were taken

Through the suite's own serve fixture, so the assets under test were each tree's own, with open_page waiting for presentation and upgrade. Worktrees at fba18ee3 and a6c73f3d ran the identical probe.

The page-CSS reading copied examples/ to a temp root, inserted the <style> above into corpus.html's head, then counted button.lf-ui, a.lf-ui whose computed font-family resolved to cursive. The 131 span 28 class combinations, the largest lf-board-destination (30), lf-compose-submit (16), lf-btn small (10), lf-ref (9), lf-request-press (9).

The second reading walked document and every shadowRoot under it for .lf-ui, recording computed family, size, line height and colour. Against fba18ee3 the readings are identical on corpus.html (1007 elements), pr-walkthrough.html (193) and command-hub.html (178) — so the lf-diff correction lands where the description says and nothing else moved. lf-diff is the only shipped widget declaring x-shadow, and no shipped registry declares a widget-unit position record, so the new door clause refuses nothing that ships; it reads correctly against projection/model.js, where a self-position folds into the shared positions map and a part position into the owner facet's own map.

Comment thread skills/leaf/assets/theme.css Resolved
`:where(.lf-ui)` dropped the face below the page's own element rules as well as the
layer's: a page's `button, a` rule took the family and ink of 131 of corpus.html's 264
widget controls. The rule returns to #847's position at the head of shadow.css with a
class's specificity, and `:where(:root) .lf-ui` keeps it out of declared trees, where
lf-diff's line numbers and separators take their face from the host.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@max-sixty max-sixty changed the title Rank the control face by specificity, and give a self-positioning part one place Keep the control face out of declared trees, and give a self-positioning part one place Sep 19, 2026

@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.

One point left, on the door clause rather than the face.

The new ownership rule is not written where a package author reads it. $state.record in assets/registry.json is the contract for what a position record means, and scripts/leaf/layer-registry.md sends its reader there — "registry.json remains the source of truth for the current custom vocabulary and its explanations; this contract does not mirror that inventory." That description already carries the neighbouring rule: Within one tag and unit, body and position are each one physical slot; value slots are keyed by their host attr, and attribute-set slots by their descendant attr. Distinct facets cannot claim the same slot. An author reading it concludes a card's own placement facet and a board's move are distinct slots on distinct tags — which is exactly the arrangement the door now refuses.

Nothing earlier tells them otherwise. In the new test the self-positioning arrangement publishes clean — publish(page_dir) asserts activated.error is None — so the first word of the rule arrives as a 400 on a reader's press, in a message that names ownership (position record unit 'card' is not owned by action widget 'board') when the cause is the card's own contract. CLAUDE.md's Working on the repository asks that the implementation, tests, and the owning protocol or reference stay aligned, and its Repository map puts a landed design's contract beside the code or into the public reference whose reader acts on it. Right now the rule lives in the door's own comment and a test docstring.

Extending that slot paragraph by a sentence is the whole fix — a node has one place across tags, so a container's part position is refused where the node's own contract records its position. Happy to push it, with a distinct message for the self-positioning branch, if you want it here rather than in a follow-up.

Selection run against the merged tree

tests/test_interact_layer.py and tests/test_interact_contract.py whole: 449 passed, 3 skipped. The one failure, test_staged_writes_honor_umask_without_copying_a_replaced_symlink_mode, is this sandbox's umask and touches nothing in the diff. Then test_a_diff_is_colored_by_each_files_own_path and test_a_pages_own_element_rules_leave_the_layers_controls_alone under --run-nightly, both green.

One thing the face scoping does not cost, which I had expected it might: the layer's own conversation seated inside lf-diff's root keeps the chrome face. Reading a diff with a standing comment on app.py · new line 2, .lf-say.lf-ui, .lf-compose-submit and .lf-receipt.lf-ui all compute system-ui at 14px in rgb(28, 27, 24) — their shadow.css component rules state the face themselves, so scoping the default out of the tree changes none of them. :where(:root) holds in the export too: /shadow.css goes in verbatim as a <style> per root (shadow.js's readShadowRules into shadow-stage.js), and version export writes that same markup as a declarative shadow root, so no element under it descends from :root in either medium.

…aces itself

`$state.record` in the kernel registry said body and position are each one slot within a
tag and unit, which reads as leaving a card's own placement and a board's move of that
card as separate slots. It now says a node has one place across tags as well. The door's
refusal for that case names the cause, the part's own position record, rather than
ownership.

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

Copy link
Copy Markdown
Owner Author

@leaf-agent Taken in 7ed8041, so there's nothing to push. $state.record's slot sentence now goes on to say that a node has one place across tags as well: where a node's own contract records its position, the node places itself, and a container's part position record naming it is refused. The self-positioning branch now refuses with position record unit 'card' records its own position, so action widget 'board' cannot place it, and test_the_widget_that_records_a_parts_position_is_the_one_that_places_it asserts each refusal's own words.

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

@leaf-agent

Copy link
Copy Markdown
Collaborator

Confirmed on 7ed8041c, and that closes my last finding.

The sentence lands in the contract an author actually reads: $state.record's slot paragraph now continues past "distinct facets cannot claim the same slot" to say a node has one place across tags, so the arrangement the door refuses is described where the reader forms their expectation rather than only in the door's comment. The refusal itself now names its own cause — the self-positioning branch returns records its own position, so action widget 'board' cannot place it while a recording container above still returns the ownership wording — and test_the_widget_that_records_a_parts_position_is_the_one_that_places_it reads each branch's words rather than only its status, so the two causes can no longer trade places behind a shared 400.

Ran the position selection in tests/test_interact_contract.py (53 passed) and tests/test_interact_layer.py whole (162 passed, 3 skipped) against this head; the one failure there is again test_staged_writes_honor_umask_without_copying_a_replaced_symlink_mode, this sandbox's umask and nothing in the diff. test is green on 7ed8041c too. Approved.

@max-sixty
max-sixty merged commit d6aa29b into main Sep 19, 2026
5 checks passed
@max-sixty
max-sixty deleted the fix-ci branch September 19, 2026 12:12
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