Repository navigation
Give the layer a shadow sheet, and one aim floor that reaches every control - #830
Conversation
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]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
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.cssto the head of itstheme.cssmoves five blocks that stood at lines 874–2457 of the basetheme.cssto the front. I diffed every(at-rule conditions, complex selector)pair betweenshadow.cssandtheme.cssin both the kernel and the diff package for declarations that disagree on value: the only hit is.lf-margin-entry'smin-*, 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-chipflex centering are all restated inshadow.css, which reaches the chrome throughtheme.css. The retained.lf-msg.agentrules don't collide withshadow.css's.lf-conversation-msg.agentones, which is why the new duplicate-rule test stays green rather than being blind to them. /theme.cssleavingembedded_resources. NoruntimeResourcecaller asks for it — only/icon.svg,/registry.json,/shadow.cssand media — and the theme still arrives inlined in the<style>.scripts/mcp-app/direct-build.mjs.vendor.py'sbuild_mcp_appbundlespage-app.js, notdirect-build.mjs, so the committedskills/leaf/mcp-app/page-app.htmlisn't stale from this edit.- An older page directory without
shadow.cssfails_document_errorswith therun \leaf page init`` message rather than 404ing at runtime. tests/test_interact_layer.py::test_staged_writes_honor_umask_without_copying_a_replaced_symlink_modefails in my sandbox on155e6963as well as onade9886e— environment, not this branch.
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]>
|
Taking the second finding. Not taking the first one here. Dropping 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.
|
|
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 |
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]>
…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]>
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.cssandskills/leaf/packages/diff/shadow.cssare source files now, in place of thelf-shadowcomment markers and the runtime regex that used to cut those rules back out of the theme.layer.pycomposes each root's shadow sheet twice: into/shadow.css, whichshadow.jsfetches for every shadow root it adopts, and into/theme.cssahead 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 withmax().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 --interactiveraisedNameError: it inlined the theme from a variable the split renamed away. It reads both sheets through one helper now — the theme inline,/shadow.cssembedded forshadow.jsto fetch./shadow.css. Two more hand-written copies of the vendored file list, inleaf/http.pyandworker/server.py, stopped at the four names that predate it; both derive fromschema.VENDORED_FILESnow.routing.tscannot import the contract, sotest_the_worker_routes_every_file_a_page_vendorsreads its regex and requires every vendored file to match.worker/test/routing.test.tsasserted the same thing abouttheme.csswithout being able to fail, since it passed an unrouted path toisPageSessionFileRequest, which answers false for a null route as readily as for a stylesheet.delivery_sheetsno 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.pyreads scoped rules now, so it catches that class of copy.The branch review added two more:
shadow.cssjoined the vendored file tuple, so a page directory carries it and_document_errorsrequires it, but the presentation check still syntax-checkedtheme.cssby name. A malformed rule inshadow.csspassedversion checkand reached the reader as an unstyled widget with nothing said about it. The check reads the.cssnames 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_sheetssays 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.cssand/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-fileand 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.🤖 Generated with Claude Code