Skip to content

Commit 006682a

Browse files
Rhinomcdclaude
andcommitted
fix(server): an advisory failure keeps the owed gate checks
Only a new gate failure re-arms the owed set; a new advisory failure no longer owes gate checks that started after the gate failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f6fcf7b commit 006682a

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,20 @@ describe("evaluatePullRequestWatch", () => {
287287
"- The checks still running when one failed have finished on aaaaaaa. Still failing:\n - lint https://ci.example/lint",
288288
);
289289

290+
// A new advisory failure keeps what was owed rather than owing a required check started since.
291+
const advisory = detail({
292+
checks: [
293+
required("lint", "failure"),
294+
required("unit", "pending"),
295+
required("smoke", "pending"),
296+
check("bot", "failure"),
297+
check("e2e", "failure"),
298+
],
299+
});
300+
const later = evaluatePullRequestWatch(first.next, advisory, noRemarks);
301+
assert.deepEqual(later.changes, [{ kind: "checks-failed", failed: [check("e2e", "failure")] }]);
302+
assert.deepEqual(later.next.owedChecks, ["unit"]);
303+
290304
// A rerun of the failed required check is not the gate finishing, even with an advisory failure.
291305
const rerun = detail({
292306
checks: [

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export function evaluatePullRequestWatch(
9090
// Gate checks still running when one failed are owed one wake when they finish, since
9191
// the gate can no longer pass and so never sends the checks-passed wake.
9292
const running = gate.filter((check) => check.status === "pending").map((check) => check.name);
93-
owedChecks =
94-
newlyFailed.length > 0 ? running : owedBefore.filter((name) => running.includes(name));
93+
const gateNewlyFailed = newlyFailed.some((check) => gateNames.includes(check.name));
94+
owedChecks = gateNewlyFailed ? running : owedBefore.filter((name) => running.includes(name));
9595
if (newlyFailed.length === 0 && owedBefore.length > 0 && owedChecks.length === 0) {
9696
changes.push({ kind: "checks-finished", failing: gate.filter(isFailedCheck) });
9797
}

0 commit comments

Comments
 (0)