Repository navigation
fix(server): PR watches wake again once checks finish after an early failure #30531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
0f116de
f89c75b
edcc6bd
4304fb9
7cf5795
cd94f5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,8 +61,9 @@ export function evaluatePullRequestWatch( | |
| const checks = detail.checks.filter((check) => check.placeholder !== true); | ||
| const failed = checks.filter(isFailedCheck); | ||
| const awaiting = checks.filter((check) => check.status === "action-required"); | ||
| const owedBefore = owedChecks; | ||
| const newlyFailed = failed.filter((check) => !failedChecks.includes(check.name)); | ||
| if (checks.length > 0) { | ||
| const newlyFailed = failed.filter((check) => !failedChecks.includes(check.name)); | ||
| if (newlyFailed.length > 0) changes.push({ kind: "checks-failed", failed: newlyFailed }); | ||
| if (!approvalAnnounced && awaiting.length > 0) { | ||
| changes.push({ kind: "checks-awaiting-approval", checks: awaiting }); | ||
|
|
@@ -136,6 +137,18 @@ export function evaluatePullRequestWatch( | |
| changes.push({ kind: "checks-passed", count: checks.length, required: false }); | ||
| owedChecks = []; | ||
| } | ||
| // A failed gate never reports passed, so it owes one wake when the checks still running finish. | ||
| if (!passedNow && failed.length > 0) { | ||
| const unfinished = checks | ||
| .filter((check) => check.status === "pending" || check.status === "action-required") | ||
| .map((check) => check.name); | ||
| const holding = unfinished.length > 0 || awaitingApproval.length > 0; | ||
| if (!holding && owedBefore.length > 0 && newlyFailed.length === 0) { | ||
| changes.push({ kind: "checks-failed", failed }); | ||
| } | ||
| const owing = newlyFailed.length > 0 || owedBefore.length > 0; | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| owedChecks = owing && holding ? (unfinished.length > 0 ? unfinished : owedBefore) : []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preserve wake debt when only an approval hold remains. If an approval run disappears from a read and As per coding guidelines, “Backend behavior changes ship with focused tests for that behavior.”
|
||
| } | ||
| passed = passedNow; | ||
| passedChecks = passedNow ? gateNames : []; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include all remaining failures when the last check fails.
If
linthas failed and the last pending check then fails,newlyFailedcontains that last check. Line 146 suppresses the final full-list report, so the wake lists only the new failure even thoughlintstill fails. Make that wake reportfailedwithout sending a duplicate wake. (raw.githubusercontent.com)