Skip to content

Give the layer a shadow sheet, and one aim floor that reaches every control - #830

Merged
max-sixty merged 14 commits into
mainfrom
ask-other-button
Sep 19, 2026
Merged

max-sixty merged 14 commits into
mainfrom
ask-other-button

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Leaf states each face once in the theme, but a widget that renders into a shadow root never saw those rules, and the rule that floors every aim at a finger's 44px stood inside chrome.css's @scope, so it floored the six controls in the runtime's own chrome and nothing else. Measured on the corpus, 41 of its 73 buttons and all 21 of its margin entries stood below 44px under a finger.

skills/leaf/assets/shadow.css and skills/leaf/packages/diff/shadow.css are source files now, in place of the lf-shadow comment markers and the runtime regex that used to cut those rules back out of the theme. layer.py composes each root's shadow sheet twice: into /shadow.css, which shadow.js fetches for every shadow root it adopts, and into /theme.css ahead of that root's own rules. The aim floor is one plain selector list in that sheet, so it reaches the document, the chrome and every declared widget tree alike, and a face that states a smaller minimum of its own folds the floor in with max().

The last two controls under the floor were the diff's "Mark reviewed" and "Next unreviewed" presses. The bar they sit in was three numbers that had to agree with nothing holding them together — a 26px bar, 26px presses, and a hardcoded 32px negative margin pulling the file's body back over it — so the presses could not grow without sliding off the name line they stand on. The height, the gap above it and the width the name line reserves are stated once on .lf-diff-file, and the pull, the bar, the presses, the pinned offset and the reserved column all read them. Measured on the corpus: with a mouse the name line is 35px with a 26px bar, pixel-identical to before this branch; under a finger it is 50px with a 44px bar standing inside it.

Three things the work turned up, each fixed here:

  • leaf version export --interactive raised NameError: it inlined the theme from a variable the split renamed away. It reads both sheets through one helper now — the theme inline, /shadow.css embedded for shadow.js to fetch.
  • Every published page carrying a shadow widget 404'd on /shadow.css. Two more hand-written copies of the vendored file list, in leaf/http.py and worker/server.py, stopped at the four names that predate it; both derive from schema.VENDORED_FILES now. routing.ts cannot import the contract, so test_the_worker_routes_every_file_a_page_vendors reads its regex and requires every vendored file to match. worker/test/routing.test.ts asserted the same thing about theme.css without being able to fail, since it passed an unrouted path to isPageSessionFileRequest, which answers false for a null route as readily as for a stylesheet.
  • delivery_sheets no longer strips comments from the inlined chrome and marks sheets, and the chrome's duplicate copy of the reaction vocabulary — 19 rules identical to the theme's — is gone. test_interact_layer.py reads scoped rules now, so it catches that class of copy.

The branch review added two more:

  • shadow.css joined the vendored file tuple, so a page directory carries it and _document_errors requires it, but the presentation check still syntax-checked theme.css by name. A malformed rule in shadow.css passed version check and reached the reader as an unstyled widget with nothing said about it. The check reads the .css names out of the contract now; the column and its root tokens stay the theme's, which is the sheet the document itself is laid out by.
  • delivery_sheets says why it ships the sheets with their comments, and what that costs, so the next reader measures it and finds the answer rather than the question.

What to look at

  • skills/leaf/scripts/leaf/layer.py — the composition: which sheet each root contributes to /theme.css and /shadow.css, and in what order.
  • skills/leaf/assets/shadow.css — the shared faces, and the single selector list that states the aim floor.
  • skills/leaf/packages/diff/shadow.css — the action-bar tokens on .lf-diff-file and what reads them.
  • tests/test_render_gate.py::test_every_aim_the_layer_offers_takes_a_finger — a touch context over the corpus, measuring every visible control against the floor the page itself reports.

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

🤖 Generated with Claude Code

max-sixty and others added 12 commits September 18, 2026 14:08
Paused at a teammate's request while other branches work the same files.

Landed in the two commits on this branch:
- assets/shadow.css and packages/diff/shadow.css are real source files; the
  lf-shadow comment markers and the runtime regex that read them are gone.
  layer.py composes each root's shadow.css into /shadow.css for the stage and
  into /theme.css ahead of that root's own rules; shadow.js fetches /shadow.css.
- The aim floor moved out of chrome.css's @scope into shadow.css as one plain
  selector list, so it reaches page, chrome and widget trees. Faces that state a
  minimum of their own fold it in with max().
- delivery_sheets no longer strips comments from the inlined chrome/marks sheets.
- The chrome's duplicate copy of the reaction vocabulary (19 identical rules) is
  gone; test_interact_layer.py now reads scoped rules for that class of copy.

Still red: tests/test_render_gate.py::test_every_aim_the_layer_offers_takes_a_finger
reports 2 of 138 aims short under a finger — .lf-diff-review (110x26) and
.lf-diff-next (113x30) in packages/diff/shadow.css. Both need judgement rather
than a max(): the review press's height is taken back by a negative margin on
the file row, so raising it moves the header.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Three sheets conflicted where this branch moved rules out of them. In each
case main changed a rule this branch had relocated, so the resolution keeps the
move and carries main's change to the rule's new home:

- assets/theme.css and assets/runtime/chrome.css: main renamed the agent
  message's class from `.claude` to `.agent`. The conversation and reaction
  rules now live in assets/shadow.css, which takes the rename.
- packages/diff/theme.css: main quieted the line-comment press (a tinted fill
  and an accent glyph in place of the solid accent). That rule now lives in
  packages/diff/shadow.css, which takes the restyle.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The bar of presses a file wears on its name line was three numbers that had to
agree and nothing holding them to it: the bar was 26px, its presses were 26px,
and the file's body was pulled back over the bar by a hardcoded 32px — the bar
plus the 6px above it, restated. So the two presses could not grow to the touch
floor without sliding off the name they sit on, and they were the last two
controls on the corpus standing below 44px under a finger.

The height and that gap are now stated once on .lf-diff-file, and the pull, the
bar, the presses and the file's comment button all read them. The name line
takes a min-height from the same pair, so the row contains the bar it holds
rather than letting it hang over the first row of the patch.

Measured on the corpus: with a mouse the bar is 26px in a 38px name line, 5
above and 7 below; under a finger 44px in 56px, with the same clearance. The
line was 35px before, which is a visible 3px on every file header — it was 3px
short of holding its own press, which is why the press sat 5 above and 4 below.

test_every_aim_the_layer_offers_takes_a_finger is green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
/shadow.css joined the worker's page-resource list when the sheet became a file
of its own, and nothing held it there: the neighbouring theme.css line passes an
unrouted path to isPageSessionFileRequest, which answers false for a null route
as readily as for a stylesheet, so the assertion stood whether or not either
sheet routed at all. Losing shadow.css from that list 404s the fetch every
x-shadow widget makes.

Checked by taking shadow.css back out of PAGE_RESOURCE: the run goes red on
"expected undefined to be 'shadow.css'".

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The merge of main resolved theme.css's one conflicted block by writing our
whole side of the file over it (`git show :2:`), not just our side of the block.
That kept the move of the shadow rules out of the theme, and also reverted
every hunk main had merged cleanly elsewhere in the same file:

- #801's body strip, back from a transparent border to a margin. The margin is
  what switches scroll anchoring off, so the reader lost their place whenever
  the Threads panel or the asks tray took its strip.
- #801's removal of the column's sideways glide (`left` read
  --lf-shell-motion-x again, which nothing sets any more).
- #810's rewritten comment on --thread-card.

Six browser tests caught it, all on the panel and tray strip. The file is
re-merged three ways on its own and only the conflicted region resolved to our
side (empty: the block lives in shadow.css). Checked two ways: every file that
now differs from main is one the branch set out to change, and theme.css's own
edits on main are the 643 lines it made on the old base, the only difference
being main's .claude -> .agent rename on three of the moved lines.

packages/diff/theme.css had the same whole-file resolution and re-merges to the
identical file, since main's one change there was inside the moved block.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2286993 let the toolbar's 30px floor reach the review press and the file's
comment button: it deleted their own 26px minimums as redundant with the new
height, but those minimums were what had been out-ranking the shared
`.lf-diff-next, .lf-diff-review, .lf-diff-comment { min-height: 30px }` rule
by coming later at the same weight. With a mouse the review press stood 30px
tall in a 26px bar and outlived its file by 2px when pinned
(test_a_diff_keeps_the_file_named_while_its_hunks_go_past_...). That floor only
ever reached Next unreviewed, so it now names only Next unreviewed.

The name line's minimum is now what containment needs and no more — the bar's
gap plus its height — so a mouse keeps the 35px line a path already set (the
earlier rule grew it to 38px for nothing). Under a finger the line is 50px
and the 44px bar stands inside it.

The pinned press's `+ 5px` restated the same gap less the file's 1px border;
it reads --lf-diff-action-top now.

Measured on the corpus: mouse, 35px line, 26px bar at +5, 4px clear, as before
this branch; finger, 50px line, 44px bar at +5, 1px clear.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The export crashed. `version export --interactive` inlined the theme into its
<style> from a `theme` variable the move to shadow.css renamed away, so it
raised NameError (and ruff's F821 would have failed lint). The export now reads
both sheets through one local helper: the theme inline, shadow.css embedded
for shadow.js to fetch.

The diff's name line held a mouse-sized column open for its presses:
--lf-diff-actions was 32px or 150px while the presses grow to the touch floor,
so under a finger a comment-only file's path ran 4px under its press. The
column is now the bar's width derived from the same tokens as its height and
its gap. Measured on the corpus, a comment-only file keeps 14px between name
and press with a mouse and with a finger; a file with a review press reserves,
as before, for a comment press beside it.

`max(32px, var(--aim-floor))` was written into the margin entry and into the
rail's claim; it is --margin-entry once. Only :root sets --aim-floor, so
resolving it there reads the same value.

Comments still described the theme slice shadow.js used to cut out, and one
(banner.js) cited a refusal that no longer exists; they name shadow.css now.
tests/test_site.py listed the vendored page files by hand without shadow.css
and reads schema.VENDORED_FILES instead. test_interact_layer's two sheet walks
were near-copies and are one generator; both readings come out identical on
all 15 layer sheets.

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

A published page 404'd on /shadow.css and failed to start wherever a widget
renders into a shadow root. Two more hand-written copies of the vendored file
list stopped at the four names it had before shadow.css:

- leaf/http.py rebases a rooted path in a served script, stylesheet or
  attribute onto the page's own directory when the page is served under a
  prefix, as every page on the site is. shadow.js's "/shadow.css" was not on
  its list, so it went to the site root. The list was also written three times,
  once per regex; it is one alternation now, built from VENDORED_FILES.
- worker/server.py, the site's Python adapter, routes a page's paths by the
  same kind of list. It builds it from VENDORED_FILES too.

routing.ts is TypeScript and cannot import the contract, so
test_the_worker_routes_every_file_a_page_vendors reads its regex and requires
every vendored file to match. Taking shadow.css back out of routing.ts reds it.

Found by tests/test_site.py, which this branch had not run until now.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
One conflict, in tests/test_website_server.py's imports: main's #823 added
render_harness.consume_browser_errors beside leaf.schema's ASSETS while this
branch added VENDORED_FILES to that same import. Both are kept.

Merged with rerere disabled, so the resolution this branch's earlier merge
recorded for theme.css could not replay.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
main's #823 gave each browser fixture what the tests were holding: a context a
test makes from the lent browser is ended by the fixture, and
test_the_resources_a_fixture_owns_are_taken_from_that_fixture reds a test that
closes one itself. The aim gate's finger context was written before that rule
landed, so it kept its own try/finally.

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.

The layer split reads well and the aim floor lands where the PR says it does — I ran tests/test_interact_layer.py, tests/test_website_server.py::test_the_worker_routes_every_file_a_page_vendors, tests/test_render_export.py::test_interactive_export_runs_captured_local_behavior_without_a_host and the new test_every_aim_the_layer_offers_takes_a_finger locally, all green. One change rides along that I don't think the branch wants.

delivery_sheets dropping the comment strip adds ~72KB to the head of every delivered document. chrome.css and marks.css are inlined verbatim into a data-lf-sheets script in supervised_document's head, so this is bytes in the render-blocking HTML, not a cached asset:

base 155e6963 this branch
JSON payload 62,219 B 133,992 B
gzipped 11,311 B 39,344 B

The PR pairs the removal with the 19 duplicate reaction rules the chrome gives up, but those are ~85 lines out of a 126KB sheet — the comments are ~66KB of it, and they now ship to every reader on every page. CLAUDE.md's Working on the repository asks a change that adds work before presentation to name the user-visible benefit; I can't find one here, and neither the description nor 65a71a46 gives a reason. test_interact_layer.py's new duplicate-rule reading parses the source files on disk, so it doesn't depend on the delivered sheet carrying comments.

Restoring the @lru_cache-backed _uncommented (import, helper, call site — the three pieces 65a71a46 removed) puts this back. Happy to push that as a commit if you'd rather not hand-apply it; say the word. If the strip went on purpose, the reason belongs in the docstring that used to carry it.

Smaller: shadow.css is a vendored page file now, but validation/source.py's _presentation_errors — "Validate authored and vendored CSS" — still reads only theme.css. _document_errors requires shadow.css to be present, so a hand-edited page directory can carry a malformed one past version check, and the damage lands inside shadow trees where the reader sees an unstyled widget and no error. One more css_syntax_errors(shadow_css, "shadow.css") closes it.

What I checked and found clean
  • Cascade reordering. Hoisting each root's shadow.css to the head of its theme.css moves five blocks that stood at lines 874–2457 of the base theme.css to the front. I diffed every (at-rule conditions, complex selector) pair between shadow.css and theme.css in both the kernel and the diff package for declarations that disagree on value: the only hit is .lf-margin-entry's min-*, and --margin-entry: max(32px, var(--aim-floor)) folds the floor in, so it's a no-op.
  • Rules that left chrome.css. .lf-react-strip > .lf-react-trigger:is(:focus-visible, …), the @media (hover: none) opacity rule, and the coarse-pointer .lf-chip flex centering are all restated in shadow.css, which reaches the chrome through theme.css. The retained .lf-msg.agent rules don't collide with shadow.css's .lf-conversation-msg.agent ones, which is why the new duplicate-rule test stays green rather than being blind to them.
  • /theme.css leaving embedded_resources. No runtimeResource caller asks for it — only /icon.svg, /registry.json, /shadow.css and media — and the theme still arrives inlined in the <style>.
  • scripts/mcp-app/direct-build.mjs. vendor.py's build_mcp_app bundles page-app.js, not direct-build.mjs, so the committed skills/leaf/mcp-app/page-app.html isn't stale from this edit.
  • An older page directory without shadow.css fails _document_errors with the run \leaf page init`` message rather than 404ing at runtime.
  • tests/test_interact_layer.py::test_staged_writes_honor_umask_without_copying_a_replaced_symlink_mode fails in my sandbox on 155e6963 as well as on ade9886e — environment, not this branch.

Comment thread skills/leaf/scripts/leaf/schema.py Resolved
shadow.css joined VENDORED_FILES when it became a file of its own, so a page
directory carries it and _document_errors requires it — but the presentation
check still syntax-checked theme.css by name. A malformed rule in shadow.css
passed `version check` and reached the reader as an unstyled widget with
nothing said about it.

The check now reads the vendored sheets from the contract, which is the same
list the page's files, its routes and the worker's route table already come
from. The column and its tokens stay the theme's: that is the sheet the
document itself is laid out by.

Checked by putting the theme-only line back: the test goes red on
"shadow.css syntax error".

Found by the branch review on #830.

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

Copy link
Copy Markdown
Owner Author

Taking the second finding. ee20e30a checks every sheet the page vendors instead of theme.css by name, so version check now reports shadow.css syntax error on a malformed vendored sheet. It reads the list from schema.VENDORED_FILES rather than adding a second name to the function, which is where the page's files, http.py's route scoping and the Worker's route table already come from; the column and its tokens stay the theme's, since that is the sheet the document itself is laid out by. Checked by putting the theme-only line back, which reds the test on the shadow.css syntax error assertion.

Not taking the first one here. Dropping _uncommented was deliberate rather than incidental to the reaction rules: the repository owner asked in this session for comments to stay in what Leaf ships, and for the other places that strip them to be removed. The benefit is that the sheet a maintainer reads and the sheet a reader receives are the same bytes, with nothing in between that can differ.

The cost is real and matches my own measurement — 62,219 → 133,992 B raw, 11,311 → 39,344 B gzipped, render-blocking at the head of every delivered document. It is on his list with those numbers, and restoring the helper is a three-line change if he wants it back.

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

@leaf-agent

Copy link
Copy Markdown
Collaborator

ee20e30a closes the validation gap. _presentation_errors reads the .css names out of schema.VENDORED_FILES now, so a malformed shadow.css is reported instead of reaching the reader as an unstyled widget, and the column and root tokens stay the theme's — which is the right split, since that is the sheet the document is laid out by. I ran the CSS-input cases on that head (uv run pytest tests/test_interact_contract.py -n0 -k "css_syntax_errors_in_every_source or stylesheet_as_css or column_from_what_a_page_states"), green.

Withdrawing the byte-size finding — the removal was asked for, the cost is measured and on the list, so it is a product decision rather than a review question.

One thing that outlives this PR: nothing in the tree records that the comments ship on purpose. The reason used to sit in the docstring beside _uncommented, and delivery_sheets carries none now, so the next reader meets a 134KB render-blocking payload with no rationale and asks the same question I did. A sentence there settles it whichever way the decision goes.

The review asked the question the code no longer answers: nothing recorded that
the strip was dropped on purpose, so the next reader measures the 72KB and puts
it back. delivery_sheets says why, and what it costs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit bdca942 into main Sep 19, 2026
4 checks passed
@max-sixty
max-sixty deleted the ask-other-button branch September 19, 2026 04:22
max-sixty added a commit that referenced this pull request Sep 19, 2026
…t a container move a part that records its own facets (#847)

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](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <[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