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

A pull that adds a migration runs test/data-browser.test.ts in its fast tier #18419

opened this in answer to

Merged 1h 55m ago, live in production

scout/forge:scout/18417-a-pull-that-adds-a-migration-runs-test-d → main 0 commits fork

  • Merged. scout/18417-a-pull-that-adds-a-migration-runs-test-d was merged into main as 105485a.

Review

Sign in to review this change.
2 files changed +28 −0
src/checks/tiers.ts +15
@@ -88,6 +88,18 @@ export const movesPageBudgets = (file: string): boolean =>
8888 */
8989 export const PAGE_TABLE_TESTS: readonly string[] = ["test/page-budget.test.ts", "test/page-budget-roster.test.ts"];
9090
91 /**
92 * The tests that judge the schema as a whole: `data-browser` audits every forge.db column against
93 * the secret-name rule. A new migration is a file no test imports and the impact map has never
94 * measured (the migrator lists src/core/migrations/ by path), so neither coverage nor imports tie
95 * it to them, and four pulls that each added a column passed their check and turned main red
96 * (#18229, #18244, #18386, #18392).
97 */
98 export const SCHEMA_TESTS: readonly string[] = ["test/data-browser.test.ts"];
99
100 /** Whether a changed file changes the schema, which every {@link SCHEMA_TESTS} reads. */
101 export const movesSchema = (file: string): boolean => file.startsWith("src/core/migrations/");
102
91103 /**
92104 * What a CSS-only change runs (#16876, the owner's go 2026-12-02). A diff whose every changed line
93105 * lies inside the stylesheet's template literals in `src/web/style/` (`scripts/css-only.ts`
@@ -395,6 +407,8 @@ export function fastSet(input: FastInput): FastPlan {
395407 if (shared !== undefined) {
396408 for (const test of [...PAGE_BUDGET_TESTS, ...PAGE_TABLE_TESTS]) take(test, `page budget: ${shared} changed`);
397409 }
410 const migration = diffed.find(movesSchema);
411 if (migration !== undefined) for (const test of SCHEMA_TESTS) take(test, `schema: ${migration} changed`);
398412 // What a guess looks for. A test the map has measured already answered
399413 // for every change the map can see, by what it executes; it is guessed
400414 // only against the changes the map cannot see, so one unreached file
@@ -490,6 +504,7 @@ const REASON_KINDS: readonly (readonly [string, string])[] = [
490504 ["imports ", "imports"],
491505 ["repo-wide rule", "repo-wide rule"],
492506 ["page budget: ", "page budget"],
507 ["schema: ", "schema"],
493508 ["failed on land before", "learned"],
494509 ["full: ", "full"],
495510 ];
test/check-tiers.test.ts +13
@@ -29,6 +29,7 @@ import {
2929 landVerdict,
3030 PAGE_BUDGET_TESTS,
3131 PAGE_TABLE_TESTS,
32 SCHEMA_TESTS,
3233 tierLine,
3334 } from "../src/checks/tiers.ts";
3435 import {
@@ -440,6 +441,18 @@ describe("the fast set, by measured coverage", () => {
440441 for (const t of PAGE_TABLE_TESTS) expect(elsewhere.files).not.toContain(t);
441442 });
442443
444 test("a migration runs the schema audit, though no test imports or executes a new one (#18392)", () => {
445 const withSchema = { ...base, tests: [...base.tests, "test/data-browser.test.ts"] };
446 const file = "src/core/migrations/20261206073718-trace-touch.ts";
447 const plan = fastSet({ ...withSchema, changed: [file] });
448 expect(plan.files).toContain("test/data-browser.test.ts");
449 expect(plan.why.get("test/data-browser.test.ts")).toBe(`schema: ${file} changed`);
450 expect(SCHEMA_TESTS).toContain("test/data-browser.test.ts");
451 expect(reasonLine(plan)).toContain("1 schema");
452 const elsewhere = fastSet({ ...withSchema, changed: ["src/snapshot/store.ts"] });
453 expect(elsewhere.files).not.toContain("test/data-browser.test.ts");
454 });
455
443456 test("lcov: only src files with a line hit count as executed", () => {
444457 const lcov = "SF:src/a.ts\nDA:1,0\nend_of_record\nSF:src/b.ts\nDA:1,3\nend_of_record\nSF:test/x.test.ts\nDA:1,1\nend_of_record\n";
445458 expect(executedFiles(lcov)).toEqual(["src/b.ts"]);

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

Keyboard shortcuts

Docs