Repository navigation
Space the kernel manifest's entries so neighbouring modules merge - #5060
Merged
Merged
Conversation
kernel.json lists one module hash a line, sorted by path. Git conflicts when two branches change adjacent lines, so a runtime PR conflicted with main whenever main changed a module whose path sorts next to one the PR changed, though each line was right for its own module. A blank line now separates the entries, which prettier keeps, and those merges are clean. Replaying the 455 merges of main into PRs #4500 to #5045: kernel.json conflicted in 257. In 216 of those both sides changed the same module, and those still conflict, since the merged module is source no build has read. The other 41 merge cleanly with the spacing, and 30 of those would have been clean merges outright. For each of the 30, the textual merge equals a rebuild of the merged tree, byte for byte. The record's content is unchanged; only its layout.
…r-media # Conflicts: # dist/kernel/kernel.json
leaf-agent
previously approved these changes
Nov 2, 2026
…r-media # Conflicts: # dist/kernel/kernel.json
…r-media # Conflicts: # dist/kernel/kernel.json
leaf-agent
approved these changes
Nov 2, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
…kernel (#5287) Every branch that touched `browser/` carried a rebuilt kernel in `dist/kernel/`, so any two such branches conflicted there, whatever their sources did. Each merge of `main` then took a `checkout --theirs`, a `pnpm run build:browser` and a commit. This PR stops committing the kernel. Every install, checkout, preview and test serves the runtime's source modules, which installs already did wherever a merge left the kernel stale. Only a prepared installation, the website's build and container, compiles one. ## Why this design I replayed with `git merge-tree` the 102 merges of `main` into a PR branch since #5060 spaced `kernel.json`'s entries. 51 conflicted, 35 of them only in `dist/kernel/`. With no kernel committed, 16 would conflict, all in hand-written files. In 26 of the 35, both sides edited one runtime module, which git merged cleanly in the source. Its hash line in `kernel.json` conflicted anyway, since no build had read the merged module, so no layout of a committed kernel avoids those. The goal was no merge conflicts in generated files, with no build on the consumer's side, no build machinery of Leaf's own, no commit after a merge and no second branch. Each alternative breaks one of those: - A CI job that commits the kernel after each merge adds a commit per merge. - Installs following a build branch is a second branch. #1963 tried one, and #2889 replaced it with the committed kernel. - Compiling at install, or downloading a CI-built kernel, needs Node or a release pipeline and cache on the consumer's side. - A `.gitattributes` merge driver has to be configured in every clone, and GitHub's mergeability check ignores it, so PRs still show the conflicts. - A kernel whose output merges like its source needs a module format of Leaf's own in place of Rolldown's. ## What changes - **A resource request is answered from the execution its address names.** `runtime_selection.named_execution` serves a revision's resources from the execution the process already holds under the identity in their URL. Before, each request re-resolved the page's layer selection, a stat walk of its package copies, three times. A source module now costs the server about 0.3 ms rather than 1.3 ms. After a page's package copy is replaced, a request at the old address gets the old bytes that address names, where it used to get a 404; the next document load picks up the new copy. - **No committed kernel.** `dist/kernel/` leaves the tree, and `pnpm run build:browser` and `check:browser` no longer write or compare one. `current_kernel`, the in-place compile under `.tmp/kernel.lock`, and the `compiled_checkout` and `compiled_pages` fixtures are gone, so the suite's browser tiers test the source modules installs run. `prepare` always compiles a kernel into its own tree with `build/runtime-bundle.mjs`, and `read_runtime` serves it while it matches that tree's modules, as before. - **Exclusions.** The lint, typos, prettier, pre-commit and Dependabot publisher exclusions for `dist/kernel/` go, as does the site workflow's trigger on it. - **Preview.** `LEAF_PREVIEW_COMPILER_ROOT` is now `LEAF_PREVIEW_LAUNCHER_ROOT`, read by `preview.launching_checkout`. All a selected-runtime preview still takes from the checkout that launched it is the launcher that owns the session's hooks. ## Costs A page opens from about 250 more module requests. Median time to first showing the server's state, over 6 interleaved rounds with a cold browser cache on a loaded Mac: | | `main`: kernel | `main`: source modules | Kernel + server fix | This PR | |---|---|---|---|---| | `pr-walkthrough` | 583 ms | 1233 ms | 479 ms | 615 ms | | `triage-board` | 199 ms | 920 ms | 140 ms | 273 ms | A reload from the browser cache costs 15–35 ms more than the kernel. Before merge, only a pull request's website gate (the site build and `leaf-dev verify-site website-worker`) compiles the kernel and opens pages under it. `wt merge` skips that gate, as it does every site delivery check. `kernel_runtime_paths` reads the kernel only where one exists, so a package that ships a `runtime/bundle-*.js` passes `package check` on a git install and is refused on a prepared one. ## Tests `tests/smoke/test_smoke.py` no longer asserts that the page loads kernel chunks, and `test_native_document_layout.py` imports `/runtime/content-layout.js` rather than its kernel chunk. `dev/tests/model/test_distribution.py`, which held the committed kernel current, is deleted. Checks run: `pnpm run check:tools` and `check:framework`, the Dependabot publisher's tests, the model tests for revision delivery, layers and distribution, the server and website-route process tests, `tests/smoke`, `tests/journeys/test_distribution.py` (a prepared install compiles and serves its kernel) and the edited native-layout browser test. > _This was written by Claude Code on behalf of max-sixty_
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.
dist/kernel/kernel.jsonlists one module hash per line, sorted by path. Git treats changes to two touching lines as one conflict, so a runtime PR conflicted withmainwhenevermainchanged a module whose path sorts next to one the PR changed, even though each line was right for its own module. The kernel build now writes a blank line between the entries, a layout prettier leaves alone, and those merges are clean. The record's content is unchanged.How much it helps
I replayed the 455 merges of
maininto PRs #4500 to #5045 withgit merge-tree, rendering each side'skernel.jsonin both layouts:kernel.jsonconflicted in 257 of them.kernel.jsonwas the only conflict, so those merges become clean outright.Clean merges of
maingo from 145 to 175 of the 455.Cost
kernel.jsongains a blank line per entry. When this lands, each open runtime PR conflicts once on the new layout, resolved as any kernel conflict is (build/AGENTS.md).Checks
check:browserpasses, as doesbuild/runtime-bundle.test.mjs.read_runtimeparses the new file and serves the kernel.