Skip to content

fix: never supersede a concluded backport approval check from the opened event - #424

Merged
MarshallOfSound merged 1 commit into
mainfrom
sam/fix-opened-approval-check-supersede
Aug 31, 2026
Merged

MarshallOfSound merged 1 commit into
mainfrom
sam/fix-opened-approval-check-supersede

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Member

Fixes the stuck "Backport Approval Enforcement" check on electron/electron#53332.

That PR ended up with five approval check runs on the head SHA. The four from the labeled/unlabeled deliveries all concluded "Not Required" within a minute of the PR opening. The fifth was created at 15:59:41Z by the opened handler and never completed, because the opened handler is always the slow one for a manual backport (it runs updateManualBackport first, which is what writes the labels in the first place). By the time it got to the approval verdict, its check-run snapshot from the top of the handler was two minutes stale, still said queued, and so the #423 guard let queueBackportApprovalCheck supersede the already-concluded run with a fresh queued one. Nothing fires after that, so it sits there forever. This isn't the reordering edge case #423 was defending against, it's the normal ordering for a manual backport.

Two changes:

  • queueBackportApprovalCheck takes { supersedeCompleted }. Callers that just need a pending run to exist pass false, and if the live run concluded in the meantime it's left alone. The decision is made against the re-fetch right before the write instead of the caller's snapshot. Both the "ensure a run exists" call at the top of the handler and the opened stay-pending path use it; the backport/requested paths keep superseding, which is the #53035 fix.
  • The stay-pending path on opened is now only for trop-authored PRs, where the labels really do arrive from a different delivery (backportImpl). A manually opened backport gets labeled by updateManualBackport in the same handler before the live labels are read, so the verdict is already settled and it concludes right there, no labeled event needed.

Tests: reworked the #423 opened specs for the trop-authored case, added the manual-backport case from #53332, and covered supersedeCompleted: false in checks-util.spec.ts.

…ned event

The opened-event handler decided whether to re-queue the backport approval
check from the check-run snapshot it took at the top of the handler. For a
manual backport that snapshot is minutes old by the time the verdict is
evaluated, because the handler runs the manual-backport bookkeeping (labels,
comment, reviewer requests) first. In that window the labeled deliveries for
the same PR concluded the run 'Not Required', so the stale 'not completed'
snapshot let queueBackportApprovalCheck supersede the concluded run with a
fresh queued one that no follow-up event ever completed (electron/electron#53332).

- queueBackportApprovalCheck takes a supersedeCompleted option; callers that
  only need a pending run to exist pass false, and a run that concluded in
  the meantime is left alone. The decision is made against the live run
  right before the write, not against the caller's snapshot.
- The stay-pending path on opened is limited to trop-authored PRs, whose
  labels arrive from backportImpl in a separate delivery. A manually opened
  backport is labeled by updateManualBackport in the same handler before the
  live labels are read, so its verdict is already settled and it concludes
  immediately.
@MarshallOfSound
MarshallOfSound requested a review from a team as a code owner August 31, 2026 16:10
@MarshallOfSound
MarshallOfSound merged commit 0cda03e into main Aug 31, 2026
6 checks passed
@MarshallOfSound
MarshallOfSound deleted the sam/fix-opened-approval-check-supersede branch August 31, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants