Repository navigation
π fix(automerge): group the one-PR-per-issue rule by base branch - #17437
Conversation
Release-line siblings (the same fix against v5 and v6, both Fixes #N) were read as duplicates: the later PR was parked with merge-train:duplicate-of#<earlier> and the dashboard asked for a human decision while CI was still running. Group duplicate candidates by base branch and skip cross-line claimants in the claim-conflict pass. Fixes #17436 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Looks correct to me. Read automerge_merge_train_duplicate.go at the v5 base alongside the diff:
planDuplicateHoldsnow buckets candidates bypr.GetBase().GetRef()before callingmergeTrainDuplicateHoldsper bucket, then re-sorts the merged holds by PR number β same stable ordering the per-bucket function already guaranteed, so the plan stays deterministic across passes.sortwas already imported.planClaimConflictsadds!mergeTrainSameLine(pr, other)to the skip condition at the point whereotheris a repo-wide claimant outside the lane, which is exactly where the v5/v6 sibling was being read as a conflict.- The new test exercises the case that bit #17414/#17415 and keeps the same-line case (two v6 PRs) competing.
One small inconsistency, not blocking: the doc comment on mergeTrainSameLine says a PR with no base recorded "compares as the same line so partial fixtures keep their old behaviour", and that holds for the claim-conflict pass. But planDuplicateHolds groups by the raw base string, so an empty-base PR lands in its own "" bucket and does not compete with a PR whose base is v5. Today's fixtures in automerge_merge_train_duplicate_test.go set no Base at all, so they all share one bucket and the old behaviour is preserved β it only diverges for a mixed fixture. If you want the comment to be literally true, group through a helper that normalises "", or trim the sentence.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. Review findings from Read Why the fix is in the right place. Claim-conflict side. The added Two non-blocking notes:
|
There was a problem hiding this comment.
Read automerge_merge_train_duplicate.go and the caller in automerge_merge_train.go:534 at the v5 base. The change does what the body says, and it is the right layer: planMergeTrains already groups trains perBase (automerge_merge_train.go:555), so the one-PR-per-issue rule running before that grouping without a base key was the only place v5/v6 siblings could ever collide. Looks correct to me.
Verified:
planDuplicateHoldsnow keys bypr.GetBase().GetRef()first;mergeTrainDuplicateHoldsis unchanged and still gets a per-issue map, so the winner rule (green > earlier > lower number) is identical within a line. The outersort.Sliceby PR number restores the stable ordering the inner sort used to provide.planClaimConflictsskipsotherwhen!mergeTrainSameLine(pr, other)βrecordedDecisionForalready keys on the candidate's base ref, so this is consistent with how decisions were recorded.- The new test covers both halves (cross-line not held / not claim-conflict; same-line still held) and the prefilter-refused claimant case.
One low-severity note, not a blocker:
mergeTrainSameLine(automerge_merge_train_duplicate.go:125-128) documents that an empty base "compares as the same line so partial fixtures keep their old behaviour", butplanDuplicateHoldsgroups by exactline := pr.GetBase().GetRef(), so a fixture withBase == nillands in the""group and never competes with a"v5"PR. The two paths therefore treat an empty base differently. GitHub always populatesbase.ref, so this is test-fixture-only; if you want the comment to be true for both paths, either drop the empty-base clause frommergeTrainSameLineor document that the duplicate pass requires a base. Not worth another push on its own.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read against the v5 tree (src/pkg/github/automerge/automerge_merge_train_duplicate.go, automerge_merge_train.go). The per-base grouping looks correct to me: planDuplicateHolds now runs mergeTrainDuplicateHolds once per base.ref bucket and re-sorts holds by number, and planClaimConflicts skips cross-line claimants via mergeTrainSameLine. The test covers both the duplicate and the claim-conflict path for the v5/v6 pair and still holds two v6 PRs against each other.
Two things, neither blocking:
-
Not a duplicate of #17444, but a hard conflict. #17444 (gate-only holds + remembered winner,
Fixes #17439) rewrites the same two functions βplanClaimConflictsgains a new signature andmergeTrainDuplicateHoldsbecomesmergeTrainDuplicatePicks. Whichever lands second must redo its change on top of the other. If this one lands first, #17444's rebase needs two things beyond conflict resolution: (1) the remembered-winner keymergeTrainVerdictKey(lane, owner, repo, issue)must include the base ref, otherwise a v5 winner and a v6 winner of the same issue overwrite each other every pass andclaimMergeTrainIssueTurnholds the v6 PR asduplicate-ofthe v5 PR at the merge point β the bug #17436 describes, moved one stage later; (2) this PR'sTestPlanDuplicateHoldsGroupsByBaseBranchconstructs a bareEnginewith no lane verdicts, so under #17444 nobody isAtGateand theduplicateOf(17420)assertion fails until the heads are marked at the gate. #17444's body already lists both. This is the smaller, fully green PR; landing it first and rebasing #17444 seems the lower-risk order. -
Info:
mergeTrainSameLinetreats an empty base as "same line" (automerge_merge_train_duplicate.go:126-128), but theplanDuplicateHoldsbucket key is the literalpr.GetBase().GetRef()(:151), so a PR with an empty base lands in its own""bucket and never competes with av5PR. GitHub always populatesbase.ref, and existing fixtures set no base at all (so they share the""bucket), so this only matters for a mixed fixture β but the comment onmergeTrainSameLinepromises a guarantee the duplicate path doesn't share. Not worth a push on its own.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 69ab7d4. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Fixes #17436
planDuplicateHoldskeyed candidates by claimed issue only, so #17414 (v5) and #17415 (v6) β the same Scorecard guard, bothFixes #17392β were read as duplicates and the later one parked asmerge-train:duplicate-of#17414, rendered on the dashboard as "needs human decision Β· Let hive decide" mid-CI.mergeTrainSameLine: two PRs compete only when their base refs match (empty base keeps old behaviour)planDuplicateHoldsgroups by base branch before running the winner rule; holds are re-sorted by PR number across linesplanClaimConflictsskips claimants on another base branchChangelog fragment included.