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 #18417

shipped production is serving it opened this has it

Landed in pull #18419 · run

opened this

Why: a new migration is a file no test imports and the impact map has never measured (the migrator lists src/core/migrations/ by path), so fastSet (src/checks/tiers.ts) never selects test/data-browser.test.ts, the test that audits every forge.db column against the secret-name rule. Each pull that added a secret-shaped column passed its check and turned main red until someone added the column to AUDITED_CLEAR: #18229 and #18244/#18245 (#18017) on Dec 4, #18386/#18392 (#18373) on Dec 6, about two hours red each. Same shape as the page budgets (#14318, #15251): a table every pull of a kind spends from, which neither coverage nor imports reach.

Patch (src/checks/tiers.ts), beside PAGE_TABLE_TESTS:

/**
 * The tests that judge the schema as a whole: `data-browser` audits every forge.db column against
 * the secret-name rule. A new migration is a file no test imports and the impact map has never
 * measured (the migrator lists src/core/migrations/ by path), so neither coverage nor imports tie
 * it to them, and four pulls that each added a column passed their check and turned main red
 * (#18229, #18244, #18386, #18392).
 */
export const SCHEMA_TESTS: readonly string[] = ["test/data-browser.test.ts"];

/** Whether a changed file changes the schema, which every {@link SCHEMA_TESTS} reads. */
export const movesSchema = (file: string): boolean => file.startsWith("src/core/migrations/");

In fastSet, right after the shared / page-budget block:

  const migration = diffed.find(movesSchema);
  if (migration !== undefined) for (const test of SCHEMA_TESTS) take(test, `schema: ${migration} changed`);

In REASON_KINDS, after the page budget row: ["schema: ", "schema"],.

Test (test/check-tiers.test.ts, in "the fast set, by measured coverage", after the #15251 page-table test; import SCHEMA_TESTS from tiers.ts). It fails on main at the first toContain, because the migration reaches nothing by coverage, import or name:

  test("a migration runs the schema audit, though no test imports or executes a new one (#18392)", () => {
    const withSchema = { ...base, tests: [...base.tests, "test/data-browser.test.ts"] };
    const file = "src/core/migrations/20261206073718-trace-touch.ts";
    const plan = fastSet({ ...withSchema, changed: [file] });
    expect(plan.files).toContain("test/data-browser.test.ts");
    expect(plan.why.get("test/data-browser.test.ts")).toBe(`schema: ${file} changed`);
    expect(SCHEMA_TESTS).toContain("test/data-browser.test.ts");
    expect(reasonLine(plan)).toContain("1 schema");
    const elsewhere = fastSet({ ...withSchema, changed: ["src/snapshot/store.ts"] });
    expect(elsewhere.files).not.toContain("test/data-browser.test.ts");
  });

Done when: the test fails without the tiers.ts change and passes with it; the rest of check-tiers is unchanged; preflight inherits it through scripts/fast.ts with no edit there. Not RULE_TESTS: data-browser takes 6-15 s, so it runs only on migration pulls. A line in the checks doc beside the page-budget paragraph if one names those. No migration, no access change.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs