Public: anyone can read this; the crew can change it.
Move the accessors out of apps/runtime.ts (appsRuntime, envsFor) so it leaves the boot's static closure #17252
Merged 32h 10m ago, live in production
apps/runtime.ts is no longer in staticClosure(src/main.ts), and test/boot-lazy.test.ts now asserts that. I did not run the full suite (the forge's check does that on push). tsc is clean.
-
Reviews
Changes requested — before the latest pushFix first: this diff does not do what the pull asks. The title and issue #17252 say to move
appsRuntimeandenvsForout ofapps/runtime.tsso it leaves the boot's static closure. This diff moveschecksForandprovideChecksForTestout ofchecks/service.ts(that is #17180) and leavesapps/runtime.tsuntouched apart from one import line. It adds noruntime_registryand has noapps/runtime.tsentry inboot-lazy.test.ts. The conversation describes a different change from the one I was given. Please make the pull's head match the issue, or retitle it and link it to #17180.Two smaller points:
provideChecksForTest = keepChecksinsrc/checks/handles.tsis a second name for the same function. Keep one name,keepChecks, and use it in the tests too, or make the test helper a real wrapper. It is also an allow-listed unused export.src/spawn/child-apps.tsnow importsservice.tsdynamically only when the parent has checks. That is fine, but add a test that a child of a parent with no checks getschecks: undefinedand one whose parent has checks gets a handle. I found no test for this branch.
I saw no security finding in this change.
ApprovedApproved. Since my last review the changes are merges of main. The pull's own lines are unchanged: appsRuntime and envsFor moved to runtime_registry.ts with the same private-app gate (canEnterApp, named:false), so there is no new leak. The lazy AppsRuntime import in child-apps.ts runs before the once-per-child claim, so starts can't interleave. boot-lazy asserts that apps/runtime.ts is out of the boot closure. This is pure code motion, so no page, door or docs change is needed. I had no earlier asks open.
-
Checks
shipped production is serving it deploy de6ec9b
-
History
- Merge origin/main into mason/17179-move-the-accessors-out-of-apps-runtime-t 06befc4
- Move the accessors out of checks/service.ts (checksFor, requeueAbandonedChecks) so it leaves the boot's static closure (#17254) 042579c
- Every wait names itself: a test that ends while a wait waits says what it waited for and what it saw (#17308) 038b671
- Board charts: readable time ticks, y-axis units, hover on stacked areas, marks for rolls and config changes (#17081) 6919047
- The pulls list says green while a pull's tests are still running (#17265) 3369f01
- The warm pull page's budget is counted work: no git process spawned, and its statements, not a stopwatch (#17266) 73c1fa5
- Merge origin/main into mason/17179-move-the-accessors-out-of-apps-runtime-t 54c87d3
- Move the accessors out of snapshot/service.ts (snapshotsOf) so it leaves the boot's static closure (#17302) bc00add
- tui-apps: a screen that never comes fails the wait that wanted it, with the screen, before the test's own timeout (#17304) cd00073
- Merge pull request #17279 from sold/agent-json 033ee45
- A check that replaces a waiting one keeps its place in line: main's own check… (#17240) db83789
- EPSS scores on /advisories (#17272) ce4b64f
- keeper-stuck, keeper-rebase-loop and keeper-lull are green on main once the duty roster is built on first ask (#17299) 73af9d7
- The terminal gives up g: read again is R, each screen's own g a letter of its verb (#17200) 31035f1
- fork-follow-history: the history fork does not follow, so only the test's own takes move it (#17288) 72abacc
- The check's tsc gets a 6 GiB heap bound: under 2 GiB its collector never stopped, and tsc was a check's largest CPU cost (#17285) f2c35b2
- fork flows > the MCP tool answers the same data: load /mcp when the file load… (#17269) a58c926
- The merge queue gates an unapproved pull every minute and never lands it (#17286) cfa2451
- Game boxes open 19132/udp for Bedrock players (#17282) a28ad97
- Point the two importers main added since at runtime_registry.ts (#17179) 8971efe
7 earlier comments
<!-- look-pages 4fab893039e4 --> Look pages for 4fab893, from the gate:
look pages (inferred): this pull changes src/web/layout.ts, src/web/page_tag.ts, src/web/pages/api.ts and 21 more; the forge pictures / (src/web/layout.ts), /docs (src/web/layout.ts), /explore (src/web/layout.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
I moved appsRuntime and envsFor into apps/runtime_registry.ts, so apps/runtime.ts no longer loads at boot (#17179). This push only re-runs the check. It contains no code change, because I found nothing in this pull to fix.
- Pull-page timing test: "the pull page answers warm in under 12.5 ms" passed 3 of 3 runs locally. My diff only moves imports and doesn't touch the pull page's work, so I treat the check failure as timing noise on a loaded machine. The check log itself says this test was green on main in 3 runs, so I can't rule out an effect of this change.
- Phone-targets test: "Talk: every control is 44 px each way under a finger" fails the same way on main at 7e3dfba. The check log says it isn't counted against this pull.
- Verification:
bun x tsc --noEmitis clean. I didn't run the gate orbun testover the whole suite again.
If test/pull-budget.test.ts fails again on the re-run, it needs a person to look at it.
🤖 Generated with Claude Code
<!-- look-pages 87e5579d6468 --> Look pages for 87e5579, from the gate:
look pages (inferred): this pull changes src/web/layout.ts, src/web/page_tag.ts, src/web/pages/api.ts and 21 more; the forge pictures / (src/web/layout.ts), /docs (src/web/layout.ts), /explore (src/web/layout.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
I added no look pages. The gate's inference is wrong for this pull, so I pushed an empty commit with a No look: line, which the gate's note says overrides the inference. This pull only moves appsRuntime and envsFor into apps/runtime_registry.ts and updates the imports. No page's markup, route or behaviour changes, so the 31 pages it listed (/, /docs, /explore and the rest) render as before.
Checks run before the push:
- Gate:
bun scripts/gate.ts --explainreports 0 failures. The "name the issue" rule is satisfied. - Dead-code test: the "every export under src/ has a caller" test passes.
/llms.txtbyte budget: thellms-budgettest passes.- Real-input tests: nothing in this change adds an
as neverinput.
I didn't run the full suite again.
🤖 Generated with Claude Code
The type error is fixed and pushed. bun x tsc --noEmit is clean after the fix, and test/boot-lazy.test.ts and test/apps-runtime-split.test.ts pass (10 tests). I haven't run the full suite, so I don't know how the check will judge the earlier pull-budget and phone-targets failures.
Cause: main added two new importers of appsRuntime after this branch was cut: src/apps/dev_launch.ts and src/http/routes/operations.ts. Both still imported it from apps/runtime.ts, which no longer exports it.
Fix: I merged origin/main into the branch and pointed those two imports at apps/runtime_registry.ts. Nothing else changed.
What moved: appsRuntime and envsFor now live in apps/runtime_registry.ts, so apps/runtime.ts is no longer loaded at boot (#17179). Importers across src/ and test/ now import them from the registry.
Left alone: the 11 one-off classes the drift check lists are in files this pull doesn't touch. The long-comment note is one the gate says the nightly rewrap handles.
No look pages: this pull only moves imports, so no page's markup, route or behaviour changes.
To try it, run bun test test/boot-lazy.test.ts test/apps-runtime-split.test.ts.
🤖 Generated with Claude Code
I merged main into this branch, resolved the one conflict, and pushed. test/boot-lazy.test.ts now type-checks and its 7 tests pass. I did not run the rest of the suite, so the forge's check on this push is the full run.
Conflict: in test/boot-lazy.test.ts, main had taken snapshot/service.ts out of the follow-up comment and added it to the list of services the boot must not import statically. This branch does the same for apps/runtime.ts. I kept both: the only list now ends with snapshot/service.ts and apps/runtime.ts. The comment keeps main's follow-ups (#17180, #17181, #17182) and this branch's note that the accessors now live in apps/runtime_registry.ts.
The change itself is unchanged: the accessors move out of apps/runtime.ts into apps/runtime_registry.ts, and the importers point at the new module.
The reviewer's feedback describes a different change (#17180), not this branch. I'll state that and not make changes.
DECLINED: The feedback doesn't match this branch, so I changed nothing and pushed nothing.
- Head matches the issue. The head of
mason/17179-move-the-accessors-out-of-apps-runtime-tis the #17252 change. It addssrc/apps/runtime_registry.ts, which holdsappsRuntime,envsForand theWeakMap. About 85 importers now point at it, andapps/runtime.tsis imported as a type only.test/boot-lazy.test.tshas theapps/runtime.tsentry, andapps-runtime-split.test.tsexpects the registry as the one module with module-level state. - Wrong diff reviewed. The review describes a
checksFor/provideChecksForTestmove out ofchecks/service.ts, which is #17180. That change is not on this branch:src/checks/handles.tsdoes not exist, andsrc/checks/is untouched.provideChecksForTeststill lives inchecks/service.tson main, so there is no second name forkeepChecksto remove. - Child-apps test. The only
src/spawn/child-apps.tschange here is the dynamicimport("../apps/runtime.ts")instartChildApps, plus the registry import. It does not branch on whether the parent has checks. A "no checks giveschecks: undefined, checks gives a handle" test would belong to #17180.
Please re-review the diff against origin/main, or point the feedback at the pull for #17180.
I merged main into the branch and pushed it. The merge commit is 06befc403.
The merge conflicted in two files, and I kept both sides in each:
src/spawn/child-apps.ts:startChildAppsnow has both the dynamic import ofAppsRuntimefrom this pull andmain's lazy import ofchecks/service.ts(only when the parent has checks).test/boot-lazy.test.ts: the list of modules the boot must not reach now holdsmain'schecks/service.tsandsnapshot/service.tsplus this pull'sapps/runtime.ts.
bun x tsc --noEmit is clean. I ran boot-lazy, apps-runtime-split and the child-apps tests, and all 10 tests pass. I did not run the full suite, so the forge's check on this push is the first full run after the merge.
bun scripts/gate.ts --fix rewrapped nothing. It notes 17 files with comment lines over 100 columns, which the nightly rewrap handles on main, and none of them are files this pull changed.
apps/runtime.tsis no longer instaticClosure(src/main.ts), andtest/boot-lazy.test.tsnow asserts that. I did not run the full suite (the forge's check does that on push).tscis clean. I ranboot-lazy,apps-runtime-split,private-app,probe,llms-budget,jobs-doors,deadends,unused-exports,boundary-secrets-processand the child-apps tests, and they pass.What moved where
src/apps/runtime_registry.ts: it holdsappsRuntime,envsForand theWeakMapthat was insideruntime.ts. It also addsregisterRuntimeandunregisterRuntime. The service's constructor callsregisterRuntimeandstop()callsunregisterRuntime, so the service fills the registry when it starts. The registry importsruntime.tsfor types only.appsRuntimeandenvsForfrom the registry. Type-only imports ofruntime.tsare writtenimport type.web/studio/words.tsanddecisions.tstakeNO_TESTS_TAILandTESTS_PASSED_TAILfromruntime_env.tsinstead ofruntime.ts.spawn/child-apps.tsimportsAppsRuntimedynamically instartChildApps, before the once-per-child check, so two starts can't interleave.boot-lazy.test.tsaddsapps/runtime.tsto the list of services the boot doesn't reach statically.apps-runtime-split.test.tsnow expectsruntime_registry.tsas the one module with module-level state.What I chose not to do
similar.tsto reuse. I moved the existing ones as they were.as nevertest inputs, the dead-code test, the/llms.txtbudget, theduringtiming rule). The change is code motion and trips none of them. The dead-code test and the/llms.txtbudget test pass locally.Hook and gate
Try:commit, so the last commit is an empty one carrying it, plusNo door:since no page, action, route or tool changed.gate.ts --fixrewrapped one file's comments before I committed.alpha--localhostandparent.exampleduring the test runs. I did not look into whether any test depends on those hosts.Try it:
bun test test/boot-lazy.test.ts test/apps-runtime-split.test.ts.🤖 Generated with Claude Code
Closes #17179