Repository navigation
fix(webhooks): resolve fresh pull request merge commits #409
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
Open
Bnjoroge1
wants to merge
27
commits into
main
Choose a base branch
from
Bnjoroge/pr-fresh-merge-sha
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
5f70e50
feat(merge): self-built pull-request test merges (flow 1 + shared bui…
2806ffd
fix(merge): imports, thiserror dep, protocol field literals
de6b19a
fix(merge): unused import and ApiError tracing field
ef5df24
test(merge): flow-1 integration coverage
2691d00
test(merge): register target, fix fixture move
d67672b
fix(merge): merged runs check out the merge commit; tests read snapsh…
0103f38
test(merge): assert on the internal run record; cargo fmt
0d15ff4
test(merge): cover dirty PR merge contract
2d12b9e
fix(merge): import dirty snapshot into mirror
570a1f3
test(merge): create dirty fixture head branch
9e9876c
test(merge): decode parent assertion output
bc1ce89
fix(merge): avoid direct thiserror dependency
a3bce41
fix(merge): refresh merged run identity before evaluation
a4e8119
docs: clarify PR merge base selection
fbf83ce
style: format merge test and context
7b4fd17
fix(merge): redirect self-built merge git fetches
b1abd82
fix(merge): bind prebuilt mirrors to repositories
5946588
fix(webhooks): resolve a pull request's live test merge before creati…
Bnjoroge1 92d96a2
fix(webhooks): poll GitHub's live test merge every 2s and build our o…
Bnjoroge1 462615e
fix(webhooks): log the observed stale merge parent
Bnjoroge1 7644166
ci: re-run checks on the current tree
Bnjoroge1 99db5bd
Merge remote-tracking branch 'public/main' into fix/pr409-webhook-ci
Bnjoroge1 8e3eaaf
Merge remote-tracking branch 'public/main' into fix/pr409-shards
Bnjoroge1 700280b
test(webhooks): allow merge poll retries on loaded runners
Bnjoroge1 a12e22e
ci: re-run checks on the current tree
Bnjoroge1 02e17fb
Merge remote-tracking branch 'public/main' into fx-409b
Bnjoroge1 0c6a8eb
test(webhooks): give never-resolving merge polls a 5s budget
Bnjoroge1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
local_default_branchcan return a remote-qualified name that is never stripped.git remotelists remotes in alphabetical order. The function returns the first remote whoseHEADresolves.symbolic-ref --shortthen returns<remote>/<branch>, for examplefork/main.strip_branch_prefixstrips onlyorigin/,upstream/, and the fullrefs/remotes/<remote>/form. A remote namedforkorminesorts beforeorigin, so its name stays in the result.Trigger: a local
--event pull_requestrun with no--baseand nopull_request.base.refin the payload, in a workspace that has a remote sorting beforeorigin.Consequence:
filter_branchbecomesfork/main, soon.pull_request.branchesfilters evaluate against the wrong name.pull_request_base_branchfalls back tofilter_branch.normalize_branch_namedoes not stripfork/either. The merge builder then fetchesrefs/heads/fork/mainfromorigin. That ref does not exist, so the submission fails withBaseBranchMissing.Fix: check
originfirst, and drop--short. The fullrefs/remotes/<remote>/<branch>value goes through therefs/remotes/branch ofstrip_branch_prefix, which removes any remote name.Proposed fix
fn local_default_branch() -> Option<String> { - for remote in git_remotes() { + let mut remotes = git_remotes(); + // Prefer `origin`: it is the remote the engine fetches the merge base from. + remotes.sort_by_key(|remote| remote != "origin"); + for remote in remotes { let output = std::process::Command::new("git") .args([ "symbolic-ref", "--quiet", - "--short", &format!("refs/remotes/{remote}/HEAD"), ]) .output();📝 Committable suggestion
🤖 Prompt for AI Agents