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

Automate a review finding as a lint or test: One high finding, then smaller ones, all for one round. #18167

opened this

Merged 16h 8m ago, live in production

mason/forge:mason/18156-automate-a-review-finding-as-a-lint-or-t → main 0 commits fork

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

Review

Sign in to review this change.
2 files changed +10 −0
scripts/gate_explain.ts +4
@@ -29,6 +29,10 @@ export const GUARDS: readonly Guard[] = [
2929 { file: "test/spawn-argv.test.ts", rule: "no spawn takes user text as a command", satisfy: "pass an argv array whose program is a literal; name a new spawn by file:line in the test with its reason" },
3030 { file: "test/security-floor-doors.test.ts", rule: "every listener carries the security floor", satisfy: "list a new Bun.serve listener in the test with why what it returns carries the security floor" },
3131 { file: "test/danger-buttons.test.ts", rule: "a danger button asks first", satisfy: "send a danger button through confirmAction (src/web/ui.ts), which links to /-/confirm" },
32 { file: "test/unused-exports.test.ts", rule: "dead code: every export under src/ has a caller, or is allowed", satisfy: "call the export from src/, or drop `export`; a deliberate gap goes in scripts/unused-exports-allow.json with the later step that calls it" },
33 { file: "test/module-state.test.ts", rule: "no process-wide state that requests write to", satisfy: "keep the Map, Set or array inside a function or keyed by forge; do not add a module-level one that a function writes to" },
34 { file: "test/job-slices.test.ts", rule: "every job src/ runs under `during` is timed here or named in UNTIMED with a reason", satisfy: "add the job to the timed list in test/job-slices.test.ts, or name it in UNTIMED with why it cannot be timed" },
35 { file: "test/dup-imports.test.ts", rule: "no duplicate import beyond the allowlist (rule duplicate-import)", satisfy: "merge the two imports of one module into one statement; scripts/dup-imports-allow.json only shrinks" },
3236 ];
3337
3438 /** The lines of a failed `bun test` that say what failed, at most `max`. */
test/gate-explain.test.ts +6
@@ -47,6 +47,12 @@ test("every rule names the file it lives in and the line that satisfies it", ()
4747 for (const g of GUARDS) expect(g.satisfy.length).toBeGreaterThan(10);
4848 });
4949
50 test("the checks the crew's pulls failed most often (#18156) are read before a push", () => {
51 const files = GUARDS.map((g) => g.file);
52 for (const f of ["test/unused-exports.test.ts", "test/module-state.test.ts", "test/job-slices.test.ts", "test/dup-imports.test.ts"])
53 expect(files).toContain(f);
54 });
55
5056 test("on a scratch diff with no trailers, explain lists exactly the rules the gate refuses", async () => {
5157 const { dir, base } = scratch();
5258 process.env.FORGE_CHECK_BASE = base;

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs