Repository navigation
fix(server): PR watches report reruns that fail again and failed runs another GitHub event hides #32319
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
base: main
Are you sure you want to change the base?
fix(server): PR watches report reruns that fail again and failed runs another GitHub event hides #32319
Changes from all commits
e3b3b1b
3c3cd50
ec13a32
9a03aa7
3c0110d
8b95048
2d53ab3
140ad96
36cd04d
1f8e948
68e680b
3269b65
100a18d
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -59,9 +59,18 @@ export function sortChecks( | |||||
| ); | ||||||
| } | ||||||
|
|
||||||
| // Runs of one check for different events: a failure outranks a run in progress, which outranks a | ||||||
| // pass, which outranks a run cancelled beside it (a concurrency group superseding it). | ||||||
| function eventSeverity(status: PullRequestCheck["status"]): number { | ||||||
| if (status === "failure" || status === "action-required") return 3; | ||||||
| if (status === "pending") return 2; | ||||||
| return status === "success" ? 1 : 0; | ||||||
|
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. Rank
Give Suggested fix
Committable suggestion
|
||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Rollups repeat checks during reruns or overlapping runs, and checks carry no ids. | ||||||
| * Identify checks by workflow plus name because different workflows may share job names. | ||||||
| * Within one event the newest run wins; across events the worse run does. | ||||||
| */ | ||||||
| export function dedupeChecks( | ||||||
| entries: ReadonlyArray<{ | ||||||
|
|
@@ -70,12 +79,15 @@ export function dedupeChecks( | |||||
| readonly at: string | null; | ||||||
| // Hosts with one-second timestamps can date a final and an earlier status alike. | ||||||
| readonly sequence?: number; | ||||||
| /** What triggered the run, where the host says (GitHub's `push` or `pull_request`). */ | ||||||
| readonly event?: string | null; | ||||||
| }>, | ||||||
| ): ReadonlyArray<PullRequestCheck> { | ||||||
| const newestByCheck = new Map<string, (typeof entries)[number]>(); | ||||||
| type Entry = (typeof entries)[number]; | ||||||
| const newestByRun = new Map<string, Entry>(); | ||||||
| for (const entry of entries) { | ||||||
| const key = JSON.stringify([entry.workflowName ?? "", entry.check.name]); | ||||||
| const kept = newestByCheck.get(key); | ||||||
| const key = JSON.stringify([entry.workflowName ?? "", entry.check.name, entry.event ?? null]); | ||||||
| const kept = newestByRun.get(key); | ||||||
| if (kept !== undefined) { | ||||||
| if (!isAtLeastAsNew(entry.at, kept.at)) continue; | ||||||
| if ( | ||||||
|
|
@@ -86,7 +98,29 @@ export function dedupeChecks( | |||||
| ) | ||||||
| continue; | ||||||
| } | ||||||
| newestByCheck.set(key, entry); | ||||||
| newestByRun.set(key, entry); | ||||||
| } | ||||||
| const newestByCheck = new Map<string, Entry>(); | ||||||
| for (const entry of newestByRun.values()) { | ||||||
| const key = JSON.stringify([entry.workflowName ?? "", entry.check.name]); | ||||||
| const kept = newestByCheck.get(key); | ||||||
| if (kept === undefined) { | ||||||
| newestByCheck.set(key, entry); | ||||||
| continue; | ||||||
| } | ||||||
| const severity = eventSeverity(entry.check.status) - eventSeverity(kept.check.status); | ||||||
| const newer = isAtLeastAsNew(entry.at, kept.at); | ||||||
| // Equal times break on the event, so a reordered rollup cannot flip the run a watch was told. | ||||||
| const tied = newer && isAtLeastAsNew(kept.at, entry.at); | ||||||
| const later = tied ? (entry.event ?? "") > (kept.event ?? "") : newer; | ||||||
| const worse = severity > 0 || (severity === 0 && later); | ||||||
| const chosen = worse ? entry : kept; | ||||||
| newestByCheck.set( | ||||||
| key, | ||||||
| entry.check.required === true || kept.check.required === true | ||||||
| ? { ...chosen, check: { ...chosen.check, required: true } } | ||||||
| : chosen, | ||||||
| ); | ||||||
| } | ||||||
| const survivors = [...newestByCheck.values()]; | ||||||
| const countsByName = new Map<string, number>(); | ||||||
|
|
||||||
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.
🟡 Medium
orchestration-v2/pullRequestWatch.ts:97A genuine retry failure is suppressed when its start time precedes the finish time of the other event's original run, so no
checks-failedwake is emitted and the retry is then permanently recorded infailedRuns.toldFinishescompares every failure with the same check name without preserving event identity; retain event/attempt identity or otherwise avoid using another event's finish time to classify a retry.🚀 Reply "fix it for me" or copy this AI Prompt for your agent: