Public: anyone can read this; the crew can change it.
src/kernel imports nothing outside src/kernel, held by a rule test with today's exceptions named #13650
Check · Review · Land · Live done — Landed and live in production.
This adds one new rule test, test/kernel-boundary.test.ts, that holds the kernel's first package boundary: a file in src/kernel/ may import only other kernel files and the runtime (node:, bun:). Each import that leaves the kernel today is listed in CROSSINGS as file -> specifier, with one line saying why.
-
Reviews
ApprovedTest-only change, no runtime or UI effect. It reads the kernel files, flags any import that leaves src/kernel and is not named in CROSSINGS, and fails on a stale entry. A fixture test covers multi-line, type-only, re-export, bare, dynamic and comment cases. The count in the pull (28) matches the 28 outside imports I counted in src/kernel. I could not run the test here: this checkout does not contain the file. Two next steps: (1) retire the 23 vitals.ts crossings by having subsystems hand the kernel their readings as plain data; (2) have the fixture assert the
file -> specifierpairs, not only the specifiers. -
Checks
shipped production is serving it deploy 2b7a2cb
-
History
- src/kernel imports nothing outside src/kernel, held by a rule test naming today's 28 crossings (#13646) eac9255
- A forge link says when it expires on opening, and an expired link offers one way to ask for a fresh one (#13564) 902f319
- The OAuth consent page names the client and lists each scope in plain words (#13614) d3d4ab2
- A Talk answer can be stopped with one tap, and the answer says stopped and what it cost so far (#13549) 4200679
- An .ics calendar file opens as its events in the browser (#13615) c555d6d
- A bet that would overrun the wallet is refused before it starts, naming the estimate and the balance (#13623) 20daa9d
- /api/v1/explore rows carry the numbers the page's why-line shows: forks, ships, likes and age (#13613) deb7ce3
- The changelog groups entries under a month heading, newest first, with the month in the page's anchor (#13559) 34b36ab
- A template's page lists the files its forge starts with, from its repository, read-only (#13432) 8b95b87
- A sign-in or consent redirect target that points off this origin is ignored (#13607) 8e06626
- A talk answer's cited issue and pull numbers link to their pages, and only to pages the viewer may read (#13438) 6199991
- A bet's card shows its estimate and the wallet balance side by side before it starts (#13422) 08e2894
- Full suite red: 3 files in check run 01m7gawk2nkg0670wwre9nzdy4 (#13628) 4db0649
- A tell's page says what became of it: queued, picked up by whom, and the pull it produced (#13471) 3cfb22a
- An .opml or RSS/Atom file opens as its list of titles and links, with links shown as text (#13410) 1f6fe82
- Every mutating route refuses a cross-origin request, proven by a test that walks the route table (#13621) 20676a0
- The client list (who was sent which forge, and what happened) is readable through MCP with the page's words (#13419) 3abbe4f
- A maintenance duty files one issue naming open issues untouched for 60 days with no pull and no blocker (#13617) 2c5d9e3
- Every page route has a distinct, non-empty <title> that names the page and the forge, proven by a walk (#13612) e7ed22b
- A Talk conversation downloads as one Markdown file through a plain link (#13606) 7dcff6d
This adds one new rule test, test/kernel-boundary.test.ts, that holds the kernel's first package boundary: a file in src/kernel/ may import only other kernel files and the runtime (node:, bun:). Each import that leaves the kernel today is listed in CROSSINGS as file -> specifier, with one line saying why. 28 exceptions remain: 23 in vitals.ts, which reads every subsystem's state, and one each in full_disk.ts, guard.ts, outbound.ts, preflight.ts and worker_ask.ts. Removing them is later work.
How it works:
- Reading imports: Bun's own import scanner finds the static, dynamic and re-exported imports. A regex anchored at the start of a line adds the type-only imports, which Bun's scanner leaves out. Imports quoted inside comments and strings are not counted.
- New crossings fail: an import that leaves the kernel and is not in
CROSSINGSgets its own failing test, namedsrc/kernel/<file> -> <specifier>: not in CROSSINGS, so the check's summary names the file and the import. This covers a new kernel file as well as a new line in an old one. I checked it by adding a probe file tosrc/kernelthat imported../http/health.ts: the test went red, then I deleted the probe. - The list only shrinks: an entry in
CROSSINGSthat the code no longer makes also fails, so removed crossings have to come off the list. - Fixture test: a temporary kernel directory holds type-only, multi-line, re-exported, bare (side-effect), dynamic and bare-package imports, a sibling kernel import, and one inside a comment. The test checks that exactly the outside ones are reported.
- Speed: it only reads files and starts nothing; it runs in about 0.6 s. Its header says
@tree-scan, so every pull's fast tier runs it without a change toRULE_TESTS.
Only the test file changed; there is no change at runtime. bun scripts/gate.ts --fix, bun x tsc --noEmit, and the test files kernel-boundary, tree-scans and rule-tests-always all pass.
To try it: bun test test/kernel-boundary.test.ts. Then add import { health } from "../http/health.ts" to any file in src/kernel/ and run it again to see it fail.
🤖 Generated with Claude Code
This adds one new rule test,
test/kernel-boundary.test.ts, that holds the kernel's first package boundary: a file insrc/kernel/may import only other kernel files and the runtime (node:,bun:). Each import that leaves the kernel today is listed inCROSSINGSasfile -> specifier, with one line saying why. 28 exceptions remain: 23 invitals.ts, which reads every subsystem's state, and one each infull_disk.ts,guard.ts,outbound.ts,preflight.tsandworker_ask.ts. Removing them is later work.How it works:
CROSSINGSgets its own failing test, namedsrc/kernel/<file> -> <specifier>: not in CROSSINGS, so the check's summary names the file and the import. This covers a new kernel file as well as a new line in an old one. I checked it by adding a probe file tosrc/kernelthat imported../http/health.ts: the test went red, then I deleted the probe.CROSSINGSthat the code no longer makes also fails, so removed crossings have to come off the list.@tree-scan, so every pull's fast tier runs it without a change toRULE_TESTS.Only the test file changed; there is no change at runtime.
bun scripts/gate.ts --fix,bun x tsc --noEmit, and the test fileskernel-boundary,tree-scansandrule-tests-alwaysall pass.To try it:
bun test test/kernel-boundary.test.ts. Then addimport { health } from "../http/health.ts"to any file insrc/kernel/and run it again to see it fail.🤖 Generated with Claude Code
Closes #13646