Repository navigation
Boot without a top-level await so every page loads eleven fewer chunks - #3904
Merged
Merged
Conversation
A top-level await in any module rolldown compiles turns off its chunk optimization (mergeCommonChunks, avoidRedundantChunkLoads) for the whole build. leaf.js had two, the live sample's wait and the annotation renderer's import, so the kernel shipped 41 runtime files and a page loaded 11 more before it presented. lf-trace.js had its own, which kept the website's rebundle unoptimized for any layer with the playwright package. leaf.js now runs the same boot sequence, in the same order, inside async boot(), called with boot().catch(reportError). reportError gives the window the same uncaught error event a rejected module evaluation fired (checked in Chromium and Firefox), so the prepaint still names a startup fault. lf-trace.js imports its vendor modules statically. A new ESLint rule, architecture/top-level-await, refuses a top-level await in the modules the kernel and the website compile, since nothing else reports one. Measured with `uv run leaf-dev probe <page> --base`: requests before presentation fall by 11 on triage-board (43 to 32), release-notes (51 to 40), review-a-plan, motion-playground and command-hub, with 3 KB less JavaScript and no time difference beyond run-to-run spread. In the website's rebundle over the kernel, leaf.js's static graph falls from 22 compiled files to 12. Behavior changes: bundle-runtime.test.ts no longer refuses a widget that imports the compiled widget-api.js chunk, which now holds modules the compiler merged into it; it still refuses the public module URL. test_a_boot_that_fails_after_it_waits_names_the_startup_fault is new and fails if the boot is started without reportError. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 25, 2026
Every opening fetched and evaluated CodeMirror (`vendor/codemirror.esm.js`, 345 KB) before the page first showed the server's state. `bundle-answer` imported it statically through the text field (`composing/text-field.js`), and `widget-api.js` re-exported `LeafEditorView`, which extends CodeMirror's `EditorView`. Only writing needs it, and an empty field already built its editor only when the user arrived in it. CodeMirror now loads with a dynamic import once the page has presented (`afterPresentation`, the route `floating-ui` takes), as an arrival the page answers for. The code that needs CodeMirror is built over the loaded module: the field's state, decorations and preview in `composing/field-editor.js` (`loadFieldEditor`), and the view class in `editor-view.js` (`leafEditorView(codemirror)`, one class per module). These modules stay in the page's static graph, so the kernel's chunks keep their shape. Importing `field-editor.js` lazily instead made the compiler regroup the shared chunks around it: four more requests on every opening with the compiler's chunk optimization off, as on main, and two more (`bundle-editor-view`, `bundle-widget-upgrade`) on top of #3904, which turns it on. Before its editor exists, a field holds a plain draft: its words, its selection, the words its history starts from, and the history steps its owner recorded. A field that must build before CodeMirror has arrived, because it holds words or the user arrived in it, keeps a rendering hold until the module lands. Meanwhile it shows its words plain in the empty line's place, with the draft's caret there while the user is in it. Typing lands natively in that place, and the field reads the words and caret back after each input, so the editor builds holding both. Words an input method is still composing join the draft when it commits, and the editor builds then. The editor's history starts from the draft's base words, with the early typing as one step undo takes back. Return still asks the owner first (`lf-edit-return`), and Shift+Return breaks the line. `widget-api.js` exports `leafEditorView(codemirror)` in place of `LeafEditorView`, and the file editor passes the CodeMirror module it already imports, so it gets the class synchronously, with no top-level await. Removing a public export breaks pages vendored before this change, so the page protocol moves to 25. Measured with `uv run leaf-dev probe <page> --base` against merge base c7e3d23, on the compiled kernel. Requests and JS bytes are those loaded when the page first showed the server's state (`presented`), the same in every run. | page | arm | requests | JS bytes | | --- | --- | --: | --: | | release-notes | base | 51 | 2,413 KB | | release-notes | this | 50 | 2,083 KB | | triage-board | base | 43 | 2,309 KB | | triage-board | this | 42 | 1,978 KB | Time to `presented` didn't move beyond run-to-run noise: medians of three runs were 510 → 411 ms and 323 → 314 ms at 1x, and in an earlier run against 936b607, 1,135 → 1,112 ms and 851 → 773 ms at 4x CPU. From a press of `c` to a focused editor in the page comment box (Event Timing on the keydown, measured against 936b607), focus was in CodeMirror's content node by the first animation frame after the press in every run of both arms. The keydown's input-to-paint duration was 16 ms at 1x on both arms; at 4x it was 64-72 ms on both, with handler time 27-30 ms on base and 33-35 ms here on release-notes. With CodeMirror held, focus lands in the field in the first frame, and in Chromium and Firefox the words typed meanwhile, a caret moved with the arrow keys and a Shift+Return included, are in the editor once it builds. Tests, both holding CodeMirror's module: - `test_words_typed_while_the_editor_loads_are_its_first_words`: the page presents and reads `arrived`; `c`, typing, a caret moved back and more typing reach the editor with the caret where it was; undo takes back the editor's typing, then the early words. - `test_a_kept_draft_and_an_input_method_reach_the_editor_as_it_loads`: words typed after a kept draft on reload follow it; an input method composing as CodeMirror lands commits its words once. On the merge base the first test times out, since the held module keeps the page from loading; on this PR's first version both fail (caret at 16 not 14; " wordsKept"). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The ESLint rule kept its own list of the modules the kernel and the website compile, and missed the compiled framework (vendor/browser-runtime) and widgets from packages outside the tree. The build's moduleBoundaries plugin sees every module rolldown compiles, so its transform hook now parses any module that mentions `await` and fails the build at a top-level await, for-await or `await using`, naming the module. The lint rule is gone. The committed bundles are unchanged (`pnpm run check:browser`). A kernel built from the merge base's leaf.js now fails with "leaf.js awaits at its top level", and the website's rebundle of a layer with the merge base's lf-trace.js fails with "widgets/lf-trace.js awaits at its top level". runtime-bundle.test.mjs covers both builds and a nested await they accept. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
browser/leaf.js takes main's boot and wraps it in boot() again; the kernel is rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
max-sixty
marked this pull request as ready for review
October 27, 2026 05:56
browser/leaf.js takes main's boot and wraps it in boot() again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
reviewed
Oct 27, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The new top-level-await refusal breaks historical comparison arms: the current bundler compiles those sources too. This needs to preserve the comparison workflow before approval.
leaf-dev probe --base and stills build an older tree's kernel with this checkout's compiler (distribution.py), and that tree's modules may await at their top level, so the refusal broke every before/after comparison against a runtime from before this change. The command-line entry, which only those arms call, now compiles with the refusal off; this tree's build and the website's rebundle still refuse. Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
previously approved these changes
Oct 27, 2026
browser/leaf.js takes main's boot and wraps it in boot() again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
previously approved these changes
Oct 27, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
previously approved these changes
Oct 27, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 27, 2026
Every opening fetched and evaluated CodeMirror (`vendor/codemirror.esm.js`, 345 KB) before the page first showed the server's state. `bundle-answer` imported it statically through the text field (`composing/text-field.js`), and `widget-api.js` re-exported `LeafEditorView`, which extends CodeMirror's `EditorView`. Only writing needs it, and an empty field already built its editor only when the user arrived in it. CodeMirror now loads with a dynamic import once the page has presented (`afterPresentation`, the route `floating-ui` takes), as an arrival the page answers for. The code that needs CodeMirror is built over the loaded module: the field's state, decorations, preview and row reveal in `composing/field-editor.js` (`loadFieldEditor`), and the view class in `editor-view.js` (`leafEditorView(codemirror)`, one class per module). `caretAt`, which main's #4116 exported for the field's row reveal, needs CodeMirror's `Direction`, so it is now the view's method (`view.caretAt(pos)`). These modules stay in the page's static graph, so the kernel's chunks keep their shape. Importing `field-editor.js` lazily instead made the compiler regroup the shared chunks around it: four more requests on every opening with the compiler's chunk optimization off, as on main, and two more (`bundle-editor-view`, `bundle-widget-upgrade`) on top of #3904, which turns it on. Before its editor exists, a field holds a plain draft: its words, its selection, the words its history starts from, and the history steps its owner recorded. A field that must build before CodeMirror has arrived, because it holds words or the user arrived in it, keeps a rendering hold until the module lands. Meanwhile it shows its words plain in the empty line's place, with the draft's caret there while the user is in it. Typing lands natively in that place, as does a selection the page sets, and the field reads the words and caret back after each input, so the editor builds holding both. Words an input method is still composing join the draft when it commits, and the editor builds then. The editor's history starts from the draft's base words, with the early typing as one step undo takes back. Return still asks the owner first (`lf-edit-return`), and Shift+Return breaks the line. `widget-api.js` exports `leafEditorView(codemirror)` in place of `LeafEditorView`, and the file editor passes the CodeMirror module it already imports, so it gets the class synchronously, with no top-level await. Removing a public export breaks pages vendored before this change, so the page protocol (`browser/runtime/kernel-registry.json`) moves from 28 to 29. A one-line field (`aria-multiline="false"`, #4323) holds one line in both forms: its editor turns a pasted or platform line break into a space and takes no Shift+Return, as on main, and the plain draft before CodeMirror arrives does the same. Measured with `uv run leaf-dev probe <page> --base` against merge base f90ff10 (first measured at 4789149; an independent run reproduced the release-notes figures), on the compiled kernel. JS requests and JS bytes (decoded) are those loaded when the page first showed the server's state (`presented`). Release-notes read the same in both runs. On triage-board, `markdown-it.esm.js` (102 KB) sometimes finishes just before `presented` on either arm, on a host at load 30-48; the table gives the reading without it, which base gave in 4 of 5 runs and this branch in 3 of 5. In every run on this branch `codemirror.esm.js` finished after `presented`. | page | arm | JS requests | JS bytes | | --- | --- | --: | --: | | release-notes | base | 45 | 2,494 KB | | release-notes | this | 44 | 2,156 KB | | triage-board | base | 38 | 2,360 KB | | triage-board | this | 37 | 2,022 KB | Time to `presented` wasn't measured on the new base, since the host was too loaded for timings to mean anything. On earlier bases it didn't move beyond run-to-run noise: medians of three runs were 510 → 411 ms and 323 → 314 ms at 1x against c7e3d23, and 1,135 → 1,112 ms and 851 → 773 ms at 4x CPU against 936b607. From a press of `c` to a focused editor in the page comment box (Event Timing on the keydown, measured against 936b607), focus was in CodeMirror's content node by the first animation frame after the press in every run of both arms. The keydown's input-to-paint duration was 16 ms at 1x on both arms; at 4x it was 64-72 ms on both, with handler time 27-30 ms on base and 33-35 ms here on release-notes. With CodeMirror held, focus lands in the field in the first frame, and in Chromium and Firefox the words typed meanwhile, a caret moved with the arrow keys and a Shift+Return included, are in the editor once it builds. Tests: - `test_words_typed_while_the_editor_loads_are_its_first_words`, in Chromium and Firefox, holding CodeMirror's module: the page presents and reads `arrived`; `c`, typing, a caret moved back, more typing and a Shift+Return reach the editor with the caret where it was; undo takes back the editor's typing, then the early words. - `test_a_kept_draft_and_an_input_method_reach_the_editor_as_it_loads`, in Chromium (the input method goes through CDP), holding CodeMirror's module: words typed after a kept draft on reload follow it; a selection the page sets (`setSelectionRange`) is where the next words land; an input method composing as CodeMirror lands commits its words once. - `test_an_unavailable_editor_module_leaves_fields_writing_plain_words`, with CodeMirror's module aborted: Leaf reports the failure each time a field asks for its editor, and the field keeps writing plain words, Shift+Return breaking the line and Return sending. On the merge base the first test times out, since the held module keeps the page from loading; on this PR's first version both fail (caret at 16 not 14; " wordsKept"). ## How it merges with other bundle work - #3904 (`grind/g-boot-tla`) moves `leaf.js`'s boot out of a top-level await. On top of it, at c7e3d23, this PR's chunk layout was the same 27 files as main's; the lazily imported `field-editor.js` alternative gave 30, two of them on the opening. With #3904's `architecture/top-level-await` rule this PR adds no top-level await. Not re-checked on the new base. - #3462 (Solid 2, draft) changes `composing/input.js`, the top of `widget-api.js`'s export list and the build scripts, and bumps the protocol too. It touches neither `text-field.js` nor `editor-view.js`. Expected conflicts: the protocol number (take one bump above whichever lands first) and `dist/kernel/`, which a rebuild resolves. ## Calls Max may reverse - The public API shape `leafEditorView(codemirror)`, which takes the CodeMirror module the caller imports. - `caretAt` as a method of the view class rather than a module export. - CodeMirror loads as an arrival after presentation rather than on idle or on a first pointer or key intent. In every measured run it had arrived before the probe pressed `c`. - The rendering hold covers the load only: an input method still composing when CodeMirror lands defers the build to its commit without holding the page's readiness on the user. ## Checks run On the merge with main at `b1fdabcb4`: `pnpm run check`; the three tests above; `test_render_options_addition.py`'s one-line phone case and add-field preview. On an earlier merge with main: - `pnpm run check`: the build check, framework (134 passed), runtime (562 passed) and Worker (85 passed) tests. - The three tests above (4 runs), and main's `test_a_scrolling_draft_shows_the_caret_s_row_with_the_padding_beside_it` in Chromium and Firefox (4 passed). - `-k` selections of `test_render_files.py` (file editor), `test_render_shift_watch.py`, `threads/test_layout.py`, `margin/test_card_reply.py`, `threads/test_rewrites.py` and `test_chrome_contracts.py` on editor carets, reveals and scrolling drafts (17 passed). Earlier, on c7e3d23: `tests/browser/startup/test_modules.py`, `tests/browser/drafts/test_composer.py`, `test_draft_editing.py`, `test_keys.py`, `tests/browser/threads/test_composing.py`, `tests/browser/test_render_files.py`, `tests/browser/test_chrome_contracts.py`, `tests/browser/test_render_export.py`, `tests/browser/test_render_words_watch.py` (230 passed). An independent review on 3a095de also checked: - #4116's row reveal and #3939's WebKit focus guard survive the move into the factory, each with a bug-back check (`test_sample_editor_focus_preserves_outer_scroll_and_the_caret` passes in WebKit and fails `assert 1386 == 0` without the guard). - Typing before CodeMirror loads, in Chromium, Firefox and WebKit. - CI's website build and `leaf-dev verify-site website-worker`, green on 3a095de. ## Not verified - An input method in Firefox or WebKit; the composition test drives Chromium's CDP. - Time to `presented` on the new base. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
previously approved these changes
Oct 27, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
previously approved these changes
Oct 27, 2026
leaf-agent
previously approved these changes
Oct 27, 2026
leaf-agent
previously approved these changes
Oct 27, 2026
leaf-agent
approved these changes
Oct 27, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 27, 2026
#3904 made the build refuse a module that awaits at its top level, since one such await turns off rolldown's chunk optimization for the whole build. It switched the refusal off for the build script's command-line entry, saying only a comparison arm's kernel (`leaf-dev probe --base`, `stills`) goes through it. That entry's one caller, `distribution.bundle_runtime`, builds the kernel of every prepared installation: the suite's browser tiers, previews and the website payload as well as comparison arms. So the refusal held only in `build/browser/build.mjs` (the `dist/kernel` build `pnpm run check` checks) and the website's `bundleRuntime`. ## What changed - **A lint rule refuses a top-level await.** `architecture/top-level-await` in `eslint.config.mjs` reports an `AwaitExpression`, a `for await` or an `await using` outside every function, over `browser/**`, `packages/*/**` and `examples/**/*.page/widgets/**`. Those are all the sources either build compiles: the kernel from `browser/`, and the website's rebundle from each published layer, which adds the packages' widgets and an example's own. The website rebundles only pages in this tree (`leaf-dev site`), so no compiled source falls outside the lint. CI's `pre-commit run --all-files` runs eslint. - **The build no longer checks.** `topLevelAwait`, the `transform` hook in `moduleBoundaries`, the `refuseAwaits` option through `compile` and `kernelOutputs`, and their test are gone. A comparison arm built from an older tree whose modules await at their top level now compiles without any flag, since nothing in the build refuses it. - `leaf.js`'s comment now points at the rule. The rule is a custom rule rather than a `no-restricted-syntax` selector. In flat config a file takes a rule's options from the last block that matches it, and the runtime's blocks (`ownerBoundary`, `entryBoundary`, the primitives and thread-model blocks) each set their own `no-restricted-syntax`. A selector would have to be copied into each of those lists, and a later block that left it out would silently drop it. ## Checks - Scratch files, deleted afterwards: the rule flagged a top-level `await`, a `for await` and an `await` inside a top-level `if` in a `browser/runtime/` module, a top-level `await using` in a `packages/playwright/widgets/` module, and a top-level `await` in an `examples/*.page/widgets/` module. It left alone awaits inside a function declaration, an arrow function and a class method, and `examples/developer/motion.page/motion.js`, a page script the builds don't compile. - `pre-commit run eslint --all-files` passes on the tree. - The rebuilt kernel is byte-identical apart from `kernel.json`, whose hash of `leaf.js` moved with the comment. - `pnpm run check`, and `tests/model/test_distribution.py` and `dev/tests/model/test_distribution.py` (which build through the command-line entry), pass. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Oct 27, 2026
…ir reviews pass (#4511) Renames `/grinding-backlog` to `/fan-out-backlog` and revises it with what the first campaign's later stages showed: its drafts going stale while they waited, the user's reversals, and Tend's review findings. - **When to run one.** The maintainer isn't sure a backlog campaign beats doing work as it comes up, and prefers that by default. So the skill says to run one only when there are many spare tokens, not on a schedule or from Tend. - **Land as you go.** Once a PR's review and the reviews of its fixes pass, the campaign marks it ready, and Tend reviews and lands it under `running-tend`'s **Landing**. In the first campaign, drafts held for the user waited 50 hours at the median while main took 297 commits. Other sessions fixed 6 of the 47 first, and the user then landed the rest with one choice. - **Additions wait for the user.** A PR stays a draft, with its decision on the user's page, when it leaves the user a call or adds something beyond the repair and its test: a new mechanism, gate, public option, dependency or protocol bump. The author's report lists these under a new `adds` field, and the reviewer checks the list. Each PR the user rejected or cut was an addition of this kind (#3876, #3896, #3854, #3962). - **Review weighs additions and every fix.** Reviewers weigh what a change adds (`/developing-leaf`, "Weigh what a change adds") and review every fix again. One unreviewed fix in the first campaign moved #3904's check into the build and broke the eval comparison arms, until #4486 moved it back. - **Counts come from GitHub**, since an orchestrating session that compacts several times loses its counts. Ready PRs go a few at a time, since six parallel landing agents once used up Tend's GitHub API quota. > _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.
Every page loaded eleven more kernel chunks than it needed before it first showed the
server's state.
browser/leaf.jsbooted with two top-level awaits (the live sample'slfSample.ready, and the annotation renderer's dynamic import). A top-level await inany module rolldown compiles turns off its chunk optimization (
mergeCommonChunks,avoidRedundantChunkLoads) for the whole build, which is how rolldown keeps a waitingmodule's execution order (
chunkOptimizationin rolldown's options types). Thewebsite's rebundle compiles each layer's widgets in the same build, so
lf-trace.js's own top-level awaits kept it unoptimized for any layer with theplaywright package even without leaf.js's.
What changed
leaf.jsruns its boot sequence, unchanged and in the same order, insideasync function boot(), called withboot().catch(reportError). The firststatement is still the sample wait, so nothing in the boot runs before a sample
child's connection, as before.
reportErrorhands a failure to the window as thesame uncaught
errorevent a rejected module evaluation fired, which the prepaintreads as a startup fault. Checked in Chromium and Firefox with a two-arm page: a
throw after
await 0at module top level and a throw inboot()reported byreportErrorfire identicalerrorevents (targetwindow, sameerror,message and line). The diff is mostly reindentation;
git diff -wshows thewrapper alone.
lf-trace.jsimportswebawesome.esm.jsandimages.esm.jsstatically, aslf-diff.jsalready imports WebAwesome. They evaluate in the same order as before,after the widget's other imports.
succeeds, and every page just loads more chunks.
moduleBoundariesinbuild/runtime-bundle.mjs, the plugin every compiled module passes through, nowparses each module that mentions
awaitin itstransformhook and fails thebuild at a top-level
await,for awaitorawait using, naming the module.That covers everything either build compiles: the runtime, and in the website's
rebundle every widget in the layer, from bundled packages or not. A kernel built from the merge base's
leaf.jsfails with
leaf.js awaits at its top level, and the website's rebundle of a layerholding the merge base's
lf-trace.jsfails withwidgets/lf-trace.js awaits at its top level. The committed bundles areunchanged by the check (
pnpm run check:browser). A comparison arm's kernel, whichleaf-dev probe --baseandstillsbuild from an older tree with this checkout's compiler(
distribution.py, through the script's command-line entry), compiles with therefusal off, since that tree's modules may await at their top level.
dist/kernel/is rebuilt: against currentmain, 44 runtime filesbecome 31.
Evidence
Requests and JavaScript at presentation, from
uv run leaf-dev probe <page> --baseagainst merge base c7e3d23 on thecompiled kernel, three runs per page. Request counts were identical across runs;
the time is the median and diagnostic only.
At 4x CPU throttling (
--cpu-throttle 4, three runs each), the gap holds: release-notes52 to 41 requests, triage-board 44-45 to 33-34 (one lazy module sometimes lands
before presentation under throttling, on both arms). Median presentation was 1,030
against 1,021 ms on release-notes and 760 against 774 ms on triage-board. On a local
server neither speed shows a time difference beyond run-to-run spread; the saving is
round trips, which cost more on a slower link.
The website's minified rebundle (
worker/bundle-runtime.mjs,bundleLayer), run inscratch over a layer with every bundled package beside the kernel the install
serves, as the site publishes a revision. The count is the compiled files a page
statically loads (leaf.js plus the widgets named), vendor modules aside:
Removing only leaf.js's awaits left this table unchanged for a layer with the
playwright package (22 files for leaf.js in both arms), which is why
lf-trace.jschanges too.
With optimization on, the compiled
widget-api.jsentry holds modules rolldownmerged into it, and a widget may import it for them.
bundle-runtime.test.tsasserted that
lf-suggestion.jsnever names/runtime/widget-api.jsat all; it nowasserts what that assertion protected, that the widget's runtime imports are compiled
chunks and never the public module URL.
Tests
test_a_boot_that_fails_after_it_waits_names_the_startup_faultrefuses theannotation renderer the boot waits for and checks that the page names its startup
fault. It passes on the merge base and on this branch, and fails when the boot is
started with
void boot()instead, where the failure becomes an unhandled rejectionthe prepaint doesn't read.
build/runtime-bundle.test.mjschecks that the kernelbuild refuses a runtime module's top-level
for await, the website build refuses awidget's top-level
await, and an await inside a function builds.Ran:
pnpm run test:runtime(550 passed),pnpm run check:browser,node --test build/*.test.mjs build/browser/*.test.mjs(29 passed),pnpm run check:worker(85 passed), anduv run pytest -n 2ontests/browser/startup,tests/browser/controls/test_live_samples.py,tests/browser/test_render_playwright_trace.py,tests/browser/test_render_initial_delivery.py,tests/model/test_distribution.py(179 passed, 1 failed). The failure,
test_package_reading_keys_work_while_history_waits_and_after_offline_fallback, isflaky on the merge base at the same rate: 5 of 10 runs passed on base, 4 of 10 here.
After merging current
main,browser/leaf.jsis main's boot wrapped inboot()again (a whitespace-blind diff against main shows only the wrapper and two lines
Prettier rewrapped).
node --test build/*.test.mjs build/browser/*.test.mjs,pnpm run test:runtime,pnpm run check, the boot-failure test, the live sampletests and two trace tests pass. The evidence tables above were measured against
the earlier merge base. Against current
main,uv run leaf-dev probe triage-board --base=origin/mainloads 44 requests (39 JS)before presentation on main and 34 (29 JS) on this branch.
Not verified
leaf-dev verify-site website-workerand the site build; the pull request'schecks run those.
How it merges with #3897 and #3462
grind/g-boot-codemirror) addsawait loadEditorView()at the top levelof
packages/file-editor/widgets/editor.js. The website's rebundle now refusesit, since it would turn chunk optimization off again for any layer with the
file-editor package (the kernel leaves package widgets native, so it builds). That
widget would have to define its element once the class arrives, for example in
loadEditorView().then(...). Otherwise the two touch different files exceptdist/kernel/, which a rebuild resolves. Load CodeMirror after the page presents, not before #3897 found that importing a lazy runtimemodule regrouped the kernel's shared chunks and added four requests; with
optimization on that may no longer hold, so that version could be measured again.
leaf.jsand adds no top-level await(scanned its
browser/tree). It replaces rolldown with esbuild inbuild/runtime-bundle.mjs, somoduleBoundariesbecomes an esbuild plugin andthis PR's
transformhook conflicts there. The premise is rolldown's(
chunkOptimization); whichever lands second should check whether esbuild'ssplitting changes with a top-level await, and move the check to the plugin's
onLoadif it does or drop it if it doesn't.dist/kernel/resolves byrebuilding.
Calls Max may reverse
including a package from outside the tree. The website build only runs over pages
in this repository (
leaf-dev site), so the refusal reaches a maintainer, and auser's own install never compiles widgets.
lf-trace.jschanges in this PR rather than in its own, because without it thewebsite keeps the unoptimized chunks for every layer that has the playwright
package.