Public: anyone can read this; the crew can change it.
Automate a review finding as a lint or test: Both doors: a grant and the provider are page, API and MCP, but there is no term #14340
Check · Review · Land · Live done — Landed and live in production.
The tree now has a "both doors" check: every page in src/web/pages/ needs a terminal door, or a named entry in an allow list. The new test, bun test test/doorless.test.ts, passes.
shipped production is serving it deploy 404563e
2 earlier comments · 1 event
The tree now has a "both doors" check: every page in src/web/pages/ needs a terminal door, or a named entry in an allow list. The new test, bun test test/doorless.test.ts, passes. bun test test/both-doors.test.ts, bun test test/unused-exports.test.ts and bun x tsc --noEmit also pass, and bun scripts/gate.ts --fix changed nothing. I didn't run test/mcp-size.test.ts, since no MCP tool changed.
The diff rule in src/kernel/both_doors.ts already refuses a new or edited page without a terminal change. It only looks at a pull as it lands, so it never saw pages that shipped without a screen (the grant, Land it as it is, the desk). The new check reads the whole tree instead.
- The check:
scripts/doorless.tsfinds each page with no door. A page has one if:- a file under
src/tui/orsrc/actions/imports it; - a screen is named for it;
- a
docs/features/*.mdthat names the page file also namessrc/tui/.
- a file under
- The test:
test/doorless.test.tsfails on a page with no door that isn't inscripts/doorless-allow.json. The failure message startsrule "both doors"and says to add the screen, its entry, and a features doc. - The list only shrinks: it starts with the 97 pages that have no door today. A listed page that gains a door is only a warning, so pulls don't conflict on the list.
bun scripts/doorless.ts --writeprunes it. - Docs: I added a line to
AGENTS.mdnext to the existing both-doors rule.
I did not add the missing screens (billing grant and provider, Land it as it is, the desk, the #11841 entry). The issue asks only for the check, and each screen is its own change. The 97 listed pages are the backlog.
The page-to-screen match is by name and imports, so it is rough. Some listed pages are probably helpers or already covered under another name, such as accounts and apps. Pruning those from the list is follow-up work.
To try it, delete a line from scripts/doorless-allow.json and run bun test test/doorless.test.ts to see the failure message.
🤖 Generated with Claude Code
The lint works for new pages and names the rule, but two things must change. 1) The allow list can grow and nothing fails: the only "only shrinks" test is vacuous. 2) The door heuristic is loose enough to clear a page by accident. Details are in the line comments. Fix first: make a stale entry fail the test, and add a test that the list cannot gain a page. Nothing else here is high severity. Not run: I did not exercise the preview, since the change adds no app behaviour.
Both review points are fixed and pushed. test/doorless.test.ts passes (4 tests) and bun x tsc --noEmit is clean. I ran no other test files.
- Stale entries fail. The vacuous
Array.isArraycheck is replaced. A listed page that now has a door fails the test and says to runbun scripts/doorless.ts --write. - The list cannot gain a page.
CEILINGintest/doorless.test.tspins the list length at 98. Appending a page fails the test, and removing pages means lowering the ceiling. A stale-entry failure already forces pruning, so the list can't hide slack under the ceiling. The ceiling lives in the test, not the JSON, so editing the JSON alone can't raise it. Raising it is a visible diff for review. - Doc door is stricter. A
docs/features/*.mdclears a page only if it names asrc/tui/…tsfile that exists on disk. - Cleanups. The page name is regex-escaped.
slice(16,-3)andslice(14,-3)are nowbasename. - New tests. A doc naming a missing screen no longer clears a page, and a
.in a page name no longer matches another screen's name.
The stricter doc rule exposed one page the old rule cleared by accident: src/web/pages/home_flow_client.ts. Its doc says "there is no src/tui/ screen for this" because the browser has a speech API and the terminal doesn't. I added it to the allow list, which is why the ceiling is 98. If you'd rather it not be listed, it needs a terminal door instead.
The check failed because src/web/pages/offer-receipt.ts landed on main (#14176) with no terminal screen, and the lint caught it. I merged main into the branch and pushed. test/doorless.test.ts and test/design-lint.test.ts pass locally and bun x tsc --noEmit is clean; I did not re-run the full suite.
- Both doors: I added
offer-receipt.tstoscripts/doorless-allow.jsonand raisedCEILINGfrom 98 to 99. This is a gap on main, not a choice I'm making for the page. Its screen should be a follow-up, and that change should delete the entry and lower the ceiling. - Design check ("no worse than its named debt"): I did not change anything for it. It passes locally after the merge, so I take it to have been main drift rather than something this pull did. If it fails again on this push, send me its log.
Earlier asks are met. A listed page that gains a door now fails the test and says to run --write. CEILING pins the list length, and the list has 99 entries, matching the ceiling. A doc clears a page only if it names a src/tui/ file that exists, and the new test covers that. The check adds no dependency, shells out to nothing, and its scripts and test touch no runtime surface. The only new change is the offer-receipt.ts entry and the ceiling raised to 99. That is main drift rather than a choice, and the screen is a follow-up. I could not diff against 8fb994363283 because the commit is not in the clone, so I judged the current head. Non-blocking: open the follow-up issue for the offer-receipt screen, so the entry and ceiling shrink when it lands.
The tree now has a "both doors" check: every page in
src/web/pages/needs a terminal door, or a named entry in an allow list. The new test,bun test test/doorless.test.ts, passes.bun test test/both-doors.test.ts,bun test test/unused-exports.test.tsandbun x tsc --noEmitalso pass, andbun scripts/gate.ts --fixchanged nothing. I didn't runtest/mcp-size.test.ts, since no MCP tool changed.The diff rule in
src/kernel/both_doors.tsalready refuses a new or edited page without a terminal change. It only looks at a pull as it lands, so it never saw pages that shipped without a screen (the grant, Land it as it is, the desk). The new check reads the whole tree instead.scripts/doorless.tsfinds each page with no door. A page has one if:src/tui/orsrc/actions/imports it;docs/features/*.mdthat names the page file also namessrc/tui/.test/doorless.test.tsfails on a page with no door that isn't inscripts/doorless-allow.json. The failure message startsrule "both doors"and says to add the screen, its entry, and a features doc.bun scripts/doorless.ts --writeprunes it.AGENTS.mdnext to the existing both-doors rule.I did not add the missing screens (billing grant and provider, Land it as it is, the desk, the #11841 entry). The issue asks only for the check, and each screen is its own change. The 97 listed pages are the backlog.
The page-to-screen match is by name and imports, so it is rough. Some listed pages are probably helpers or already covered under another name, such as
accountsandapps. Pruning those from the list is follow-up work.To try it, delete a line from
scripts/doorless-allow.jsonand runbun test test/doorless.test.tsto see the failure message.🤖 Generated with Claude Code
Closes #14289