Skip to content

πŸ› fix: clear blocker ledger entry when an issue closes - #15312

Closed
odttlnt wants to merge 1 commit into
hivecommons:v5from
odttlnt:fix/blocker-ledger-clear-on-close-15273
Closed

odttlnt wants to merge 1 commit into
hivecommons:v5from
odttlnt:fix/blocker-ledger-clear-on-close-15273

Conversation

@odttlnt

@odttlnt odttlnt commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #15273

An issues: closed webhook left the issue's blocker ledger row in place, so capabilities.blocked_items counted closed issues. HandleWebhookEvent now clears the row on a non-PR issue close, as the dashboard recheck and close-partial paths already do. Also covers the duplicate #15155 finding.

Tests: added TestWebhookIssueClosedClearsBlocker (fails without the fix; labeled and PR-close deliveries leave the row). Not run locally per AGENTS.md (CI is the verdict, and no Go toolchain is installed here); the changelog fragment is included.

β€” hive: backend=bob model=premium

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: hivecommons#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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to the Hive Commons community!

Thanks for opening your first PR here! We're excited to have you contributing.

Before merge, please ensure:

  • DCO Sign-off β€” All commits signed with git commit -s (DCO)
  • PR Title β€” Starts with an emoji: ✨ feature | πŸ› bug fix | πŸ“– docs | 🌱 infra/tests | ⚠️ breaking

A maintainer will review your PR soon. Hope you have a great time here!

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

This PR conflicts with v5 itself. Rebase it first: until it merges cleanly into the base, conflicts with other open PRs cannot be told apart from base drift, so only same-file overlaps are listed.

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.

No conflicting open PRs or same-file overlaps were found.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed β€” no findings from this perspective.

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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed β€” no findings from this perspective.

β€” hive: agent=adjudicator-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

Choose a reason for hiding this comment

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

Decision needed: @clubanderson should decide whether #15312 closes in favour of #15309, which makes the same blocker-ledger-clear-on-close change as a superset and already carries a hive approve verdict at cba03b0.

This appears to duplicate #15309, which makes the same change at the same insertion point in src/pkg/github/webhook_cache.go (HandleWebhookEvent, inside the webhookTouchedIssue block at line ~493) and cites the same root issue (#15155; this PR's body says it "also covers the duplicate #15155 finding").

What I verified by reading both diffs in full against v5:

  • This PR clears the ledger row only for an issues delivery with action == "closed" (webhookIssueClosed, webhook_cache.go:648), on the configured repo name only.
  • #15309 clears whenever res.Item.Closed() is true. WebhookItemHint.Closed() (webhook_cache.go:94) reads issue.state == "closed", which an issues: closed payload carries, so it covers every case this PR covers, plus: comments on already-closed issues (so a late needs-human report cannot recreate the blocker), the hive's own closeIssue path (issue_close.go:132), and both the configured short name and the owner/repo alias.
  • Both PRs insert into the same hunk of HandleWebhookEvent, so they conflict textually: whichever merges second will need a rebase, and after #15309 lands this PR's clear becomes a no-op.

The code here is correct for what it does (the p.Issue.PullRequest != nil guard in webhookTouchedIssue, webhook_cache.go:637, is why the PR-close case in TestWebhookIssueClosedClearsBlocker passes) β€” this is a scope/duplication call, not a defect.

Flagging for a maintainer: if you agree, this one could be closed in favour of #15309 (broader, already hive-approved at its current head). I have not closed anything.

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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision needed: @clubanderson should decide whether #15312 is closed in favour of #15309, which clears the same ledger row on webhook close and additionally covers the owner/repo alias key and Hive's own closeIssue path.

Conclusion: this appears to duplicate #15309 (fix: clear blocker ledger on ordinary issue closure), which is already review-clean at its current head. I have read both diffs in full; #15309 is a strict superset and should be the survivor.

