Public: anyone can read this; the crew can change it.
Sentinel: The lane has stopped: nothing has merged and nothing said so #12944
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/12940-sentinel-the-lane-has-stopped-nothing-ha → main 1 commit fork 1 thread · 1 unresolved
2 files
changed +54
−2
src/checks/summary.ts +21 −2
| @@ -27,6 +27,21 @@ export const GATE_SUMMARY_HEADING = "── gate summary"; | ||
| 27 | 27 | const UNNAMED_SHARD = |
| 28 | 28 | /^shard [0-9]+ (?:exited -?[0-9]+ without naming a test: |killed after [0-9]+ s, running )/; |
| 29 | 29 | |
| 30 | /** | |
| 31 | * The lines `scripts/test-shards.ts` prints after the tally about the records | |
| 32 | * it kept (times, impacts, kept green results): bookkeeping, never why the | |
| 33 | * check is red (#12940). | |
| 34 | */ | |
| 35 | const RECORD_KEEPING = | |
| 36 | /^test-shards: (?:wrote [0-9]+ (?:times|test impacts) to |kept [0-9]+ green results in |not writing |not recording: )/; | |
| 37 | ||
| 38 | /** | |
| 39 | * Whether `runStep`'s error is the step's own exit ("check exited with code | |
| 40 | * 1"); anything else — a cell's limit, a signal, a timeout, a cancel, a lost | |
| 41 | * job — stopped the check from outside, and its words are the cause (#12940). | |
| 42 | */ | |
| 43 | const ownExit = (error: string): boolean => /\bexited with code\b/.test(error); | |
| 44 | ||
| 30 | 45 | /** A summary is one line on a card; a name from a subprocess is bounded to fit it. */ |
| 31 | 46 | const SUMMARY_MAX = 200; |
| 32 | 47 | |
| @@ -47,7 +62,10 @@ export interface CheckFailure { | ||
| 47 | 62 | * output named nothing better, so a truthful "no output at all" is never |
| 48 | 63 | * dressed up as more than it is. Without test names the summary is the |
| 49 | 64 | * sharded gate's first red shard that named none, else the last line |
| 50 | * before the gate summary block — never a line of the block itself. | |
| 65 | * before the gate summary block — never a line of the block itself, nor | |
| 66 | * the gate's record-keeping. A check stopped from outside (its limit, a | |
| 67 | * signal, its time) is summarised by that stop, not by whatever it printed | |
| 68 | * last before it. | |
| 51 | 69 | */ |
| 52 | 70 | export function summariseCheckFailure( |
| 53 | 71 | lines: readonly string[], |
| @@ -80,13 +98,14 @@ export function summariseCheckFailure( | ||
| 80 | 98 | }; |
| 81 | 99 | } |
| 82 | 100 | const unnamed = lines.find((line) => UNNAMED_SHARD.test(line.trim())); |
| 101 | if (!full && !ownExit(fallback)) return { summary: truncate(fallback), detail: undefined }; | |
| 83 | 102 | if (full) return { summary: truncate(`${note}${unnamed?.trim() ?? fallback}`), detail }; |
| 84 | 103 | if (unnamed !== undefined) |
| 85 | 104 | return { summary: truncate(unnamed.trim()), detail: undefined }; |
| 86 | 105 | const block = lines.findLastIndex((line) => line.trim() === GATE_SUMMARY_HEADING); |
| 87 | 106 | for (let i = (block === -1 ? lines.length : block) - 1; i >= 0; i--) { |
| 88 | 107 | const line = lines[i]!.trim(); |
| 89 | if (line !== "") return { summary: truncate(line), detail: undefined }; | |
| 108 | if (line !== "" && !RECORD_KEEPING.test(line)) return { summary: truncate(line), detail: undefined }; | |
| 90 | 109 | } |
| 91 | 110 | return { summary: fallback, detail: undefined }; |
| 92 | 111 | } |
test/checks-failure-summary.test.ts +33
| @@ -274,4 +274,37 @@ describe("summariseCheckFailure: a red gate is summarised by its red test, never | ||
| 274 | 274 | "test-shards: something went wrong", |
| 275 | 275 | ); |
| 276 | 276 | }); |
| 277 | ||
| 278 | // #12940: two verify reds read "test-shards: kept 147 green results in | |
| 279 | // .forge-kept.json", which is the gate's bookkeeping, and the lane alarm | |
| 280 | // reported that as the commonest failure. | |
| 281 | test("the gate's record-keeping after the tally is never the summary", () => { | |
| 282 | const lines = [ | |
| 283 | "test-shards: something went wrong", | |
| 284 | "test-shards: wrote 12 test impacts to .forge-cache/impact.json", | |
| 285 | "test-shards: kept 147 green results in .forge-kept.json", | |
| 286 | "test-shards: not recording: a file is red, so its time is not its time", | |
| 287 | "", | |
| 288 | ]; | |
| 289 | expect(summariseCheckFailure(lines, "check exited with code 1").summary).toBe("test-shards: something went wrong"); | |
| 290 | }); | |
| 291 | ||
| 292 | test("a check stopped from outside is summarised by the stop, not its last printed line", () => { | |
| 293 | const lines = ["Ran 4000 tests across 900 files in 1200.0s (16 shards).", "test-shards: kept 147 green results in .forge-kept.json"]; | |
| 294 | for (const stop of [ | |
| 295 | "check stopped: it used 16.0 cores for 30s", | |
| 296 | "the build ran out of its 8 GiB", | |
| 297 | "check was killed by SIGKILL", | |
| 298 | "check took longer than 7200s", | |
| 299 | "check cancelled", | |
| 300 | ]) | |
| 301 | expect(summariseCheckFailure(lines, stop)).toEqual({ summary: stop, detail: undefined }); | |
| 302 | // The step's own exit still yields to what its output said last. | |
| 303 | expect(summariseCheckFailure(lines, "check exited with code 1").summary).toBe(lines[0]!); | |
| 304 | }); | |
| 305 | ||
| 306 | test("a named red test still leads a check stopped from outside", () => { | |
| 307 | const lines = ["(fail) a > b [1ms]", " 1 pass", " 1 fail"]; | |
| 308 | expect(summariseCheckFailure(lines, "check was killed by SIGTERM").summary).toBe('1 of 2 tests — "a > b"'); | |
| 309 | }); | |
| 277 | 310 | }); |
new above
offline
This early return discards
unnamed, the shard line that says which test was running when the check was killed. Keep it asdetail, or add a test that pins the choice. Not blocking.