Repository navigation
✨ feat(automerge): route sweep, lgtm queue and hive-merge relay through the serialized lane gate - #10905
Conversation
…serialized lane gate Closes #10889 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <scanner@hive.kubestellar.io>
|
[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 |
|
hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
…tation greenQueuedPR collided with the same-named helper in automerge_sweep_trusted_merger_test.go; rename the lane variant to greenLanePR. Re-point the RankActionableIssues citation after the Client struct grew six lines. Signed-off-by: scanner <scanner@hive.kubestellar.io>
…n the F3 gate test RunSerializedLane now reports a failing gate's error text verbatim as the reason, matching the sweep and relay tests. The F3 blanket-gate source test names both queuer-bearing isTrustedMerger call sites (queued sweep and the lane's queue-approval re-check) and still forbids the gate on the self-authored path. Signed-off-by: scanner <scanner@hive.kubestellar.io>
|
hive/awaiting-ci: pushed c5c123f fixing the two 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Read the full diff against origin/v6 plus the existing lane core (pkg/mergelane/lane.go), the sweep and relay callers, and the client helpers. This looks correct to me; it's also a bot-authored change to all three merge paths, so a maintainer's sign-off is the right gate — nothing here needs a code change before that.
What I verified
- Direct repos are untouched. Every new branch is guarded by
serialized/laneBehind(automerge_sweep.go:1017-1027,:1097,:1436-1438,:1475;merge_request_watcher.go:308-313,:354). The pre-existing unpinnedUpdateBranchandMergePRpaths run exactly as before when the strategy resolver is nil or returnsdirect. - Fail-closed everywhere. No gate installed →
LaneOutcomeRefused(merge_lane_gate.go:98-100); lane cannot be built → refused, no direct fallback (github_client_config.go:236-242); unknown merge-queue state → refused (mergelane/gate.go:72-78); nilAuthorizefails closed per the lane core. - Authorization re-check is bound to the exact head. Sweep callback compares to
evaluatedHeadSHA(automerge_sweep.go:1099-1104); lgtm callback re-reads the queue approval and trusted-merger status (automerge_sweep.go:1226-1244); relay callback re-runsmergeAuthzwith the lane's head and honoursexpect_sha(merge_request_watcher.go:383-394). - Attempt accounting. The waiting/deferred/updated case writes
Attempts: attempts-1(merge_request_watcher.go:409), same convention as the existing CI-pending park at:344, so no attempt is consumed. Refused/left/error go throughrecordMergeFailureas a normal failed attempt. - One merge per lane branch per pass is enforced via the per-pass context map (
automerge_sweep.go:1151-1161,:1186-1188,:1200-1202). - Both
scanner-automerge.mdcopies and the changelog fragment are updated; CI is 31 pass / 0 fail with 8 still pending atc5c123f.
One low-severity observation (not a blocker)
Lane.Merge calls nativeMergeQueue → RequiredChecks → ReadBranchRules (mergelane/gate.go:48, :70, :181-194) before Acquire, for every PR on every tick. For a lane with N waiters that is N branch-rules API reads per sweep pass, and the front PR's round reads the rules again at lane.go:492. Since a non-front PR is going to be deferred anyway, the native-merge-queue check could run only once the PR is at the front (or be cached per repo@branch for the pass, like expectedCheckCache). Worth a follow-up if hive-serialized repos end up with deep queues; harmless otherwise.
I could not build locally (host toolchain is the wrong arch), so compile/test verification is CI's.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #10889
Routes Hive's three merge paths through the serialized lane gate (lane core from #10888 / PR #10897) for repos with
merge_strategy: hive-serialized(#10893). Child of #10884.Paths wired
trySweepSelfAuthoredPR) and lgtm queue sweep (trySweepQueuedPR): each has onehive-serializedbranch point, decided from config alone. After every existing gate passes, the PR goes to the lane instead of the direct merge. Authorization callbacks:max_mergespass, a lane branch gets at most one merge. The next PR for that branch is not sent to the lane.hive-mergerelay (handleOneMergeRequest):--update-branchis skipped in lane mode.expect_shawhen the request pins one.pkg/mergelane/gate.go,Lane.Merge):ReadBranchRules, ✨ github: lane-only branch-rules reader (ruleset required checks, up-to-date enforcement, native merge-queue detection) #10887) finds GitHub's native merge queue on the target branch, or cannot tell, the PR is refused and nothing is merged. The refusal reason names the native merge queue (R22).AcquirethenAdvance.RESTGitHubconnects the lane to the hive REST client. Merges are pinned to the head and go through the mutation boundary.cmd/hiveinstalls the live strategy and a lazily built lane on every client (SetSerializedLane). If the lane cannot be built, the refusal says so and there is no direct fallback.Invariants kept
directrepos (the default) run exactly today's code: same GitHub calls, same order, same refusal reasons. No lane call is made.Tests
pkg/mergelane/gate_test.go:RESTGitHubadapter, plus the no-client case.pkg/github/merge_request_lane_test.go:pkg/github/automerge/automerge_lane_test.go:cmd/hive/merge_lane_wiring_test.go: the live strategy wiring, and a refusal when the lane is unavailable.No existing tests were modified.
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88