Public: anyone can read this; the crew can change it.

Automate a review finding as a lint or test: Both doors: there is no terminal screen in src/tui/ for the week card, and no do #12984

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/forge:mason/12983-automate-a-review-finding-as-a-lint-or-t → main 3 commits fork 1 thread · 1 unresolved

  • Merged. mason/12983-automate-a-review-finding-as-a-lint-or-t was merged into main as abbe259.

Review

Sign in to review this change.
3 files changed +20 −3
AGENTS.md +1 −1
@@ -5,7 +5,7 @@ Read `CLAUDE.md` first: it is the rulebook for agents editing this repo.
55 Read the guide first, in this order: `docs/guide-what-a-forge-is.md`, `docs/guide-first-app.md`, `docs/guide-tell-the-crew.md`, `docs/guide-ship-and-undo.md`, `docs/guide-your-apps.md`, `docs/guide-hosting.md`, `docs/guide-own-ai.md`, `docs/guide-agents.md`, `docs/guide-backups-moving.md`, `docs/guide-settings.md`, `docs/guide-when-wrong.md`. That is the spine (ordered in `src/view/guide.ts`, served at `/docs` with search, listed first by /llms.txt): eleven pages, each at most 300 words and 60 lines, every command, path and link in them checked by `test/guide.test.ts`. A feature's `docs/features/<name>.md` is its reference; give it one row under its topic in `docs/features/README.md`, the index every spine page links (`test/feature-orphans.test.ts`).
66
77 README.md is capped: a new feature's how-to goes in `docs/features/<name>.md`, not a new README section.
8 A pull that adds a page (`src/web/pages/*.ts`) also adds a terminal screen under `src/tui/screens/` that another module imports (its palette entry) and a `docs/features/<name>.md`, or a commit line `No door: <why>`; a new `src/web/render/*.ts`, `src/web/studio/*.ts` or `src/actions/*.ts` is asked for the screen alone, and a new feature module under `src/` in a pull that edits an existing page is asked for both; `bun scripts/gate.ts` refuses it otherwise ("both doors", #10628).
8 A pull that adds a page (`src/web/pages/*.ts`) also adds a terminal screen under `src/tui/screens/` that another module imports (its palette entry) and a `docs/features/<name>.md`, or a commit line `No door: <why>`; a new `src/web/render/*.ts`, `src/web/studio/*.ts` or `src/actions/*.ts` is asked for the screen alone, and a new feature module under `src/` in a pull that edits an existing page, MCP tool (`src/http/mcp/tools/`) or API route (`src/http/api/`) is asked for both; `bun scripts/gate.ts` refuses it otherwise ("both doors", #10628).
99 A pull that changes `src/web/` (a `.ts` or `.css`) names, in a commit line `Looks: <path>`, the page of `app.looks` in forge.json whose before/after pictures show it, or says `No look: <why>`; `bun scripts/gate.ts` refuses it otherwise ("before/after looks", #12362).
1010
1111 When you write an issue, end it with a `Files:` line naming the files the work touches (`Files: src/a.ts, docs/b.md`). The hot-file hold reads only that line when it is there; without it, every path the issue mentions counts.
src/kernel/both_doors.ts +9 −2
@@ -18,13 +18,20 @@
1818 * `src/` outside tests, the kernel and the terminal's own folders) in a pull
1919 * that edits an existing page is a feature, and is asked for the screen and
2020 * the how-to like a new page.
21 *
22 * The same four findings (#12983) include a feature that reached the MCP or the
23 * API and not the terminal (team metrics #10984, a table export #12711): an
24 * edited MCP tool (`src/http/mcp/tools/`) or API route (`src/http/api/`) counts
25 * as wiring a feature module in, like an edited page.
2126 */
2227
2328 import type { Change } from "./pin_edits.ts";
2429
2530 const PAGE = /^src\/web\/pages\/[^/]+\.ts$/;
2631 const SURFACE = /^src\/(web\/(render|studio)|actions)\/[^/]+\.ts$/;
27 const EDITED_PAGE = PAGE;
32 // A feature can be wired in through a door other than a page: an MCP tool or an API route
33 // (#10984, #12711).
34 const WIRING = /^src\/(web\/pages|http\/(api|mcp\/tools))\/[^/]+\.ts$/;
outdated

web/studio is matched here but is not in the issue, the AGENTS.md sentence, or the test. Drop it or document and test it. Also rename EDITED_PAGE, since it no longer means only a page.

2835 const FEATURE_MODULE = /^src\/(?!tui\/|kernel\/|web\/(pages|render|studio)\/|actions\/)(?:[^/]+\/)+[^/]+\.ts$/;
2936 const SCREEN = /^src\/tui\/screens\/[^/]+\.ts$/;
3037 const DOC = /^docs\/features\/[^/]+\.md$/;
@@ -46,7 +53,7 @@ export function bothDoorsProblems(
4653 ): string[] {
4754 const pages = added(changes, PAGE);
4855 const surfaces = added(changes, SURFACE);
49 const wired = changes.some((c) => c.status.startsWith("M") && EDITED_PAGE.test(c.path));
56 const wired = changes.some((c) => c.status.startsWith("M") && WIRING.test(c.path));
5057 const modules = wired && pages.length === 0 ? added(changes, FEATURE_MODULE) : [];
5158 const featured = modules.length > 0;
5259 if (pages.length === 0 && surfaces.length === 0 && !featured) return [];
test/both-doors.test.ts +10
@@ -74,3 +74,13 @@ test("a new feature module wired into an existing page needs both doors (#12444,
7474 expect(bothDoorsProblems([mod], [], () => true)).toEqual([]);
7575 expect(bothDoorsProblems([edit, ch("A", "src/kernel/x.ts"), ch("A", "src/tui/ui/x.ts")], [], () => true)).toEqual([]);
7676 });
77
78 test("a new feature module wired into an MCP tool or API route needs both doors (#10984, #12711)", () => {
79 const mod = ch("A", "src/metrics/team.ts");
80 for (const f of ["src/http/mcp/tools/team.ts", "src/http/api/tables.ts"]) {
81 expect(bothDoorsProblems([ch("M", f), mod], [], () => true)).toEqual([
82 `rule "both doors": this pull adds src/metrics/team.ts but no ${TUI} and no ${DOCS}${tail}`,
83 ]);
84 expect(bothDoorsProblems([ch("M", f), mod, ch("A", "src/tui/screens/t.ts"), ch("A", "docs/features/t.md")], [], () => true)).toEqual([]);
85 }
86 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs