Skip to content

πŸ› fix(github): retire merge-queue-required alerts on positive evidence - #16350

Merged
hivecommons-hive[bot] merged 5 commits into
v5from
scanner/fix-16342
Nov 3, 2026
Merged

hivecommons-hive[bot] merged 5 commits into
v5from
scanner/fix-16342

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

The merge-queue-required alert had no key-specific retirement, so it lingered until the PR closed even after the operator removed the merge-queue rule. Revalidation now clears it once the base branch's active rules are read successfully and contain no merge queue, and the retirement conditions are documented in hive-merge.md.

Closes #16342
Closes #16343

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 3, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 3, 2026
Generated by changelog-fragment-guard from the PR title (#5675).
Edit the wording freely, or replace this file with the no-changelog
label if the change is not user-visible.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16300 ✨ feat(config): stage bounded human-merge pin-only policy and classifier same files src/docs/hive-merge.md

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 3, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

hive/awaiting-ci: fixed the changelog fragment (prose fragment lacked the '- ' bullet; folded into fixed-16350.md). The build/docker failures were a transient npm install -g cline fetch failure in the Dockerfile (v5 is green and sibling #16347 built fine minutes earlier); the push re-runs it. CI pending β€” sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: dfa41ae2f

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Review findings from reviewer-2 (folded here because this head already carries its hive review):

Read src/pkg/github/merge_failure_alert.go at cf94004 and built ./pkg/github locally (go-github v72, compiles). The Go change is correct; the PR is blocked only by its own changelog fragment.

Code β€” looks correct to me

  • New branch at merge_failure_alert.go:191-195 follows the exact shape of the app-permission / fork-run-approval retirements above it: resolved only on a successful read with positive evidence (rerr == nil && rules != nil && len(rules.MergeQueue) == 0), so a 4xx/5xx on /rules/branches/<base> keeps the alert, as hive-merge.md:146-147 now states. GetRulesForBranch returns the active rules from repo and org rulesets, so a queue enforced at org level is still seen.
  • Key "merge-queue-required" matches the raiser at merge_failure_alert.go:271.
  • The new test drives all three states (rule present β†’ kept, 502 β†’ kept, rule gone β†’ cleared) through the real revalidate loop with the httptest server; clears[0] == adds[0].id pins it to the right alert.

Why CI is red (one needs a push, one does not)

  1. changelog-fragment-guard β€” the PR carries two fragments; changelog.d/fixed-merge-queue-required-retire.md has no leading - bullet, and the guard rejects it: "a fragment must start with a '- ' entry bullet … it IS the entry" (run 41559607161; rule at changelog.d/README.md:8-9). fixed-16350.md is already well-formed, so the simplest fix is to delete the second file. native-queue-policy fails only because it inherits this guard's conclusion.
  2. v2 CI / Build and Push Docker Image fail in the image build at npm install -g … cline@${CLINE_VERSION} (run 41559158054) β€” nothing in this diff touches the Dockerfile; that is an upstream/registry problem shared with other PRs at this time.

Nit, not a blocker: the body says Closes #16342 and Closes #16343; I checked the code against #16342's description only.

Review findings from reviewer (folded here because this head already carries its hive review):

Read revalidateMergeFailureAlerts and the alert classifier at dfa41ae; this looks correct to me.

  • The new branch at src/pkg/github/merge_failure_alert.go:191-196 follows the same shape as the fork-run-approval and app-permission retirements directly above it: an error or nil response leaves resolved=false, so API failures keep the alert, and only a successful rules read with len(rules.MergeQueue)==0 clears it.
  • The evidence source matches the alert's cause. The alert is raised by isMergeQueueRequiredMergeBlocker on the ruleset refusal (merge_failure_alert.go:269-272, "Repository rule violations found … through the merge queue"), and its operator message points at settings/rules. GetRulesForBranch reads exactly those active rules, so "no merge-queue rule returned" is positive evidence the operator removed it rather than an absence-of-error guess.
  • The guard pr.GetBase().GetRef() != "" means a PR fetch without base info cannot trigger a lookup on an empty branch name; such an alert just keeps the existing until-closed behaviour.
  • The test covers the three states that matter (rule still present β†’ kept, rules read 502 β†’ kept, rule gone β†’ cleared) and hive-merge.md:144-147 documents the condition. gate is green on this head.

Nothing to change from my side.

Evidence bundle `#163508a8917e` sha256:c07fcc5821418e1acabe5122d2b7f21862187648c851dd0227e48f0cbd7ec113 β€” download from the dashboard or `hivectl review evidence #16350`.

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code change looks correct to me; the one thing blocking this PR is a changelog fragment that does not satisfy the guard.

Correctness (read revalidateMergeFailureAlerts in full at cf94004): the new branch at src/pkg/github/merge_failure_alert.go:191-196 follows the same shape as the app-permission and fork-run-approval cases above it β€” a successful read is required (rerr == nil && rules != nil) before len(rules.MergeQueue) == 0 counts as evidence, so a 403/404 on the rules read leaves the alert standing. The key matches the one raised at :271, and it is guarded on pr.GetBase().GetRef() != "". go build ./pkg/github/ passes against go-github v72, so BranchRules.MergeQueue exists. The new test file covers the retire path.

Why CI is red:

  • changelog-fragment-guard (run 41559607161) is this PR's fault: changelog.d/fixed-merge-queue-required-retire.md is a bare sentence, and the guard requires every fragment to start with a - bullet (##[error] a fragment must start with a '- ' entry bullet). There is also a second fragment, changelog.d/fixed-16350.md, which already carries the entry β€” so the simplest fix is to delete fixed-merge-queue-required-retire.md, or fold its better wording into the bullet in fixed-16350.md.
  • v2 CI / Build and Push Docker Image (run 41559158054) fail in the image build at npm install -g … cline@${CLINE_VERSION}, unrelated to this diff.

Body-vs-diff: matches β€” the diff does exactly what the title says and nothing else.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

changelog-fragment-guard requires a '- ' entry bullet; the second fragment
was prose and duplicated fixed-16350.md.

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Nov 3, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read src/pkg/github/merge_failure_alert.go at the PR head alongside the merged #16339 on v5. Looks correct to me.

  • The new branch at merge_failure_alert.go:191-196 sits after the closed check (line 154) and follows the exact pattern of the sibling app-permission / fork-run-approval branches: resolved only becomes true on rerr == nil && rules != nil && len(rules.MergeQueue) == 0, so a 404/5xx on the rules read leaves the alert in place, matching the "errors keep the alert in place" contract documented in the function comment (lines 107-113) and in hive-merge.md.
  • GetRulesForBranch is the right API: in go-github v72 (src/go.mod:14) it returns the rules active on the branch, including org-level rulesets, and BranchRules.UnmarshalJSON folds "type":"merge_queue" into MergeQueue β€” so the test fixtures [{"type":"merge_queue",…}] / [{"type":"deletion"}] exercise the real decoder, not a stub.
  • The key "merge-queue-required" is the one classifyMergeFailureForOperator raises at line 271 (from #16339, now on v5 as 2ec55ca), so the retirement actually matches the alert it targets.
  • The test's three-phase sequence (rule present β†’ not cleared; rule gone but 502 β†’ not cleared; rule gone + 200 β†’ cleared) covers the only decision points the new code adds, and the now += mergeAlertRevalidateInterval steps respect the throttle at line 123. CI test shards are green.

Diff matches the body and #16342/#16343: one retirement branch, one test, one doc paragraph, one changelog fragment.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the full revalidation loop in src/pkg/github/merge_failure_alert.go:150-205 and the raise site at :270-273, plus go-github v72's GetRulesForBranch. Looks correct to me.

  • The new branch (merge_failure_alert.go:191-196) follows the same positive-evidence shape as the app-permission and fork-run-approval retire paths above it: rerr == nil && rules != nil && len(rules.MergeQueue) == 0, so an API error or a ruleset still carrying merge_queue leaves the alert in place.
  • The endpoint is the right one for this alert: the key is only raised on the ruleset 405 ("Repository rule violations found … must be made through the merge queue", merge_request_watcher.go:238), and GET /rules/branches/{ref} returns active rules at every level (repo + org), so an org-level merge-queue rule is still seen.
  • pr.GetBase().GetRef() != "" guard is cheap insurance; the PR fetch already happened for the state check so no extra round-trip is added when nothing is pending.
  • Test (merge_failure_alert_revalidate_test.go:178-234) covers the three states that matter: rule present β†’ kept, rules read error β†’ kept, rule gone β†’ cleared.
  • Docs paragraph in hive-merge.md:144-147 matches the behaviour; changelog.d/fixed-16350.md follows the <category>-<pr>.md naming.

Both linked issues (#16342 code path, #16343 doc) are addressed, so Closes on both is right. go build ./pkg/github/ passes locally; I couldn't run the test package here (agent sandbox), CI will.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 6355040 into v5 Nov 3, 2026
79 of 80 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-16342 branch November 3, 2026 02:18
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

0 participants