Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): PR watches wake when checks finish after an early failure #28020

ClosedRhinomcd(GitHub profile, opens in a new tab)wants to merge 13 commits intomain fromrefs/pull/28020/headopened View on GitHub

Showing 2 changed files with 169 additions and 2 deletions.

x
0 of 2 viewed, 2 left
130 additions and 0 deletionsapps/server/src/orchestration-v2/pullRequestWatch.test.tsModified
View file
@@ -541,6 +541,136 @@
assert.deepEqual(evaluatePullRequestWatch(final.next, recovered, noRemarks).changes, []);
});
​
+ it("wakes once when the other checks finish after one failed where none is required", () => {
+ const sonar = check("sonar", "cancelled");
+ const early = detail({ checks: [sonar, check("unit", "pending"), check("e2e", "pending")] });
+ const first = evaluatePullRequestWatch(watch(), early, noRemarks);
+ assert.deepEqual(first.changes, [{ kind: "checks-failed", failed: [sonar] }]);
+​
+ const partway = detail({ checks: [sonar, check("unit", "success"), check("e2e", "pending")] });
+ const waiting = evaluatePullRequestWatch(first.next, partway, noRemarks);
+ assert.deepEqual(waiting.changes, []);
+​
+ const done = detail({ checks: [sonar, check("unit", "success"), check("e2e", "success")] });
+ const final = evaluatePullRequestWatch(waiting.next, done, noRemarks);
+ assert.deepEqual(final.changes, [
+ { kind: "checks-finished", failing: [sonar], required: false },
+ ]);
+ assert.deepEqual(evaluatePullRequestWatch(final.next, done, noRemarks).changes, []);
+​
+ // An owed check stays owed while it runs, even when the failed one turns required.
+ const gated = detail({
+ checks: [{ ...sonar, required: true }, check("unit", "success"), check("e2e", "pending")],
+ });
+ const still = evaluatePullRequestWatch(waiting.next, gated, noRemarks);
+ assert.deepEqual(still.changes, []);
+ assert.deepEqual(still.next.owedChecks, ["e2e"]);
+​
+ // Another gate failure owes the gate's running checks on top of those still owed.