Skip to content

Commit a904b1f

Browse files
Rhinomcdclaude
andcommitted
fix(server): a checks-finished wake says when only required checks finished
With required checks, only the required checks still running are owed the wake, so it named all checks as finished while advisory ones still ran. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f357c58 commit a904b1f

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

‎apps/server/src/orchestration-v2/pullRequestWatch.test.ts‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ describe("evaluatePullRequestWatch", () => {
217217

218218
const done = detail({ checks: [sonar, check("unit", "success"), check("e2e", "success")] });
219219
const final = evaluatePullRequestWatch(waiting.next, done, noRemarks);
220-
assert.deepEqual(final.changes, [{ kind: "checks-finished", failing: [sonar] }]);
220+
assert.deepEqual(final.changes, [
221+
{ kind: "checks-finished", failing: [sonar], required: false },
222+
]);
221223
assert.deepEqual(evaluatePullRequestWatch(final.next, done, noRemarks).changes, []);
222224

223225
// An owed check stays owed while it runs, even when the failed one turns required.
@@ -242,7 +244,7 @@ describe("evaluatePullRequestWatch", () => {
242244
});
243245
assert.deepEqual(evaluatePullRequestWatch(waiting.next, finishedWithBot, noRemarks).changes, [
244246
{ kind: "checks-failed", failed: [bot] },
245-
{ kind: "checks-finished", failing: [sonar, bot] },
247+
{ kind: "checks-finished", failing: [sonar, bot], required: false },
246248
]);
247249

248250
// A later failure is its own wake and leaves nothing more owed.
@@ -264,7 +266,7 @@ describe("evaluatePullRequestWatch", () => {
264266
const settled = detail({ checks: [sonar, check("unit", "failure"), check("e2e", "success")] });
265267
const last = evaluatePullRequestWatch(second.next, settled, noRemarks);
266268
assert.deepEqual(last.changes, [
267-
{ kind: "checks-finished", failing: [sonar, check("unit", "failure")] },
269+
{ kind: "checks-finished", failing: [sonar, check("unit", "failure")], required: false },
268270
]);
269271
});
270272

@@ -295,7 +297,7 @@ describe("evaluatePullRequestWatch", () => {
295297
});
296298
const final = evaluatePullRequestWatch(first.next, done, noRemarks);
297299
assert.deepEqual(final.changes, [
298-
{ kind: "checks-finished", failing: [required("lint", "failure")] },
300+
{ kind: "checks-finished", failing: [required("lint", "failure")], required: true },
299301
]);
300302
assert.deepEqual(evaluatePullRequestWatch(final.next, done, noRemarks).changes, []);
301303
const message = pullRequestWatchMessage({
@@ -309,7 +311,7 @@ describe("evaluatePullRequestWatch", () => {
309311
assert.equal(message.notification.summary, "#7: checks finished");
310312
assert.include(
311313
message.text,
312-
"- The checks still running when one failed have finished on aaaaaaa. Still failing:\n - lint https://ci.example/lint",
314+
"- The required checks still running when one failed have finished on aaaaaaa. Still failing:\n - lint https://ci.example/lint",
313315
);
314316

315317
// A new advisory failure keeps what was owed rather than owing a required check started since.

‎apps/server/src/orchestration-v2/pullRequestWatch.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ const SNIPPET_LENGTH = 200;
1717
export type PullRequestWatchChange =
1818
| { readonly kind: "checks-failed"; readonly failed: ReadonlyArray<PullRequestCheck> }
1919
| { readonly kind: "checks-passed"; readonly count: number; readonly required: boolean }
20-
| { readonly kind: "checks-finished"; readonly failing: ReadonlyArray<PullRequestCheck> }
20+
| {
21+
readonly kind: "checks-finished";
22+
readonly failing: ReadonlyArray<PullRequestCheck>;
23+
readonly required: boolean;
24+
}
2125
| { readonly kind: "remarks"; readonly remarks: ReadonlyArray<PullRequestComment> }
2226
| { readonly kind: "no-checks"; readonly minutes: number }
2327
| { readonly kind: "conflicting" };
@@ -100,7 +104,11 @@ export function evaluatePullRequestWatch(
100104
: stillOwed;
101105
const owedFailed = newlyFailed.some((check) => owedBefore.includes(check.name));
102106
if (!owedFailed && owedBefore.length > 0 && owedChecks.length === 0) {
103-
changes.push({ kind: "checks-finished", failing: gate.filter(isFailedCheck) });
107+
changes.push({
108+
kind: "checks-finished",
109+
failing: gate.filter(isFailedCheck),
110+
required: owedBefore.every((name) => required.some((check) => check.name === name)),
111+
});
104112
}
105113
}
106114
passed = passedNow;
@@ -223,7 +231,7 @@ function changeLines(
223231
];
224232
case "checks-finished":
225233
return [
226-
`- The checks still running when one failed have finished${context.commit}. Still failing:`,
234+
`- The ${change.required ? "required " : ""}checks still running when one failed have finished${context.commit}. Still failing:`,
227235
...listed(
228236
change.failing,
229237
(check) => ` - ${check.name}${check.url ? ` ${check.url}` : ""}`,

0 commit comments

Comments
 (0)