Same change, verified: both PRs edit src/pkg/github/webhook_cache.go inside HandleWebhookEvent to call itemblocker.Shared().Clear(configured, n) when an issues delivery reports a closed non-PR issue (PR-shaped payloads are already excluded upstream by webhookTouchedIssue, webhook_cache.go:637). Both add a regression test in issue_blocker_test.go and a changelog.d/fixed-* fragment. The issue bodies (#15273 / #15155) describe the same symptom and this PR's body itself says it "also covers the duplicate #15155 finding".

Where they differ (why #15309 is preferable):

  1. Ledger key aliasing. The ledger is written under two different keys: the webhook path observes under the configured repo name (webhook_cache.go:516), while the task-list sweep observes under owner+"/"+repo (task_list_sweep.go:663). When a repo is configured by short name those keys differ. This PR clears only configured; #15309 clears both (splitRepo β†’ full name, webhook_cache.go hunk at L498-505 in that PR), so a sweep-recorded row is released too.
  2. Hive-initiated closes. #15309 also clears the row in issue_close.go (closeIssue, after Issues.Edit succeeds), so an issue Hive closes itself does not wait for the webhook round-trip. This PR has no equivalent.
  3. Comments after close. #15309 skips Observe for comments on an already-closed issue, so a late needs-human comment cannot recreate the row. This PR still observes them.

Nothing here is wrong in this PR β€” the Get-before-Clear at webhook_cache.go:508-510 is merely redundant (Clear on an absent key is a no-op, pkg/blocker/ledger.go:250) β€” it is just narrower than the sibling.

Flagging for a maintainer: if you agree, this one could be closed in favour of #15309. I have not closed anything.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

Head: verdict requires_human @036bff0, 57/57 checks green, DCO yes, soak 0s of 30m0s.

How to release it:

  • After reading the verdict, a trusted merger can submit a GitHub Approve review for the current head and the lane clears the hold on its next pass; /hive approve replies on a PR are acknowledged but not consumed. An ordinary contributor cannot release their own PR.

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

Head: verdict requires_human @036bff0, 57/57 checks green, DCO yes, soak 16m0s of 30m0s.

How to release it:

  • After reading the verdict, a trusted merger can submit a GitHub Approve review for the current head and the lane clears the hold on its next pass; /hive approve replies on a PR are acknowledged but not consumed.

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test coverage (quality) β€” approve, no findings (read at head 036bff0).

TestWebhookIssueClosedClearsBlocker seeds the row through the real issue_comment path, then asserts the two deliveries that must not clear it (issues/labeled, and issues/closed carrying pull_request) before the genuine close, and finishes on Capabilities().BlockedItems == 1 β€” the user-visible number #15273 is about. The PR-close negative is the one that matters since webhookIssueClosed itself does not look at pull_request; the test pins that the enclosing non-PR guard keeps doing that job. Nothing left to pin.


🐝 Hive Agent: quality | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/lgtm

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/approve

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

@kubestellar-prow

Copy link
Copy Markdown
Contributor

@hivecommons-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

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.

@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hivecommons-hive[bot]
Once this PR has been reviewed and has the lgtm label, please assign kellyaa 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@odttlnt this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Review asks:

  • the branch is behind the base and Hive cannot update it; enable "allow edits by maintainers" or rebase

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (1 waiting): fixes are handed out before new work as soon as you have capacity.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson asked the hive to adopt this pull request now, without waiting for its author's hive. The hive opens its own PR carrying the author's commits and sign-off unchanged on the pass now running; this PR closes when that copy merges.

@hivecommons-hive hivecommons-hive Bot added the adoption/supersede Owner-delegate request: adopt now in supersede mode label Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson asked the hive to adopt this pull request now, without waiting for its author's hive. The hive opens its own PR carrying the author's commits and sign-off unchanged on the pass now running; this PR closes when that copy merges.

Maintainer: fork head is not editable by the App and the author is offline β€” hive adopts and carries this to merge.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closing: #15646 (the hive's adoption of this PR, with @odttlnt's commits) has merged. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Development

Successfully merging this pull request may close these issues.

Review backlog (style): Blocker ledger not cleared on ordinary issue close

1 participant