fix(ci): resolve fork PR by head ref, not laggy commit association - #3915
Draft
Andrei Kvapil (kvaps) wants to merge 1 commit into
Draft
fix(ci): resolve fork PR by head ref, not laggy commit association#3915Andrei Kvapil (kvaps) wants to merge 1 commit into
Andrei Kvapil (kvaps) wants to merge 1 commit into
Conversation
The e2e-fork resolve guard mapped the built head SHA back to its PR with listPullRequestsAssociatedWithCommit, whose commit->PR index lags minutes -- longer for forks -- behind a head force-push. A freshly rebased fork PR read back zero associations, so the guard failed "E2E Tests" closed on a state the author could not clear by pushing again. Resolve by the fork head ref (owner:branch, from the workflow_run event) via pulls.list, which is answered from the live PR table and returns the PR the instant the push lands. The head.sha === HEAD_SHA filter and the exactly-one check are unchanged, so the guard stays as narrow as before. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
The privileged
E2E (fork)workflow resolves a fork PR's number from the head SHA itsPull Requestrun built, then posts the requiredE2E Testsstatus back on that SHA. It resolved the PR withlistPullRequestsAssociatedWithCommit, whose commit→PR association index is populated asynchronously and lags minutes — longer for forks — behind a head force-push. A fork PR that was just rebased therefore reads back zero associations, and the resolve guard failsE2E Testsclosed withexpected exactly one open PR for <sha>, found 0— a red the author cannot clear by pushing again, since the SHA is already correct and only the index is behind.This resolves the PR by its head ref instead —
owner:branch, both taken from theworkflow_runevent — viapulls.list, which is answered from the live PR table and returns the PR the instant the push lands. Thehead.sha === HEAD_SHAfilter and the exactly-one check are unchanged, so the guard stays exactly as narrow as before: only one open PR sitting AT the built SHA satisfies it, and a stacked second PR or a stale run whose ref has since moved still fails closed.Observed on a rebased fork PR: its head SHA was correct and
refs/pull/N/headresolved in the base repo, yetlistPullRequestsAssociatedWithCommitreturned 0 for that head across an extended window whilepulls.listby head ref returned the PR immediately.This is a disclosure per the project's AI-assistance guidance: the change was drafted with AI assistance and reviewed by the author, who remains responsible for it.
Downstream repositories
Release note