Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): PR watches wake again once checks finish after an early failure #30531

ClosedThe1UNeed(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/30531/headopened View on GitHub

Showing 2 changed files with 49 additions and 2 deletions.

x
0 of 2 viewed, 2 left
35 additions and 1 deletionapps/server/src/orchestration-v2/pullRequestWatch.test.tsModified
View file
@@ -211,13 +211,47 @@
});
​
- it("reports each failure at once, even while another check never finishes", () => {
+ it("reports each failure at once, and again once the other checks finish", () => {
const bot = check("CodeRabbit", "pending");
const first = detail({ checks: [check("lint", "failure"), check("test", "pending"), bot] });
const lint = evaluatePullRequestWatch(watch(), first, noRemarks);
assert.deepEqual(lint.changes, [{ kind: "checks-failed", failed: [check("lint", "failure")] }]);
assert.deepEqual(evaluatePullRequestWatch(lint.next, first, noRemarks).changes, []);
​
+ const finished = detail({
+ checks: [check("lint", "failure"), check("test", "success"), check("CodeRabbit", "success")],
+ });
+ const settled = evaluatePullRequestWatch(lint.next, finished, noRemarks);
+ assert.deepEqual(settled.changes, [
+ { kind: "checks-failed", failed: [check("lint", "failure")] },
+ ]);
+ assert.deepEqual(evaluatePullRequestWatch(settled.next, finished, noRemarks).changes, []);
+ const late = detail({ checks: [...finished.checks, check("docs", "pending")] });
+ const lateRun = evaluatePullRequestWatch(settled.next, late, noRemarks);
+ const lateDone = detail({ checks: [...finished.checks, check("docs", "success")] });
+ assert.deepEqual(evaluatePullRequestWatch(lateRun.next, lateDone, noRemarks).changes, []);
+ const held = { ...check("test", "action-required"), url: run(3) };
+ const heldRead = detail({ checks: [check("lint", "failure"), held] });
+ const hold = evaluatePullRequestWatch(lint.next, heldRead, noRemarks);
+ assert.deepEqual(hold.changes, [{ kind: "checks-awaiting-approval", checks: [held] }]);
+ const ran = { ...check("test", "success"), url: `${run(3)}/job/1` };
+ const heldDone = detail({ checks: [check("lint", "failure"), ran] });