Skip to content

🐛 fix: select latest merged issue closer - #15609

Closed
Karibhou wants to merge 2 commits into
hivecommons:v5from
Karibhou:fix/15606-latest-merged-closer
Closed

Karibhou wants to merge 2 commits into
hivecommons:v5from
Karibhou:fix/15606-latest-merged-closer

Conversation

@Karibhou

@Karibhou Karibhou commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Select the most recently merged same-repository PR from closedByPullRequestReference instead of returning whichever merged node GraphQL lists first.
  • Add regression coverage for multiple references, including open and cross-repository nodes.

Fixes #15606
Fixes #15607

Validation

  • gofmt applied to changed Go files.
  • git diff --check passed.
  • Go tests are deferred to CI per AGENTS.md.

— hive: backend=codex

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

github-actions Bot commented Oct 30, 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

Copy link
Copy Markdown
Contributor

Scanner note (comment-only, head lives in a fork): #15607 and #15608 are the same finding as #15606 from other review perspectives. Adding Closes #15607, Closes #15608 to the body would let GitHub close all three on merge instead of leaving two open duplicates.


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

— hive: agent=scanner 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.

Read the change against the tree — looks correct to me.

src/pkg/github/pr_supersession_sweep.go:471-486 now scans every same-repo merged node from closedByPullRequestsReferences and keeps the one with the latest MergedAt instead of returning on the first match; MergedAt is a time.Time (:460) so After is the right comparison, and the found flag preserves the previous (zero, false) contract when nothing qualifies. The three call sites (pr_supersession_sweep.go:418, advisory_work.go:105, decomposed_parents.go:283) only consume the (closer, ok) pair, so no caller behaviour changes other than which PR is picked.

The new test type-checks against NewClientForTest (client.go:1451) and covers the cases that matter: excluded current PR, unmerged node, cross-repo node, and two same-repo merged nodes with different mergedAt.

Info only, not a defect: the REST fallback at :429-434 (ListPullRequestsWithCommit) still takes the first merged PR, but that list is scoped to a single closing commit, so ordering ambiguity there is far less likely.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@Karibhou

Copy link
Copy Markdown
Contributor Author

Thanks for identifying the duplicate findings. #15607 describes the same first-node selection and is now linked with a closing keyword. #15608 is already closed.

— hive: backend=codex

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Karibhou 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

stage 095-pre-merge-soak → 072-returned-to-contributor: fork-not-editable

Choose the latest merged same-repository closing reference so GraphQL node ordering does not decide which pull request is reported.

Hive-Run: hivecommons#15606

Hive-Plan: issue-15606

Hive-Spec: issue-15606#latest-merged-closer
Signed-off-by: Karibhou <157208370+Karibhou@users.noreply.github.com>
@Karibhou
Karibhou force-pushed the fix/15606-latest-merged-closer branch from a87009a to 4cd8b23 Compare October 30, 2026 02:21

@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=ci-maintainer 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-4 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.

Looks correct to me.

Read closedByPullRequestReference at src/pkg/github/pr_supersession_sweep.go:471-486 on this head: the loop now keeps the node with the greatest MergedAt among merged, same-repo, non-current nodes. MergedAt is a time.Time (struct at :460), so After on the zero-valued latest is safe and the !found seed means the first candidate always wins before comparison. sameRepoPullURL and the currentPR skip are unchanged, so cross-repo and open nodes are still excluded — the new test covers exactly those three cases plus two merged same-repo nodes.

#15606 and #15607 are the same finding filed under two perspectives, so closing both with this PR is right.

— 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

Choose a reason for hiding this comment

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

Looks correct to me. Verified at 4cd8b23:

  • closedByPullRequestReference (src/pkg/github/pr_supersession_sweep.go:438-486) now keeps the latest same-repo merged node instead of returning on the first; the found/After pair handles the first match correctly (zero-time latest is never compared). The existing filters for currentPR, !Merged and sameRepoPullURL are untouched, so the open and cross-repo nodes in the new test are excluded by the same code paths as before.
  • The node struct already decodes mergedAt into time.Time (pr_supersession_sweep.go:460), so the comparison is on parsed times, not strings.
  • The sole caller resolveIssueClosingPR (:417-419) only uses the (closer, ok) shape, which is unchanged. The commit-based fallback (:429-434) still returns the first merged PR, but that path is keyed by one closing commit so ordering is not a concern there.
  • The new test mirrors the existing /graphql httptest pattern in pr_supersession_sweep_test.go and NewClientForTest (client.go:1457). go build ./pkg/github/ passes on the head.

This resolves #15606 and #15607, which are the same pre-existing finding filed twice from the #15537 review.

— 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.

Reviewed — no findings from this perspective.

— hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Failing checks:

  • overlayfs-exec-guard

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 (3 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.

Author offline; maintainer asked hive to adopt and carry this split to merge.

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

@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=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.

Reviewed — no findings from this perspective.

— hive: agent=adjudicator-4 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.

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.

Decision needed: @clubanderson should decide whether to merge this contributor PR (#15609, now green at 7b9848b) and close the hive adoption #15634, or merge #15634 and close this one — the two diffs are byte-identical and cannot both land.

Conclusion: the change is correct, and this PR is now content-identical to its hive adoption #15634. One of the two should be closed; I have not closed anything.

Duplicate check (both diffs read in full): gh pr diff 15609 and gh pr diff 15634 differ in nothing but blob hashes — same src/pkg/github/pr_supersession_sweep.go hunk, same new pr_supersession_closer_test.go, same changelog.d/fixed-15606-latest-issue-closer.md. #15634 was opened as "Supersedes #15609" when this PR's CI was red; this head (7b9848b = 4cd8b23 + a merge of v5) is now green except for tide, so the original reason for the adoption no longer applies. Merging either makes the other a no-op; which one lands is an attribution/ownership call, not a code call.

Correctness (read against v5): closedByPullRequestReference (src/pkg/github/pr_supersession_sweep.go:468-485) previously returned on the first merged same-repo node, so GraphQL node order picked the closer. The new loop keeps the node with the latest MergedAt using a strict After, so ties keep the first node — deterministic. MergedAt is time.Time with json:"mergedAt" (line ~455), so the "mergedAt":null on the unmerged node in the test decodes to the zero value and is skipped by !node.Merged before it is ever compared. The only caller, resolveIssueClosingPR (line 418), consumes (closer, ok) unchanged. The test's cross-repo node other/repo/pull/42 exercises the existing sameRepoPullURL filter at line 480 and has the same timestamp as the winner, which confirms the repo filter and not timestamp order is what excludes it. Looks correct to me.

— 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 @7b9848b, 54/54 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

#15634 (the hive's adoption of this PR, with @Karibhou's commits as of 4cd8b23c5e90) has merged, but this PR has moved on to 7b9848be9ed3 since. Not closing it automatically: if the later commits are already covered, close this PR; otherwise rebase them on v5 for review.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

Head: verdict requires_human @7b9848b, 54/54 checks green, DCO yes, soak 4m0s 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

@Karibhou 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 conflicts with the base and needs a 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

Superseded by hive: re-authored as #15713 with the same commits and sign-off because the author's clanker is offline. This PR is closed; if #15713 fails, hive reopens it.

@hivecommons-hive hivecommons-hive Bot added the hive/superseded Closed by Hive: a different merged PR already landed this change label Oct 30, 2026
@hivecommons-hive hivecommons-hive Bot closed this Oct 30, 2026
@Karibhou
Karibhou deleted the fix/15606-latest-merged-closer branch November 15, 2026 11:07
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. hive/superseded Closed by Hive: a different merged PR already landed this change size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

1 participant