Repository navigation
🌱 test: cover issue_comment-seeded blocker cleared on issue close - #15646
Conversation
An `issues: closed` webhook left the issue's blocker ledger row in place, so capabilities.blocked_items counted closed issues. Clear the row on close, as the dashboard recheck and close-partial paths already do. Hive-Run: #15273 Hive-Plan: review-backlog style finding, webhook_cache.go issue close Hive-Spec: blocker-ledger#clear-on-close Signed-off-by: SACHIN NAIK <sachin.naik@ibm.com>
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether #15646 (and its fork original #15312) should close as redundant with merged #15616, or land as a belt-and-braces second clear.
This change is already on v5 via #15616 — the new block is a strict subset of what the base branch does.
Read src/pkg/github/webhook_cache.go at this head. Inside the same if n, ok := webhookTouchedIssue(event, p) body, a few lines above the block this PR adds, v5 already has (from #15616, commit 11ec258):
if res.Item.Closed() {
// Closed issues no longer contribute to blocked_items. ...
l := itemblocker.Shared()
l.Clear(configured, n)
owner, repo := c.splitRepo(configured)
if full := owner + "/" + repo; full != configured {
l.Clear(full, n)
}
}WebhookItemHint.Closed() (webhook_cache.go:94) is true for any issues/issue_comment payload whose issue.state is closed, regardless of action, and it clears both the configured name and the owner/repo alias. The block added here (webhookIssueClosed → action == "closed", clear configured name only) does nothing the existing code has not already done by the time it runs.
The new test TestWebhookIssueClosedClearsBlocker only fails without this PR because its payload {"action":"closed","issue":{"number":21}} omits issue.state; a real GitHub issues.closed delivery always carries "state":"closed", so in production the existing path fires first.
Nothing here is wrong — #15312 was opened before #15616 merged and simply got overtaken. Flagging for a maintainer: if you agree, this and #15312 could be closed in favour of #15616. I have not closed anything.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Needs a decision, not a merge:
Head: verdict requires_human @53b91bd, 64/65 checks green, 1 pending, DCO yes, soak 0s of 30m0s. What to do: approve this head ( How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
|
/lgtm Posted by @clubanderson from the Hive dashboard; the merge gate decides from here. |
|
@hivecommons-hive[bot]: you cannot LGTM your own PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/approve Posted by @clubanderson from the Hive dashboard; the merge gate decides from here. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: hivecommons-hive[bot] 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 |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether #15646 (the hive's adoption of #15312) closes as already landed by #15309, which merged into v5 as cba03b0 and clears the blocker ledger on the same webhook path.
Decision needed: @clubanderson should decide whether #15646 (the hive's adoption of #15312) closes as already landed by #15309, which merged into v5 as cba03b0 and clears the blocker ledger on the same webhook path.
This is a no-op merge against v5. I read this branch's full delta against its merge-base (webhook_cache.go +16, issue_blocker_test.go +39, one changelog fragment) and the current v5 tree:
v5src/pkg/github/webhook_cache.go:512-522already hasif res.Item.Closed() { l.Clear(configured, n); … l.Clear(full, n) }inside the samewebhookTouchedIssueblock — that is #15309's change, and it also clears theowner/repoalias this PR does not.- This PR's added block at
webhook_cache.go:536-543runs immediately after it and clears(configured, n)again, gated onaction == "closed".WebhookItemHint.Closed()(webhook_cache.go:94) readsissue.state, which every GitHubissues: closeddelivery carries, so on real payloads the row is already gone by the time the new block runs. - The new test passes on
v5only because its payload omitsstate; it is pinning a code path real deliveries never reach.
The code is not wrong — it is the same fix #15309 already landed, written a second time. The earlier review on #15312 flagged exactly this (#15309 as superset); the adoption carried the original commit forward unchanged without picking that up. Keeping the original author's work in history is fine, but merging it adds a redundant clear and a test of an unreachable branch.
Flagging for a maintainer: if you agree, this one and #15312 can be closed in favour of #15309. I have not closed anything.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether #15646 (and its fork original #15312) should be closed as already landed on v5, or merged as a redundant second guard.
Conclusion: the behaviour this PR adds is already on v5; merging it is effectively a no-op, and the new test only fails on v5 because its payload omits a field GitHub always sends.
Evidence (read at v5 tip ee5bf9ad9 and at this PR's head):
src/pkg/github/webhook_cache.go:512-522(v5) — inside the samewebhookTouchedIssuebranch this PR extends,if res.Item.Closed() { l.Clear(configured, n); … l.Clear(owner+"/"+repo, n) }already drops the ledger row for anyissues/issue_commentdelivery whoseissue.stateisclosed.WebhookItemHint.Closed()(webhook_cache.go:94-96) readsp.Issue.State.src/pkg/github/issue_blocker_test.go:107-157(v5) —TestWebhookClosedIssueClearsBlockeralready covers{"closed", "issues", "closed", "closed", …, wantBlocked=false}and assertsCapabilities().BlockedItemsdrops.changelog.d/fixed-15155-closed-issue-blockers.md(v5) — "Clear blockers when issues close through GitHub or the hive". #15155 is the duplicate this PR's body says it also covers.- The block this PR adds (
webhook_cache.go:532-542on the PR head) runs after that existing block, keyed onaction == "closed"instead ofissue.state, and clears onlyconfigured(not theowner/repoalias the existing block also clears). Its test payload{"action":"closed","issue":{"number":21},…}has nostate, soItem.Closed()is false there — that is the only reasonTestWebhookIssueClosedClearsBlockerfails without the diff. Realissues.closedwebhooks carry"state":"closed".
Nothing here is wrong — the extra guard is harmless — but it is redundant against the base branch. I have not closed anything; flagging for a maintainer to pick close-as-landed or merge-as-is.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether #15646 (adopted from @odttlnt's #15312) still needs to land now that merged #15309 already clears the blocker ledger on issues: closed webhooks, or whether #15646/#15312 should be closed and #15273 closed as fixed by #15309.
Conclusion: the fix this PR adds is already on v5 via #15309 (merged 2026-10-29 05:50 UTC, for the duplicate issue #15155). The rebase onto v5 (head 146b903) stacked the new block directly underneath the existing one, so merging it adds a redundant branch rather than new behaviour. Not wrong — just no longer needed.
Evidence, read from the tree at 146b903:
src/pkg/github/webhook_cache.go:510-520(base, from #15309): inside the samewebhookTouchedIssuebranch,if res.Item.Closed() { itemblocker.Shared().Clear(configured, n); … Clear(owner+"/"+repo, n) }— clears the row on a closed non-PR issue, for both the configured alias and theowner/repoform, and also skipsObservefor comments on closed issues.src/pkg/github/webhook_cache.go:529-539(this PR):if webhookIssueClosed(event, p) { … l.Clear(configured, n) }— clears only the configured alias; a strict subset of what the block ten lines above already did.- The only behavioural difference: the base keys on
issue.state == "closed"(WebhookItemHint.Closed(),webhook_cache.go:94), this PR keys onaction == "closed". Real GitHubissuesdeliveries carry both, so this only matters for the synthetic test payload inissue_blocker_test.go:91({"action":"closed","issue":{"number":21}}, nostate). That is why the newTestWebhookIssueClosedClearsBlockerstill fails on base — not because the fix is missing. - PR-close vs issue-close is already handled upstream of both blocks:
webhookTouchedIssue(webhook_cache.go:655-663) returns false whenp.Issue.PullRequest != nil.
Two reasonable outcomes, which is why I'm routing rather than judging:
- Close #15646 and #15312 as superseded by #15309, and close #15273 (still OPEN) as fixed by it; or
- Land #15646 for the
action == "closed"belt-and-braces plus the extra regression test — in which case the duplicateClearblock should probably be folded into the existingres.Item.Closed()branch rather than left as a second copy.
Also note CI on this head is still pending (build-and-test, build (linux/arm64…) not yet concluded). I have not closed or changed anything.
— hive reviewer-2 · model: claude-fable-5.1
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Needs a decision, not a merge:
Head: verdict requires_human @146b903, 61/62 checks green, 1 pending, DCO yes, soak 0s of 30m0s. What to do: approve this head ( How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether #15646 (and its origin #15312) can be closed now that #15309 already clears the blocker ledger on issue close.
Conclusion: this change is already on v5. Merged #15309 (19b17ed374, 2026-10-29) fixed #15273 by the same mechanism, so the block this PR adds never does anything. Recommend closing #15646 (and the fork original #15312) rather than merging. I have not closed anything.
Evidence (read at head 05f28d6):
src/pkg/github/webhook_cache.go:512-520(base, from #15309): inside the sameif n, ok := webhookTouchedIssue(event, p)block,if res.Item.Closed() { itemblocker.Shared().Clear(configured, n); … }already removes the row — and also clears theowner/repoalias, which this PR's block does not.src/pkg/github/webhook_cache.go:529-539(this PR):if webhookIssueClosed(event, p) { … if _, ok := l.Get(configured, n); ok { l.Clear(configured, n) } }runs after that clear, sol.Getis alwaysfalsefor the same key. Dead code.- The PR-close guard the new test relies on (
"pull_request":{"url":"x"}must not clear) is provided bywebhookTouchedIssueatwebhook_cache.go:648(p.Issue.PullRequest != nil→ not touched), not bywebhookIssueClosed, which checks onlyevent == "issues" && p.Action == "closed". src/pkg/github/issue_blocker_test.go:107already hasTestWebhookClosedIssueClearsBlockerfrom #15309; the newTestWebhookIssueClosedClearsBlockerpasses against base without the diff, so it is not a regression test for this change.changelog.d/fixed-15273-blocker-ledger-clear-on-close.mdwould record #15273 as fixed a second time.
Not redundant-marked: the diffs differ (this one adds a helper, a second test and a fragment), so merging is not a byte-level no-op — but behaviourally it is.
Side note: build-hub (linux/amd64) is red on this head; I did not triage it since the recommendation is to close regardless.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Correctness (delta re-review, head 79bffde)
The delta since 05f28d6 is only Merge branch 'v5' pulling in already-landed #15718 (pr_merge_state.go, its test, operator-reference.md, changelog.d/security-15421.md); the PR's own three files are byte-identical to the previous head. Nothing new to judge in the delta.
Previous findings at the new head:
- Still present (in-scope):
src/pkg/github/issue_blocker_test.go:65—TestWebhookIssueClosedClearsBlockerpasses only on a synthetic payload. Base v5 already drops the ledger row atsrc/pkg/github/webhook_cache.go:512-523wheneverres.Item.Closed()(payloadissue.state == "closed",webhook_cache.go:95), which every real GitHubissues: closeddelivery carries. The test payloads (issue_blocker_test.go:89) omit"state", so they bypass the base path and exercise only the new block atwebhook_cache.go:532-541— which on a real payload is a no-op after the baseClearat line 516. Concrete fix: either close this PR as superseded by #15309, or drop the redundant block +webhookIssueClosed(webhook_cache.go:678-680) and keep the test with a realistic"state":"closed"payload as a regression guard for #15309. - Still present (intent-alignment, not re-filed here): the added block at
webhook_cache.go:532duplicates merged #15309.
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Intent-alignment (delta re-review, head 79bffdeb) — the delta is only a v5 merge-in (#15718: pr_merge_state.go, its test, operator-reference.md, changelog.d/security-15421.md); none of the PR's own hunks changed.
Still present (in-scope): this PR duplicates work already on v5. #15309 (merged 2026-10-29, 19b17ed) already clears the blocker ledger on issues: closed: src/pkg/github/webhook_cache.go:512-522 at head runs l.Clear(configured, n) (and the owner/repo alias) whenever res.Item.Closed(), which webhookItemHint derives from issue.state (webhook_cache.go:644, :94-96). The hunk this PR adds right below it (webhook_cache.go:532-541, keyed on action == "closed" via webhookIssueClosed at :679) therefore never clears anything a real GitHub payload has not already cleared, and it covers only the configured name, not the owner/repo alias the base path also clears. Base also already ships TestWebhookClosedIssueClearsBlocker (issue_blocker_test.go:146).
The prior correctness note on issue_blocker_test.go:65 still applies: the new test's close payload omits issue.state, so it exercises only the redundant action-keyed hunk, not the path real deliveries take.
Requested change: #15273 is already satisfied on v5 by #15309. Drop webhook_cache.go:532-541 + webhookIssueClosed, TestWebhookIssueClosedClearsBlocker, and changelog.d/fixed-15273-blocker-ledger-clear-on-close.md, which leaves nothing to land — close this PR as superseded by #15309 and close #15273 citing #15309.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Base v5 already clears the blocker ledger row when a webhook payload says the issue is closed (#15309, keyed on issue.state via WebhookItemHint.Closed), so the action=="closed" block and webhookIssueClosed added here were reachable only for payloads lacking `state`, which real GitHub deliveries always carry. Remove them and the changelog fragment (no behaviour change remains), and give the new test realistic `state` fields so it guards the live issue_comment -> close flow against the production code path. Refs #15273 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>
There was a problem hiding this comment.
Reviewed (correctness, delta 05f28d6 → 6e6253c) — the delta is sound; one advisory.
The final commit 6e6253c removed the action=="closed" clear and webhookIssueClosed from src/pkg/github/webhook_cache.go, correctly: base v5 already clears the ledger row via res.Item.Closed() → l.Clear(configured, n) (webhook_cache.go:512-522, present at merge-base 360a42a), keyed on issue.state, and webhookTouchedIssue (webhook_cache.go:644-652) already excludes PR-backed issues, so the new test's negative cases are enforced by production code. The PR diff against v5 is now only src/pkg/github/issue_blocker_test.go (+40); CI test shards are green at head.
Advisory (in-scope, low): the PR title 🐛 fix: clear blocker ledger entry when an issue closes and body still describe a production fix, but no production code changes remain — this is a regression test for behaviour already landed by #15309. Since the squash commit inherits the title, retitle to something like ✅ test: guard blocker ledger clear on issue close (#15273) and note in the body that #15273 was already fixed on base.
— hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Style review (head 6e6253c)
-
Title/body claim a fix the diff no longer contains. After
6e6253cthe PR is test-only (src/pkg/github/issue_blocker_test.go+40). The production clear already lives onv5atsrc/pkg/github/webhook_cache.go:512-523(res.Item.Closed()→l.Clear(...), shipped aschangelog.d/fixed-15155-closed-issue-blockers.md). The title🐛 fix: clear blocker ledger entry when an issue closesandFixes #15273describe #15309's work, not this diff. Per #15273's own body: "if it is already fixed, close this item without a PR." Retitle to a test-only change (e.g.✅ test: cover live issue_comment → close blocker flow) and changeFixes→Refs, or close this PR and #15273 as already fixed. -
Near-duplicate test with a near-identical name. New
TestWebhookIssueClosedClearsBlocker(issue_blocker_test.go:66) sits in the same file as existingTestWebhookClosedIssueClearsBlocker(issue_blocker_test.go:147), which already table-testsissues/closedclears,labeled+openkeeps, PR-comment keeps, andCapabilities().BlockedItems(:152-159, :176-187). The only new coverage is seeding via a liveissue_commentdelivery instead ofl.Observe(:75). Fold that into the existing table (aseedViaWebhook boolcolumn) or, if kept separate, name it for what it adds (e.g.TestWebhookCommentSeededBlockerClearsOnClose) and trim the re-assertedlabeled/PR-close cases (:79-89).
— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Intent alignment (read at head 6e6253c)
PR title/body say "fix", diff is test-only — the fix already landed. The only file changed is src/pkg/github/issue_blocker_test.go (+40). The production behaviour #15273 asks for is already on v5 from #15309: src/pkg/github/webhook_cache.go:512-522 clears itemblocker.Shared() for both the configured and owner/repo names when res.Item.Closed(), and head already carries a table-driven regression TestWebhookClosedIssueClearsBlocker (issue_blocker_test.go:147-194) covering closed / labeled-open / reopened / PR / unknown-repo cases. Commit 6e6253c ("drop redundant close-clear") correctly removed the duplicate production change but left the 🐛 fix: title, the "clear blocker ledger entry when an issue closes" claim and Fixes #15273 in place, so the PR now describes work it does not contain.
The new TestWebhookIssueClosedClearsBlocker (issue_blocker_test.go:66-100) does add one path the existing table does not: seeding the ledger through a live issue_comment delivery before the close, and asserting a second item's count survives. That is fine to land as a test — but it should be labelled as such.
Requested change: retitle to a test-scoped title (e.g. ✅ test: cover issue_comment-seeded blocker cleared on issue close), and reword the body to state that #15309 shipped the fix and this PR only adds the regression test for #15273 (keep Fixes #15273 only if the maintainers want #15273 closed by this test-only PR; otherwise Refs #15273 and close the issue as fixed by #15309).
(The earlier swarm note at 146b903 already asked whether this PR should land at all; the above is the concrete remediation rather than a re-ask.)
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
docs-currency — one in-scope finding.
PR title/body describe a behaviour fix the diff no longer contains. After the "drop redundant close-clear" commit, the diff is a single new test (src/pkg/github/issue_blocker_test.go:62-100); no production code or changelog fragment is touched. The clear-on-close behaviour already exists on v5 at src/pkg/github/webhook_cache.go:512-522 (res.Item.Closed() → l.Clear(configured, n)), landed by merged #15309 and recorded in changelog.d/fixed-15155-closed-issue-blockers.md. Yet the title is still 🐛 fix: clear blocker ledger entry when an issue closes and the body says "Fixes #15273" with no mention that the fix already shipped — so the merge commit / release notes would advertise a fix that this PR does not make, and #15273 reads as closed by it.
Requested change: retitle to a test-only prefix (e.g. ✅ test: regression test for blocker ledger clear on issue close), and add one line to the body stating that the behaviour landed in #15309 and this PR only adds the regression test guarding the live issue_comment → issues:closed path. Omitting a changelog fragment is correct as-is (no behaviour change).
— hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88
TestWebhookIssueClosedClearsBlocker was a near-duplicate of the existing table test TestWebhookClosedIssueClearsBlocker, differing only by word order and re-asserting its labeled/PR-close cases. Rename it to TestWebhookCommentSeededBlockerClearsOnClose and keep only the path the table does not cover: ledger seeded via a live issue_comment delivery, then cleared on issues:closed while a second item's count survives. Refs #15273 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.
Checked the body's claims against v5 before reading the test:
src/pkg/github/webhook_cache.go:512-521already clears the shared ledger (both configured andowner/repoaliases) onres.Item.Closed(), andchangelog.d/fixed-15155-closed-issue-blockers.mdrecords it. So the production fix from #15312 is indeed onv5; this PR is correctly test-only.TestWebhookClosedIssueClearsBlocker(issue_blocker_test.go:107) seeds every row vial.Observe(...). The newTestWebhookCommentSeededBlockerClearsOnCloseis the one path that table does not exercise: a row created by a liveissue_commentdelivery, then cleared byissues: closed, with issue 22's count preserved. The helpers it uses (swapSharedLedger,setupWebhookCacheTest,workflowsReport,jsonString) all exist in the package. The test reads correctly to me.
The only thing holding this PR is CI, not code:
PR Typeis red because the title starts with✅. That check reads the first character and accepts✨ 🐛 📖 📝 ⚠️ 🌱;✅is not in the set. Retitling to🌱 test: cover issue_comment-seeded blocker cleared on issue closeshould turn it green (Hive fix agent: that is the one remaining ask on this branch).
Once merged, #15312 can be closed as superseded and #15273 as fixed by #15309, exactly as the body says. I have not closed or retitled anything.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me. Read the tree at 8c23ac2:
- The behaviour under test already exists:
src/pkg/github/webhook_cache.go:512-521clears the shared ledger row (both configured andowner/repospellings) whenres.Item.Closed(), so this PR is genuinely test-only and the body's "fixed by #15309" claim matches the code. - The new test covers a path
TestWebhookClosedIssueClearsBlocker(issue_blocker_test.go:136) does not: that table seeds vial.Observe(...), whereas this one seeds through a liveissue_commentdelivery (HandleWebhookEvent("issue_comment", …)) and then checksGetis gone andCapabilities().BlockedItems == 1for the surviving issue 22. - Every helper it uses exists in the package at this head:
swapSharedLedger(issue_blocker_test.go:20),setupWebhookCacheTest(webhook_cache_test.go:23),jsonString,workflowsReport, andblocker.Ledger.{Observe,Get,Blocking,Capabilities}(src/pkg/blocker/ledger.go:128,232,241,305).
Effective diff against v5 is the same 29-line test as #15312's head; the extra commits are v5 merges. Refs #15273 with the stated reason (close as fixed by #15309) is the right link. Could not run go test in this pod (blocked for agents).
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
stage 060-reviewed → 050-review-pending: required-check-pending:Sign-off survives the squash |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Supersedes #15312 (adopted after CI went red and the contributor was unavailable; original commits by @odttlnt preserved).
Refs #15273
Test-only. The behaviour #15273 asked for — clearing the shared blocker ledger row when an
issues: closedwebhook arrives — already landed onv5via #15309 (src/pkg/github/webhook_cache.goclears onres.Item.Closed(); recorded inchangelog.d/fixed-15155-closed-issue-blockers.md). This PR therefore ships no production change and no changelog fragment.What it adds:
TestWebhookCommentSeededBlockerClearsOnClose, a regression test for the one path the existingTestWebhookClosedIssueClearsBlockertable does not cover — a blocker seeded through a liveissue_commentdelivery, then cleared onissues: closedwhile another item'scapabilities.blocked_itemscount is preserved.#15273 can be closed as fixed by #15309.
This branch began as #15312's head
036bff04204fas pushed by @odttlnt (forkodttlnt/hive).Hive fix agent: rebase this branch on
v5, fix the failing checks / review asks, and push to THIS branch. Keep the original author's commits and theirSigned-off-by; add your own sign-off on your commits. Do not open another PR.