diff --git a/src/lastrun.ts b/src/lastrun.ts index 9d76fe4..cfcebb4 100644 --- a/src/lastrun.ts +++ b/src/lastrun.ts @@ -103,12 +103,17 @@ export function record( failed: number, ran: string[], env = process.env, + builtAgainst?: Against, ): Receipt { const receipt: Receipt = { at: new Date().toISOString(), passed, failed, - against: whatWasTested(env), + // What was BUILT, when the caller says — not what the repositories are at when the run ends. + // A receipt read at record time names whatever was committed during the twenty minutes the + // suite took, and it did: one run's receipt claimed a commit that landed mid-run and was + // never in the binaries. A verdict is only worth something attributed to one exact state. + against: builtAgainst ?? whatWasTested(env), ran, }; const path = receiptPath(); diff --git a/src/suite.ts b/src/suite.ts index 7eb57fc..8496026 100644 --- a/src/suite.ts +++ b/src/suite.ts @@ -10,7 +10,7 @@ */ import { spawn } from "node:child_process"; -import { endToEnd, record } from "./lastrun.ts"; +import { endToEnd, record, whatWasTested } from "./lastrun.ts"; import { rebuild } from "./rebuild.ts"; /** counted is what the runner said, or nulls when it said nothing recognisable. */ @@ -43,6 +43,9 @@ export async function runSuite(args: string[]): Promise { const built = rebuild(); if (built.length > 0) console.log(`built: ${built.join(", ")}\n`); } + // Read now, while it is true. The receipt names these, and reading them when the run ends + // names whatever was committed during the twenty minutes in between instead. + const against = whatWasTested(process.env); // **No canary.** There was one: a second scenario, one machine, raised first so a broken mesh // failed in two minutes rather than in forty. It walked exactly the path the first three tests @@ -55,7 +58,7 @@ export async function runSuite(args: string[]): Promise { // runs when it is named; it is no longer raised on the way to everything else. const { code, seen } = await runFiles(files); - console.log("\n" + reportOn(counted(seen), (p, f) => record(p, f, files))); + console.log("\n" + reportOn(counted(seen), (p, f) => record(p, f, files, process.env, against))); return code; }