Skip to content

Build the leaf.page container from a prepared installation - #2143

Merged
max-sixty merged 1 commit into
mainfrom
committed-browser-bundle
Oct 9, 2026
Merged

max-sixty merged 1 commit into
mainfrom
committed-browser-bundle

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

leaf.page's container ran Leaf from the checkout's source tree, and the site build vendored every page from it too. A revision a hosted session wrote therefore captured the framework and runtime as separate source modules, which the browser fetched one by one through the Worker from the user's container, while consumer installs carry the compiled kernel.

leaf-dev site now prepares an installation first, with the same leaf_dev.distribution.prepare that builds the prepared branch. It writes it to .tmp/site-install with leaf_website beside it and runs every leaf command of the build from it. Dockerfile.website installs that tree instead of copying skills/leaf, so the container serves pages vendored by the Leaf it runs. leaf-dev journey local serves the site with leaf_website from the same installation, and verify-site wrangler builds its container context from it.

The Leaf that serves a page has to be the one whose runtime vendored it: layer.foreign_runtime refuses any other, and leaf page check already did. The website adapter skipped that check, so it now refuses such a page with a 500 that names the mismatch. The suite and refresh-previews build the site with the checkout's own Leaf, because they serve it with the checkout's adapter and the suite's browser probes import runtime modules a compiled kernel no longer has. site.build takes the Leaf to run as an argument for that reason.

The edge bundle now compiles a prepared kernel again with the widgets. Its Lit import stays rooted (/vendor/lit.js), and the revision's import map sends that to the release's own copy. bundle-runtime.test.ts builds its production layer from a prepared installation, and its website fixture no longer carries a framework the website never sees.

On alert-review, a revision a hosted session writes now loads 71 modules (2.2 MB) at startup, down from 256 (3.9 MB), counting the static import closure of leaf.js and the page's widgets. The edge documents are unchanged: 36 modulepreloads against 37, with the same bytes to within 2 KB. A site build spends about 10 s more on the preparation.

publish-site now also runs on changes to dev/leaf_dev/distribution.py and build/browser/build.mjs, which the site build depends on.

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

leaf.page's container ran Leaf from the checkout's source tree, and the site
build vendored every page from it too, so a revision a hosted session wrote
captured the framework and runtime as separate source modules rather than
the compiled kernel consumer installs carry.

`leaf-dev site` now prepares an installation (`.tmp/site-install`, with
`leaf_website` beside it) and runs every `leaf` command from it;
Dockerfile.website, `journey local` and `verify-site wrangler` install the
same tree. The website adapter now refuses a page another Leaf's runtime
vendored, as every other page server does. The suite and refresh-previews
build with the checkout's Leaf, since they serve with the checkout's adapter
and the suite's probes import source runtime modules.

On alert-review a hosted revision now loads 71 modules (2.2 MB) at startup,
down from 256 (3.9 MB); the edge documents are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 622b1a8 into main Oct 9, 2026
6 checks passed
@max-sixty
max-sixty deleted the committed-browser-bundle branch October 9, 2026 08: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