Repository navigation
fix: refuse a top-level await in the lint, not the build - #4486
Merged
Merged
Conversation
#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.
leaf-agent
previously approved these changes
Oct 27, 2026
leaf-agent
previously approved these changes
Oct 27, 2026
# Conflicts: # dist/kernel/kernel.json
leaf-agent
approved these changes
Oct 27, 2026
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.
#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 inbuild/browser/build.mjs(thedist/kernelbuildpnpm run checkchecks) and the website'sbundleRuntime.What changed
architecture/top-level-awaitineslint.config.mjsreports anAwaitExpression, afor awaitor anawait usingoutside every function, overbrowser/**,packages/*/**andexamples/**/*.page/widgets/**. Those are all the sources either build compiles: the kernel frombrowser/, 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'spre-commit run --all-filesruns eslint.topLevelAwait, thetransformhook inmoduleBoundaries, therefuseAwaitsoption throughcompileandkernelOutputs, 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-syntaxselector. 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 ownno-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
await, afor awaitand anawaitinside a top-levelifin abrowser/runtime/module, a top-levelawait usingin apackages/playwright/widgets/module, and a top-levelawaitin anexamples/*.page/widgets/module. It left alone awaits inside a function declaration, an arrow function and a class method, andexamples/developer/motion.page/motion.js, a page script the builds don't compile.pre-commit run eslint --all-filespasses on the tree.kernel.json, whose hash ofleaf.jsmoved with the comment.pnpm run check, andtests/model/test_distribution.pyanddev/tests/model/test_distribution.py(which build through the command-line entry), pass.