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

Sentinel: The lane has stopped: nothing has merged and nothing said so #12944

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/forge:mason/12940-sentinel-the-lane-has-stopped-nothing-ha → main 1 commit fork 1 thread · 1 unresolved

  • Merged. mason/12940-sentinel-the-lane-has-stopped-nothing-ha was merged into main as 097c46a.

Review

Sign in to review this change.
2 files changed +54 −2
src/checks/summary.ts +21 −2
@@ -27,6 +27,21 @@ export const GATE_SUMMARY_HEADING = "── gate summary";
2727 const UNNAMED_SHARD =
2828 /^shard [0-9]+ (?:exited -?[0-9]+ without naming a test: |killed after [0-9]+ s, running )/;
2929
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
3045 /** A summary is one line on a card; a name from a subprocess is bounded to fit it. */
3146 const SUMMARY_MAX = 200;
3247
@@ -47,7 +62,10 @@ export interface CheckFailure {
4762 * output named nothing better, so a truthful "no output at all" is never
4863 * dressed up as more than it is. Without test names the summary is the
4964 * 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.
5169 */
5270 export function summariseCheckFailure(
5371 lines: readonly string[],
@@ -80,13 +98,14 @@ export function summariseCheckFailure(
8098 };
8199 }
82100 const unnamed = lines.find((line) => UNNAMED_SHARD.test(line.trim()));
101 if (!full && !ownExit(fallback)) return { summary: truncate(fallback), detail: undefined };

This early return discards unnamed, the shard line that says which test was running when the check was killed. Keep it as detail, or add a test that pins the choice. Not blocking.

83102 if (full) return { summary: truncate(`${note}${unnamed?.trim() ?? fallback}`), detail };
84103 if (unnamed !== undefined)
85104 return { summary: truncate(unnamed.trim()), detail: undefined };
86105 const block = lines.findLastIndex((line) => line.trim() === GATE_SUMMARY_HEADING);
87106 for (let i = (block === -1 ? lines.length : block) - 1; i >= 0; i--) {
88107 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 };
90109 }
91110 return { summary: fallback, detail: undefined };
92111 }
test/checks-failure-summary.test.ts +33
@@ -274,4 +274,37 @@ describe("summariseCheckFailure: a red gate is summarised by its red test, never
274274 "test-shards: something went wrong",
275275 );
276276 });
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 });
277310 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs