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

What still makes a check expensive after today's cuts: three measured items #12571

Merged opened this in answer to

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

Merged

scout/forge:scout/12570-what-still-makes-a-check-expensive-after → main 3 commits fork 2 threads · 2 unresolved

  • Merged. scout/12570-what-still-makes-a-check-expensive-after was merged into main as bb7c07b.

Review

Sign in to review this change.
4 files changed +38 −3
src/checks/impact.ts +10 −1
@@ -323,10 +323,19 @@ export function needsFull(
323323 !(f === GATE_FILE && gateAdds !== undefined) &&
324324 !f.endsWith("test-times.json") && !f.endsWith("test-impact.json") && !ALLOW_LIST.test(f) &&
325325 bounded?.(f) !== true) ||
326 f.startsWith("src/kernel/"),
326 (f.startsWith("src/kernel/") && !MAPPED_KERNEL.has(f)),
327327 );
328328 }
329329
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
330339 export interface Reach {
331340 /** Tests whose executed files meet the diff, with the first file that did. */
332341 readonly tests: ReadonlyMap<string, string>;
src/crew/dispatch.ts +6 −1
@@ -146,7 +146,12 @@ const log = createLog("crew");
146146
147147 /** Automatic follow-ups after a failed check, before a person must speak. */
148148 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;
150155
151156 /** Whether the check run's red is a pull that does not merge into its base. */
152157 function conflictSummary(app: App, runId: unknown): boolean {
test/check-tiers.test.ts +16
@@ -241,6 +241,22 @@ describe("the fast set, by measured coverage", () => {
241241 expect(fastSet({ ...base, changed: ["scripts/test-times.json"] }).files).toEqual([]);
242242 });
243243
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 });
outdated

Too loose: assert something specific about the bounded plan, and add a src/kernel/db.ts case that still runs full.

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
244260 test("a gate.ts diff that only edits EXCLUDED selects the tests it admits; logic runs full", () => {
245261 const listed = [
246262 "@@ -10,2 +10,0 @@",
test/crew-tick.test.ts +6 −1
@@ -12,7 +12,7 @@ import { createApp, type App } from "../src/app.ts";
1212 import { createRepo } from "../src/actions/repos.ts";
1313 import { claimRun, createRun, getRun } from "../src/core/runs.ts";
1414 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";
1616
1717 let dataDir: string;
1818 let app: App;
@@ -59,3 +59,8 @@ test("a tick that throws is logged, and the next tick still does its work", asyn
5959 while (getRun(app.db, stale.id)?.state === "running" && Date.now() < deadline) await Bun.sleep(20);
6060 expect(getRun(app.db, stale.id)?.state).toBe("cancelled");
6161 });
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 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs