Repository navigation
Define package and theme ownership contracts - #4205
Merged
Merged
Conversation
Separate widget, shadow, theme and control styles; stop selectors at nested ownership boundaries; expose semantic color and relative type tokens. Add an independent composition fixture with public data, actions and retained-state journeys. Make decision semantics explicit, validate per-instance whole values against named contracts, and check every exercised output with implementation and declaration provenance. Keep shared header and sample behavior in core and reduce the public package API. Add named personal themes captured during authoring, isolate developer fixtures from defaults, and update How it works and author references. Ordinary outcomes no longer imply decisions; packages use explicit stylesheet roles and existing pages require revendoring after this alpha contract change.
Identify Leaf entry requests from the delivered bootstrap marker, preserving authored scripts with the same filename. Retain sample publications after departure without probing the new document; inherit the page timeout and abort failed interception fetches at the browser network boundary. Cover classic-script collisions, navigation and failed fetches, and clarify nearest-owner sample dressing. Focused browser checks, full pnpm check and record render checks pass.
Replace the annotated page mockup with contribution boundaries: theme inputs, author composition, package-owned widget behavior, and a separate core record. Link the concrete release review as a distinct live example.
Replace bespoke HTML and responsive CSS with a Mermaid ownership graph. Keep the live example separate and use named diagram parts for comments. The page now loads the two diagram renderer modules (about 670 kB of JavaScript) to provide layout, routing and semantic comment targets.
Reconcile the composition, theme and package contracts with the current widget data API and inline documentation samples. Keep the stylesheet roles explicit for the new timeline package and refresh the generated runtime. Advance the page protocol to 27: the combined event meaning and public package API are incompatible with main's protocol 26. Older pages must be re-vendored before loading.
# Conflicts: # dist/kernel/leaf.js # dist/kernel/runtime/bundle-errors.js # dist/kernel/runtime/bundle-page-layout.js # dist/kernel/runtime/bundle-surfaces.js
Replace hand-built conceptual flows with the diagram package, keeping live examples and spatial SVG sketches separate. Show parallel action/startup paths and connect records to their shared readings. Checked all diagrams at desktop and 360px phone sizes, exercised selection and Undo with an independent reader, and passed page render validation and four documentation checks.
Re-freeze the eval delivery with explicit decision semantics and align event-log annotations with the admitted records. Keep projection and concurrent-init test setup on the declared instance and theme interfaces, surfacing worker failures instead of waiting for a timeout. Match the root-size scaling test to main’s current code-text sizes.
leaf-agent
approved these changes
Oct 26, 2026
This was referenced Oct 26, 2026
leaf-agent
added a commit
that referenced
this pull request
Oct 26, 2026
The margin pin geometry reader still requested `shownParts` from the package API after #4205 moved that observation to the diagnostic API. Read it through `__lfCheckApi()` so the existing touch clearance, option-card avoidance, and fold/unfold assertions execute again, preserving #4205's package ownership boundary. The release-notes case reproduced `TypeError: shownParts is not a function` on current main. With this one-line correction, all four reported cases pass (`uv run pytest tests/browser/margin/test_pins.py -k 'release_notes_pins_under or choice_s_pin or no_room_for_its_actions' -q`). The preceding and failing CI runs' JUnit artifacts confirm the same four cases changed from passing to this API error. No rendering or product behavior changes. Closes #4219 — automated triage Co-authored-by: leaf-agent <[email protected]>
This was referenced Oct 26, 2026
leaf-agent
added a commit
that referenced
this pull request
Oct 26, 2026
#4257) The starter widget journey still expected `theme.css` after #4205 moved starter widget styles to `widgets.css`. Update that assertion to the package's widget stylesheet, preserving the ownership change and the journey's package check, page vendoring, and rendered-widget checks. No product behavior changes. Validation: the exact journey fails with `FileNotFoundError` before the correction and passes afterward. Closes #4238 — automated triage Co-authored-by: leaf-agent <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Oct 26, 2026
The architecture diagram test now measures the diagram widget’s scrollport, preserving its assertion that the drawing fits without horizontal scrolling. After #4205 replaced the inline SVG with `lf-diagram`, the old prose-width figure measurement counted the widget’s intentional allocation into the page margins as overflow. The page’s appearance and diagram layout are unchanged. On current main, the original test reproduced `936 != 720`. Browser inspection showed a 303px SVG inside a 1,152px widget, while the surrounding figure remained 720px wide. The corrected `test_every_product_route_is_a_live_leaf_page` passes, including its phone-width root overflow checks. Python compilation and `git diff --check` also pass; Ruff is unavailable locally and remains for CI. Closes #4226 — automated triage Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 26, 2026
Every widget styled through a package's widget-shadow.css (the diff package's, lf-file-editor and lf-file-tree) drew with no package styles in Firefox: a diff showed bare line-number buttons over unshaded monospace text. #4205 composed those sheets as `@scope (:host(:is(...))) to (<foreign widgets>)`, and Firefox drops a `:host`-rooted scope whole for many limits, this one among them, even when the limit matches nothing (Firefox 158.0.1 stable and Playwright Firefox 155; Chromium and WebKit apply it). The same limit on the document scope works in all three. The shadow scope again has no limit, as before #4205. A package's widget-shadow.css therefore reaches everything its widgets' shadow trees hold, including core views placed there, such as a diff's threads and the widgets in their messages; no bundled module puts a foreign widget there itself. The document boundary is unchanged. packages.md now says the boundary is the document's, and that a nested `@scope (html[...] :scope)` condition works only in widgets.css, since a shadow tree's rules can't see the document. The CSS scope contract tests in tests/browser/threads/test_layout.py ran only in Chromium; both now run in Firefox and WebKit too. With the limit restored, the shadow test and test_rings' Firefox diff-focus test fail. That Firefox test had failed on main since the first completed run after #4205, and its cause issue read the failure as a focus problem, since the assertion names only the element it waited on. A browser test that fails, in its body or through the problems its browser fixture asserts at teardown, now saves a screenshot of each page it held under .tmp/test-results/screens/, which CI already uploads, and tests/AGENTS.md says to look at it before diagnosing. Closes #4218 > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 27, 2026
Main renamed the package sheets (#4205): each package's import entry is now its widgets.css or widget-shadow.css, so those move over their generated copies as theme.css and shadow.css did. The import entries take main's current content with their imports rewritten; layer.py keeps main's role-based composition and reads each sheet through stylesheet(). Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Oct 27, 2026
) The entry-hold lifetime test now installs output observation before recording the temporary route. #4205 added a persistent observer on the same `**/leaf.js` pattern, so the test counted two different handlers and failed before checking their lifetime. Production behavior is unchanged, and the original assertions still require a non-single-shot hold registered through the load wait and removed afterward. The named test failed on current main with the reported two-registration assertion and passes with this setup correction. CI artifacts confirm the same failure in run 40285962605 and a pass in preceding run 40281079878. Closes #4220 — automated triage Co-authored-by: leaf-agent <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Oct 28, 2026
Closing a render-check context while the output observer reads a fetched runtime entry can leave `Response has been disposed` in Playwright's shared connection. The next test then fails at `Browser.new_page`, hiding the originating callback. The observer now treats Playwright errors after its page closes as cancellation across the whole entry callback; errors on live pages still propagate, and fetch failures still abort their browser request. The regression holds the response-body boundary until context closure, then opens another page on the same browser. It fails before the fix with the reported `Browser.new_page: Response has been disposed` and passes afterward. This preserves #4205's output observation, including invalid publications from removed and navigated sample documents. Validation: the regression, both originally reported cases, the entry-route lifetime case, fetch-failure reporting, and both departed-sample cases passed (7 distinct cases). Ruff checks, formatting, and Python compilation passed. The separate package-output check fails on unchanged main with a `LayerComposition` argument mismatch, tracked in #4577. Closes #4231 — automated triage Co-authored-by: leaf-agent <[email protected]>
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.
Independent packages need to compose without silently taking over another widget's presentation or treating every action as a user decision. This change makes the theme, package, page-author and core responsibilities explicit, and exercises them with independently authored packages.
widgets.cssandwidget-shadow.cssstay within the package's widgets; theme sheets supply shared presentation;controls.cssdeliberately styles generated controls. Nested foreign widget interiors retain their own styling, while theme inputs inherit.The composition fixture combines a custom review widget, nested Options, a theme, and Diff-to-File-tree data. The merged contract uses page protocol 28, requiring earlier pages to be re-vendored before use; no compatibility layer is added.
Validation: browser build and type checks, runtime/browser/Worker suites, focused theme/admission/render-output/composition tests, documentation checks, and rendered desktop/360px phone review. An independent reader verified the diagrams and selection/Undo behavior. Full Python and website delivery checks run in CI.