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

Automate a review finding as a lint or test: Both doors: Compute on Settings has no terminal screen in src/tui/ and no docs/f #13378

Merged opened this

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

Merged

mason/forge:mason/13376-automate-a-review-finding-as-a-lint-or-t → main 1 commit fork

  • Merged. mason/13376-automate-a-review-finding-as-a-lint-or-t was merged into main as 44b6735.

Review

Sign in to review this change.
3 files changed +27 −2
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, and a pull that edits an existing page changes something under `src/tui/` and a `docs/features/*.md` too (#13196); `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 is asked for both, and a pull that edits an existing page (or any shared `src/web/` file, #13376: a new feature module wired into it is asked for both) changes something under `src/tui/` and a `docs/features/*.md` too (#13196); `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 +6 −1
@@ -19,6 +19,10 @@
1919 * that edits an existing page is a feature, and is asked for the screen and
2020 * the how-to like a new page.
2121 *
22 * A fifth ask (#13376: #11661, #11881, #10654, #13351) found it walked around once more: the
23 * module is new and the line it shows is wired into a shared `src/web/` file (the 404 page, a
24 * layout) rather than a page. An edited `src/web/` file outside pages counts as wiring too.
25 *
2226 * Five reviews more (#13196: #11827, #13064, #13084, #10171, #10311) asked it of a
2327 * line added to a page that already existed, which no new file marks. A pull that
2428 * edits an existing `src/web/pages/*.ts` therefore changes (adds or edits) a file
@@ -32,6 +36,7 @@ import type { Change } from "./pin_edits.ts";
3236 const PAGE = /^src\/web\/pages\/[^/]+\.ts$/;
3337 const SURFACE = /^src\/(web\/(render|studio)|actions)\/[^/]+\.ts$/;
3438 const EDITED_PAGE = PAGE;
39 const EDITED_WEB = /^src\/web\/(?!pages\/)(?:[^/]+\/)*[^/]+\.ts$/;
3540 const FEATURE_MODULE = /^src\/(?!tui\/|kernel\/|web\/(pages|render|studio)\/|actions\/)(?:[^/]+\/)+[^/]+\.ts$/;
3641 const SCREEN = /^src\/tui\/screens\/[^/]+\.ts$/;
3742 const DOC = /^docs\/features\/[^/]+\.md$/;
@@ -53,7 +58,7 @@ export function bothDoorsProblems(
5358 ): string[] {
5459 const pages = added(changes, PAGE);
5560 const surfaces = added(changes, SURFACE);
56 const wired = changes.some((c) => c.status.startsWith("M") && EDITED_PAGE.test(c.path));
61 const wired = changes.some((c) => c.status.startsWith("M") && (EDITED_PAGE.test(c.path) || EDITED_WEB.test(c.path)));
5762 const modules = wired && pages.length === 0 ? added(changes, FEATURE_MODULE) : [];
5863 const featured = modules.length > 0;
5964 const waived = messages.some((m) => WAIVER.test(m));
test/both-doors-refusal.test.ts +20
@@ -120,3 +120,23 @@ test("a repository without src/tui before the pull does not crash the gate", asy
120120 run(dir, "commit", "-qm", "Add traffic");
121121 expect((await withBase(base, () => bothDoorsRefusal(dir)))[0]).toContain("no entry that opens");
122122 });
123
124 test("a new feature module wired into a shared src/web file, not a page, is asked for both doors (#13376)", async () => {
125 const dir = join(root, "shared");
126 mkdirSync(dir);
127 run(dir, "init", "-q", "-b", "work");
128 put(dir, "src/web/not_found.ts", "x");
129 put(dir, "src/tui/screens/entries.ts", "export const ENTRIES = [];\n");
130 run(dir, "add", "-A");
131 run(dir, "commit", "-qm", "base");
132 const base = run(dir, "rev-parse", "HEAD");
133 put(dir, "src/web/not_found.ts", "y");
134 put(dir, "src/web/near_pages.ts", "x");
135 run(dir, "add", "-A");
136 run(dir, "commit", "-qm", "404 offers near pages");
137 const out = await withBase(base, () => bothDoorsRefusal(dir));
138 expect(out).toHaveLength(1);
139 expect(out[0]).toContain('rule "both doors"');
140 expect(out[0]).toContain("src/web/near_pages.ts");
141 expect(out[0]).toContain("docs/features/<name>.md");
142 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs