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
Merged 1h 55m ago, live in production
scout/forge:scout/18417-a-pull-that-adds-a-migration-runs-test-d → main 0 commits fork
2 files
changed +28
−0
src/checks/tiers.ts +15
| @@ -88,6 +88,18 @@ export const movesPageBudgets = (file: string): boolean => | ||
| 88 | 88 | */ |
| 89 | 89 | export const PAGE_TABLE_TESTS: readonly string[] = ["test/page-budget.test.ts", "test/page-budget-roster.test.ts"]; |
| 90 | 90 | |
| 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 | ||
| 91 | 103 | /** |
| 92 | 104 | * What a CSS-only change runs (#16876, the owner's go 2026-12-02). A diff whose every changed line |
| 93 | 105 | * 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 { | ||
| 395 | 407 | if (shared !== undefined) { |
| 396 | 408 | for (const test of [...PAGE_BUDGET_TESTS, ...PAGE_TABLE_TESTS]) take(test, `page budget: ${shared} changed`); |
| 397 | 409 | } |
| 410 | const migration = diffed.find(movesSchema); | |
| 411 | if (migration !== undefined) for (const test of SCHEMA_TESTS) take(test, `schema: ${migration} changed`); | |
| 398 | 412 | // What a guess looks for. A test the map has measured already answered |
| 399 | 413 | // for every change the map can see, by what it executes; it is guessed |
| 400 | 414 | // only against the changes the map cannot see, so one unreached file |
| @@ -490,6 +504,7 @@ const REASON_KINDS: readonly (readonly [string, string])[] = [ | ||
| 490 | 504 | ["imports ", "imports"], |
| 491 | 505 | ["repo-wide rule", "repo-wide rule"], |
| 492 | 506 | ["page budget: ", "page budget"], |
| 507 | ["schema: ", "schema"], | |
| 493 | 508 | ["failed on land before", "learned"], |
| 494 | 509 | ["full: ", "full"], |
| 495 | 510 | ]; |
test/check-tiers.test.ts +13
| @@ -29,6 +29,7 @@ import { | ||
| 29 | 29 | landVerdict, |
| 30 | 30 | PAGE_BUDGET_TESTS, |
| 31 | 31 | PAGE_TABLE_TESTS, |
| 32 | SCHEMA_TESTS, | |
| 32 | 33 | tierLine, |
| 33 | 34 | } from "../src/checks/tiers.ts"; |
| 34 | 35 | import { |
| @@ -440,6 +441,18 @@ describe("the fast set, by measured coverage", () => { | ||
| 440 | 441 | for (const t of PAGE_TABLE_TESTS) expect(elsewhere.files).not.toContain(t); |
| 441 | 442 | }); |
| 442 | 443 | |
| 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 | ||
| 443 | 456 | test("lcov: only src files with a line hit count as executed", () => { |
| 444 | 457 | 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"; |
| 445 | 458 | expect(executedFiles(lcov)).toEqual(["src/b.ts"]); |
new above
offline