Public: anyone can read this; the crew can change it.
What still makes a check expensive after today's cuts: three measured items #12571
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/12570-what-still-makes-a-check-expensive-after → main 3 commits fork 2 threads · 2 unresolved
4 files
changed +38
−3
src/checks/impact.ts +10 −1
| @@ -323,10 +323,19 @@ export function needsFull( | ||
| 323 | 323 | !(f === GATE_FILE && gateAdds !== undefined) && |
| 324 | 324 | !f.endsWith("test-times.json") && !f.endsWith("test-impact.json") && !ALLOW_LIST.test(f) && |
| 325 | 325 | bounded?.(f) !== true) || |
| 326 | f.startsWith("src/kernel/"), | |
| 326 | (f.startsWith("src/kernel/") && !MAPPED_KERNEL.has(f)), | |
| 327 | 327 | ); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | /** | |
| 331 | * Kernel files the map bounds like any other source: `vitals.ts` is the | |
| 332 | * health reading, not a module every booted forge runs, and 7 of the 13 | |
| 333 | * full tiers its directory forced on 2026-11-14 were it alone (#12570). | |
| 334 | * The rest of `src/kernel/` (db, migrate, log, id, events, schema) is | |
| 335 | * run by every test, so a change there still runs everything. | |
| 336 | */ | |
| 337 | const MAPPED_KERNEL: ReadonlySet<string> = new Set(["src/kernel/vitals.ts"]); | |
| 338 | ||
| 330 | 339 | export interface Reach { |
| 331 | 340 | /** Tests whose executed files meet the diff, with the first file that did. */ |
| 332 | 341 | readonly tests: ReadonlyMap<string, string>; |
src/crew/dispatch.ts +6 −1
| @@ -146,7 +146,12 @@ const log = createLog("crew"); | ||
| 146 | 146 | |
| 147 | 147 | /** Automatic follow-ups after a failed check, before a person must speak. */ |
| 148 | 148 | export const CHECK_FAILED_LIMIT = 2; |
| 149 | const TICK_MS = 5_000; | |
| 149 | /** | |
| 150 | * The dispatcher's pass. Under `bun test` (NODE_ENV=test) it is 50 ms: tests | |
| 151 | * that start the real dispatcher waited out five seconds per pass (#12570). | |
| 152 | * A test of the tick itself passes `tickMs`. | |
| 153 | */ | |
| 154 | export const TICK_MS = process.env["NODE_ENV"] === "test" ? 50 : 5_000; | |
| 150 | 155 | |
| 151 | 156 | /** Whether the check run's red is a pull that does not merge into its base. */ |
| 152 | 157 | function conflictSummary(app: App, runId: unknown): boolean { |
test/check-tiers.test.ts +16
| @@ -241,6 +241,22 @@ describe("the fast set, by measured coverage", () => { | ||
| 241 | 241 | expect(fastSet({ ...base, changed: ["scripts/test-times.json"] }).files).toEqual([]); |
| 242 | 242 | }); |
| 243 | 243 | |
| 244 | test("src/kernel/vitals.ts is bounded by the map; the rest of the kernel stays full", () => { | |
| 245 | const reads = (file: string): string[] => | |
| 246 | file === "test/deep.test.ts" ? ["src/kernel/vitals.ts"] : imports(file); | |
| 247 | const plan = fastSet({ ...base, changed: ["src/kernel/vitals.ts"], imports: reads }); | |
| 248 | expect(plan.line).not.toContain("full tier"); | |
| 249 | // The test that reaches vitals.ts is named, with the reason; | |
| 250 | // the 90 s one that does not is left out. | |
| 251 | expect(plan.files).toContain("test/deep.test.ts"); | |
| 252 | expect(plan.why.get("test/deep.test.ts")).toBe("imports src/kernel/vitals.ts"); | |
| 253 | expect(plan.files).not.toContain("test/web-phone.test.ts"); | |
| 254 | // The same graph with db.ts changed still runs everything. | |
| 255 | const db = fastSet({ ...base, changed: ["src/kernel/db.ts"], imports: reads }); | |
| 256 | expect(db.files).toEqual(base.tests); | |
| 257 | expect(db.line).toContain("full tier"); | |
| 258 | }); | |
| 259 | ||
| 244 | 260 | test("a gate.ts diff that only edits EXCLUDED selects the tests it admits; logic runs full", () => { |
| 245 | 261 | const listed = [ |
| 246 | 262 | "@@ -10,2 +10,0 @@", |
test/crew-tick.test.ts +6 −1
| @@ -12,7 +12,7 @@ import { createApp, type App } from "../src/app.ts"; | ||
| 12 | 12 | import { createRepo } from "../src/actions/repos.ts"; |
| 13 | 13 | import { claimRun, createRun, getRun } from "../src/core/runs.ts"; |
| 14 | 14 | import { createUser } from "../src/core/users.ts"; |
| 15 | import { startCrew, type CrewHandle } from "../src/crew/dispatch.ts"; | |
| 15 | import { startCrew, TICK_MS, type CrewHandle } from "../src/crew/dispatch.ts"; | |
| 16 | 16 | |
| 17 | 17 | let dataDir: string; |
| 18 | 18 | let app: App; |
| @@ -59,3 +59,8 @@ test("a tick that throws is logged, and the next tick still does its work", asyn | ||
| 59 | 59 | while (getRun(app.db, stale.id)?.state === "running" && Date.now() < deadline) await Bun.sleep(20); |
| 60 | 60 | expect(getRun(app.db, stale.id)?.state).toBe("cancelled"); |
| 61 | 61 | }); |
| 62 | ||
| 63 | test("under bun test the dispatcher's own tick is short, so no test waits out five seconds", () => { | |
| 64 | expect(process.env["NODE_ENV"]).toBe("test"); | |
| 65 | expect(TICK_MS).toBe(50); | |
| 66 | }); |
new above
offline
Too loose: assert something specific about the bounded plan, and add a src/kernel/db.ts case that still runs full.