Skip to content

Put the control face back ahead of the rules that override it, and let a container move a part that records its own facets - #847

Merged
max-sixty merged 5 commits into
mainfrom
ci-green
Sep 19, 2026
Merged

max-sixty merged 5 commits into
mainfrom
ci-green

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Main's nightly job has been red since #830 and #797. This repairs its seven failing cases, each at its cause.

The control face lost its place in the cascade (#830, five cases). .lf-ui is the face offer() gives every control a widget builds, and it is a default: it stood early in theme.css so that a component naming the same property later would win on ordinary cascade order. #830 moved the components into shadow.css, which layer.py composes ahead of each root's theme.css, so the default ended up after them and beat them. .lf-compose-submit asked for the accent and drew near-black ink on Send and on Add option. The face now opens shadow.css, which puts it before every component rule in the layer, and a control a widget seats inside a declared shadow tree now gets the face, which it did not before.

test_the_injected_control_face_stands_before_every_rule_that_answers_it pins that order from the files, and it fails on the sheets #830 left. test_a_coined_class_cannot_reach_the_chromes_rules pins the deliberate document-level class surface and asked to be widened: #830's aim floor names seven chrome-scoped presses at document level, and the chip and the margin entry leave the list because nothing inside the chrome's scope names them any more. The comments in chrome.css and skills/leaf/assets/CLAUDE.md that said the shared faces live in theme.css now name shadow.css too.

A container could not move a part that records facets of its own (#797, one case). position_record_error finds the owner of a moved part by walking up to the nearest widget that records durable state. The walk started at the part itself, so a part with a recorded facet of its own counted as its own owner, and its container's move was refused. The browser's event endpoint already ran this check before #797; #797 sent the suite's seeding through the same door, which is how a nightly case found it. No shipped widget has such a part, so only a package's widget could reach the refusal. The walk now starts at the part's holder.

A seed the door now refuses (#797, one case). test_a_quoted_widget_exhibits_without_taking_input seeded an accept on a quoted suggestion. The door refuses an action on quoted material from every sender, so the test now asserts that refusal, and that the quoted suggestion stands undecided.

Locally, the complete suite with nightly passed on this branch except the preview-server cases in test_render_export.py. Those fail the same way on origin/main and on the commit before these changes under this machine's current load, with different parameters failing on each run.

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

🤖 Generated with Claude Code

max-sixty and others added 5 commits September 19, 2026 01:03
…swer it

`.lf-ui` is the face `offer()` gives every control a widget builds, and its whole
contract is that it is a default: it stood early in theme.css so that any
component naming the same property later won on ordinary cascade order. #830
moved the components into `shadow.css`, which `layer.py` composes ahead of each
root's theme.css, so the default ended up last and beat them. `.lf-compose-submit`
asked for the accent and drew near-black ink, on Send and on Add option alike, and
the diff surface's inline thread reply drew the same.

The face moves to the head of `shadow.css`. That is one place before every
component rule in the layer — this sheet's own, theme.css's, and a package
theme's — so the default is a default again, and a control a widget seats inside a
declared shadow tree now gets it at all, which it did not before.

`test_a_coined_class_cannot_reach_the_chromes_rules` pins the deliberate
document-level class surface and asked to be widened on purpose. #830's aim floor
is one plain selector list naming every press in the layer, so seven of the
chrome's scoped names now carry a document-level rule that states a minimum on two
axes and nothing else. The chip and the margin entry leave the list for the other
half of the same change: nothing inside the chrome's scope names them any more.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…the quoted-input door

#797 sent every writer through `event_contracts.append_admitted`, including the
suite's `append_command`, and two nightly cases that seeded the log directly
went red.

`position_record_error` asks whether the action widget owns the unit it moves
by walking up to the nearest widget that records durable state. The walk
started at the unit itself, so a part that records a facet of its own was
counted as its own owner and its container's `move` was refused.
`test_a_part_and_its_own_widget_keep_same_named_facets_independent` states the
rule this broke: facet names are local to the widget contract that declares
them. No shipped widget has such a part — the board's cards and the swipe
deck's cards record nothing — so the refusal reached only a package's widget,
and the browser endpoint already asked this question before #797. The walk now
starts at the holder, and a self-position record, whose unit is the action
widget, skips the question.

`test_a_quoted_widget_exhibits_without_taking_input` seeded an accept on a
quoted suggestion to show that a quoted widget reconciles the state the log
holds. The door now refuses that accept from any sender, which is the same
exhibit rule the browser controller enforces, so the state cannot be written.
The test asserts that refusal, and that the quoted suggestion stands as the page
wrote it, undecided.

`test_the_injected_control_face_stands_before_every_rule_that_answers_it` pins
the previous commit's fix: in the layer's composed order, the first rule that
states a face is `.lf-ui`. It fails on the sheets #830 left. chrome.css's list
of where each shared face lives and `skills/leaf/assets/CLAUDE.md` now name
shadow.css beside theme.css.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit a6c73f3 into main Sep 19, 2026
5 checks passed
@max-sixty
max-sixty deleted the ci-green branch September 19, 2026 10:20
max-sixty added a commit that referenced this pull request Sep 19, 2026
`: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 added a commit that referenced this pull request Sep 19, 2026
…ing part one place (#848)

#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:

- `test_a_diff_is_colored_by_each_files_own_path` now asserts that every
line number wears its own file's code face. It fails on a plain
`.lf-ui`.
- The new
`test_a_pages_own_element_rules_leave_the_layers_controls_alone` serves
a page with that rule and reads a board's controls. It fails on
`:where(.lf-ui)`.
- `test_the_injected_control_face_is_a_default_only_the_document_reads`
replaces #847's position test. It requires this rule to be the layer's
first face and the face's only statement, and fails on both variants.

`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

- The everyday suite: 1178 passed. The nightly selection over the eight
files this touches (`test_render_options`, `_projection`,
`_conversations`, `_drafts`, `_anchors`, `_options_addition`, `_gate`,
`_widgets`): 765 passed. Pre-commit is clean.
- The complete suite with `--run-nightly` ran on an earlier revision of
this change, before #847 landed: 2789 passed. The only failures were the
preview-server cases in `test_render_export.py`, whose failing set
changed on every run; #847 reports the same.

> _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 (1M context) <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 19, 2026
`nightly` on `main` failed at
[767e36c](https://github.com/max-sixty/leaf/actions/runs/35430767109)
with seven failures and one error.
[#847](#847) has since landed the
seven; this is the error, which #847 does not reach. The Leaves tray
throws when a state read finds it gone from the document, and the throw
comes back out of the whole state application, so a page reports `State
presentation failed` for chrome it no longer has.

## What happens

`bake()` takes the copy by removing `.lf-chrome` from the live page
([`standalone.js`](https://github.com/max-sixty/leaf/blob/a6c73f3d88689fe4eca4185be640480f9f74b860/skills/leaf/scripts/leaf/render-checks/standalone.js#L207)),
and that page's state stream goes on running until `export_page` closes
the tab. A read that lands in the gap reaches `renderOthers` →
`presentLeaves` → `LiveLeavesList.present`, which throws `Leaves
presentation needs its connected tray` for the handle its own
`disconnectedCallback` has already dropped. `state-application.js`
catches it, reports `State presentation failed: …`, and rethrows, so the
read reports again as `read failed: …` — the pair, twice over, that the
run recorded:

```
ERROR tests/test_render_export.py::test_a_copy_carries_a_workers_standing_report
  'leaf: State presentation failed: Leaves presentation needs its connected tray'
  'leaf: read failed: Leaves presentation needs its connected tray'
  … the same pair again
```

Whether a read lands in that gap is a matter of the machine's load,
which is why this arrives as an occasional error on a copy that is
itself correct: alone it passes, and it reproduced once on `a6c73f3d` in
a seven-case selection and not in two repeats of the same selection.

## What changes

A tray that has left the document has no region to present into, so
`presentLeaves` returns without presenting. That is the rule the runtime
already states for clock-driven paints — `tickClock` culls an entry
whose `owner.isConnected` is false — applied to the one caller that
paints directly. `renderOthers` is clocked on the list rather than on
`document.body` for the same reason: the body never leaves, so a clock
owned by it would go on repainting a tray that has.

The rule is stated in **Standalone copies and print** in
`skills/leaf/assets/CLAUDE.md`, beside what else baking takes off the
live page, because the next chrome paint added here faces the same gap.

## Verification

`test_a_state_read_outlives_the_chrome_the_copy_takes_out` takes
`.lf-chrome` out directly and provokes a read, so the gap is the
arrangement rather than the weather. Against the unchanged runtime it
fails with exactly the production text; with the change it passes. It
sits in `tests/test_chrome_contracts.py` rather than beside the copy
tests: it arranges the gap without any export machinery, so it is one of
the shared chrome contracts the everyday gate holds, and a later change
dropping the guard is caught on the pull request rather than on main's
nightly.

<details><summary>Suite run</summary>

`uv run pytest tests --run-nightly -n 3` is green apart from failures
this sandbox owns and that reproduce on the unmodified tree: four
`test_render_commands` cases and two `test_render_export` cases where
the installed Chrome will not launch here,
`test_staged_writes_honor_umask_without_copying_a_replaced_symlink_mode`,
and the demo recorder. `tests/test_interact_session.py`,
`tests/test_website_server.py` and `tests/test_live_shell_artifact.py`
are deselected: the first two need a writable `/tmp`, which the agent
sandbox mounts read-only, and the third needs `worker/node_modules`.

</details>

---------

Co-authored-by: leaf-agent <[email protected]>
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