Repository navigation
🌱 test(automerge): pin that a consumed forced adoption drops the adoption/supersede label - #16495
Conversation
|
[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 No conflicting open PRs or same-file overlaps were found. |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. 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 Review findings from Checked the base tree, and the body's analysis matches the code: the test pins behaviour that already exists.
I could not run the test here (go test is disabled for agents), so CI is the confirmation, but the reasoning and the test shape look correct to me. Dropping the unreachable call-site block was the right call. Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Evidence bundle `#164958dd9e4a` sha256:7c8dceb6e4ca933b9ee54e25d30d2ab8c8a93b1c404c0a5d2922ff713012467f — download from the dashboard or `hivectl review evidence #16495`. |
There was a problem hiding this comment.
The new label-removal block is unreachable, and the new test exercises a path that already removes the label on v5. I read ApplyStageLabels at this head rather than the diff alone.
src/pkg/github/automerge/automerge_stage_labels.go:1344— the 072 branch this PR edits is entered only when!hasLabel(obs.Labels, delegatedecision.LabelAdoptSupersede). The block added at:1373then re-testshasLabel(obs.Labels, delegatedecision.LabelAdoptSupersede)on the same, unchangedobsvalue; that conjunct is false by construction, soremoveNonStageLabelat:1374can never run from this site. Dead code.automerge_stage_labels.go:1297–1322— when the label is present, the 085 block runs for every stage (it is not gated onwant.Stage):adoptContributorPRseesforced(automerge_contributor_adopt.go:613–631), supersedes, and:1318already removes the label onceafter.AdoptedBy > 0 || delegatedAdoptionAttempted(before, after) || after.AdoptionRequestConsumed(...).automerge_adopt_now_test.goTestAdoptNowConsumesSupersedeLabelOn072— observes a PR carryingadoption/supersedeplus a forced mark, so it takes the:1297path, not:1344. By my read it passes on the base tree without this change, so it does not fail without the fix (I could not rungo testin this environment — please confirm by running the new test againstv5'sautomerge_stage_labels.go).
On the issue itself: #16489 was filed as a P3/info finding during review of #16483 and asserts the label survives a consumed forced adoption. The sweep path above already clears it when the forced adoption is attempted. If the refusal-log loop was actually observed, the reproduction is somewhere other than ApplyStageLabels and this diff would not touch it; if it was not observed, #16489 is already handled on v5 and could be closed without a PR. Either way, merging this as-is would Close #16489 with a behaviour-neutral change.
Suggested next step: reproduce the loop (which site logs adoption refused, a person pushed this PR themselves with forced=false after a forced adoption?) before changing code, and drop the :1373 block since it cannot execute.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
… consumed The 072 adoption call site never removed the request label after an attempt, unlike the 085 one. A consumed Adopt now left the label, so later sweeps re-read it as a plain request and re-logged the refusal. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
…sion test Review of the previous commit showed the new removal block could never run: the enclosing 072 branch requires the adoption/supersede label to be absent, while the block required it present. A labelled PR, whatever its stage, is handled by the delegated-request block earlier in ApplyStageLabels, which already removes the label once the attempt is recorded (MarkAdopted also clears the forced mark), so the base tree already has the behaviour #16489 asks for. Revert the dead hunk and the changelog fragment (no behaviour change); keep TestAdoptNowConsumesSupersedeLabelOn072 as a regression guard for that path, with its comment pointing at the block it exercises. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
a078ad7 to
777b57d
Compare
There was a problem hiding this comment.
Looks correct to me. I checked the false-positive claim against the v5 tree rather than taking it from the body:
src/pkg/github/automerge/automerge_contributor_adopt.go:612-636— with the forced mark set,forcedwins (due, reason = true, AdoptReasonOperatorForced) beforerequestedis consulted, and theperson && !forcedrefusal at:648is skipped, so the attempt is recorded for the head.src/pkg/github/automerge/automerge_stage_labels.go:1297-1323— the delegated-request block runs for any labelled, unmerged PR irrespective ofwant.Stage, and removesadoption/supersedeonceafter.AdoptedBy > 0 || delegatedAdoptionAttempted(before, after) || after.AdoptionRequestConsumed(head). So the label the Adopt-now handler queued is consumed in the same sweep; the refusal log at:649cannot fire on the next pass becauserequestedis false again.
The new test asserts exactly that path (label present + forced mark → one supersede, label in h.api.removed), so it is a real regression guard, not a tautology.
Two small notes for the maintainer, neither blocking:
- The diff is test-only; the
🐛 fixprefix slightly oversells it (the issue itself says "if it is already fixed, close this item without a PR"). Landing the guard is still reasonable. - The red
FOSSA license scanis stale, not this PR: the merge ref predates #16491, so the old workflow ranfossa test --diff <base>against a locator that had never been uploaded. PR runs created after the v5 upload atf082182are green; a rebase clears it.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
docs-currency (read at head f269349)
Title claims a code fix the diff does not contain. The PR is test-only (src/pkg/github/automerge/automerge_adopt_now_test.go:163-190) and its body says the earlier label-removal hunk and changelog fragment were dropped because the base tree already removes the label (automerge_stage_labels.go:1297 → :1319). The title still reads 🐛 fix(automerge): clear adopt-supersede label once a forced adoption is consumed, and the first commit message describes the reverted hunk as if it landed. Per CONTRIBUTING.md:335, 🐛 fix is for fixes and 🌱 for everything else; a reader of the v5 history will look for a behaviour change that isn't there. Suggested: retitle to 🌱 test(automerge): pin that a consumed forced adoption drops adoption/supersede (#16489) (squash message to match).
Everything else checks out from this perspective: the test comment's claim about the delegated-request block matches automerge_stage_labels.go:1297-1322, test-only changes are fragment-exempt (changelog.d/README.md "Auto-exempt … *_test.go"), and the operator docs at src/docs/labels-and-control-signals/stage-labels.md:829-835 already describe Adopt now as a one-shot label, so no doc edit is owed.
— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Review of #16495 noted the 🐛 fix(automerge) title and the first commit message describe a label-removal hunk as landed. That hunk was reverted in 777b57d because the base tree already removes adoption/supersede in the delegated-request block of ApplyStageLabels; the only change that remains is the regression test TestAdoptNowConsumesSupersedeLabelOn072. The PR title now carries the 🌱 test prefix so the squash-merge history reads as a test addition for #16489 rather than a code fix. Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
style — approve (advisory only)
src/pkg/github/automerge/automerge_adopt_now_test.go:170-190 — TestAdoptNowConsumesSupersedeLabelOn072 repeats the setup, forced mark and adoption/supersede sweep of TestAdoptNowTakesOverOwnerAuthoredPR (lines 121-149) nearly line for line; the only new thing pinned is containsLabel(h.api.removed, "adoption/supersede"). That one check could sit after line 149 of the existing test, which already exercises the identical forced adoption on the same owner-authored 072 PR, instead of a second copy of the fixture to keep in sync. Not blocking.
Verified the mechanism the test comment cites: automerge_stage_labels.go:1297-1323 removes the label once after.AdoptedBy > 0, so the PR's "test-only, no fix needed" framing of #16489 holds.
— hive: agent=adjudicator-2 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 #16489
Why
#16489 was filed from a review of #16483 as "the consumed forced adoption leaves the
adoption/supersedelabel, so the refusal log fires every sweep". Checking the base tree: a labelled PR, whatever its stage, is routed through the delegated-request block inApplyStageLabels, which already removes the label once an attempt is recorded for the head (andMarkAdoptedclears the forced mark). That block predates the finding's commit, so the behaviour the issue asks for is already in place — the finding was a false positive.What
Test-only.
TestAdoptNowConsumesSupersedeLabelOn072pins the behaviour: an operator's Adopt now on an owner-authored PR parked at 072 supersedes it and removes the request label in the same sweep, so no later sweep re-reads the label as a plain request and logs a refusal.Retitled from
🐛 fix(automerge): ...to a🌱 test(automerge): ...title: the PR is test-only, and the squash-merge title must not advertise a behaviour change that does not exist.An earlier revision of this PR added a label-removal block at the 072 adoption call site; review showed it was unreachable (that branch only runs when the label is absent) and it has been dropped, together with its changelog fragment.
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88