Repository navigation
π tracker: name the merged PR that closed an issue under a follow-up PR - #15480
Conversation
A PR row whose linked issue is already closed drew a bare `closed` chip when the hive's merged ledger did not know the closer (a PR the owner merged by hand; a merge lost across a roll), which read as the issue having been closed before its fix merged β hive's #15422 under follow-up #15425 and #15058 under #15431. The issues were in fact closed by GitHub the second #15426 / #15068 merged. The soft-link enrichment now asks GitHub which MERGED pull request closed the issue (closedByPullRequestsReferences; an open PR with Fixes #N is listed there too and is never named) and carries state_reason and closed_by on the link, so the chip reads `closed by #N`. When no merged closer is known it reads `closed Β· this PR unmerged` with a hover saying a person or another merged PR closed it. Docs state the rule: the hive closes an issue only after its PR has merged. Fixes #15479 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[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
|
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
There was a problem hiding this comment.
Reviewed (security) β no in-scope findings. The new IssueLinkState path is safe: the GraphQL read is variable-parameterized and filtered to merged nodes excluding the carrying PR (src/pkg/github/pr_supersession_sweep.go:437-444, 471-476), and the chip href is a trusted base plus Number(by) with the title esc'd (tracker-filter.js:58-60, 67-70).
Advisory, out of scope (pre-existing helper semantics, now surfaced in a second consumer): closedByPullRequestsReferences can list a merged PR from another repository, but the helper drops node.URL and reports only Number, which the SPA then links as item.repo/pull/<N> β a wrong PR on the same repo in that edge case. Cheap guard in the helper:
if node.Number == currentPR || !node.Merged || !strings.HasSuffix(strings.TrimSuffix(node.URL, "/pull/"+strconv.Itoa(node.Number)), "/"+owner+"/"+repo) {
continue
}
β hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. |
There was a problem hiding this comment.
Reviewed (intent-alignment) β solves #15479 for the cases it names; one claim in the changelog/docs is wider than the code.
Low Β· changelog/docs promise closed by #N for a duplicate Fixes #N PR, but the new GitHub lookup never runs for that link kind (changelog.d/fixed-tracker-closed-issue-names-merged-closer.md:1, src/docs/hive-merge.md:643-650, src/docs/dashboard-sections.md:1040).
A Fixes #N GitHub recognises arrives as a closing reference with title/state already filled (src/pkg/github/pr_batch_graphql.go:47 β src/pkg/dashboard/stage_tracker.go:2824). stageTrackerEnrichSoftLinks only looks up links with empty title and state (stage_tracker.go:2969), so IssueLinkState / closedByPullRequestsReferences is never asked for them; their ClosedBy comes solely from the in-memory merged ledger (stage_tracker.go:2345, 3253-3256) β the very source #15479 says missed a hand merge and a roll. For a duplicate PR in that situation the chip is closed Β· this PR unmerged, not closed by #N. The issue's two named rows (Refs #15422, "extending #15058") are soft links and are covered, so this does not block.
Either narrow the wording, or extend the lookup to closed closing-ref links that have no closer yet (adds one GraphQL read per such link, inside the existing stageTrackerLinkLookups budget and memo):
--- a/src/pkg/dashboard/stage_tracker.go
+++ b/src/pkg/dashboard/stage_tracker.go
@@ -2969 +2969 @@
- if !li.Listed && li.Title == "" && li.State == "" {
+ if !li.Listed && ((li.Title == "" && li.State == "") || (li.State == "closed" && li.ClosedBy == 0)) {(then keep the existing if in.ok title/state assignment but only overwrite li.Title/li.State when they were empty, so the GraphQL-fresh closing-ref state is not clobbered by a staler GET β or, simpler, only copy stateReason/closedBy when li.State was already set.)
β hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Reviewed (correctness) β one advisory, no blocker.
Ledger fallback never reaches soft links (low). The PR body says "the merged-ledger pass remains the fallback", but stageTrackerMarkClosedBy runs inside buildStageTracker (src/pkg/dashboard/stage_tracker.go:2345), before stageTrackerEnrichSoftLinks runs in encodeStageTracker (stage_tracker.go:2693). At 2345 a soft link still has State == "", so it is skipped (stage_tracker.go:3253). When the GraphQL closer read is refused (the best-effort path at src/pkg/github/advisory_work.go IssueLinkState, tested by TestIssueLinkStateCloserLookupBestEffort), the chip reads "this hive could not name the closer" even when the merged ledger knows the closer. The GitHub.com case in #15479 is fixed as described; this only affects forges/tokens where the GraphQL read fails. Cheap fix:
resp := build(status, s.stageStoreOrShared(), now)
s.stageTrackerEnrichSoftLinks(resp.Items, stageTrackerRepoQualifier(status), now)
// Soft links only gain state above; give them the merged-ledger closer too.
stageTrackerMarkClosedBy(resp.Items, s.mergedLedger().ClosedBy)
(stageTrackerMarkClosedBy already skips links with ClosedBy != 0, so the second pass is idempotent.)
Noted, not a defect: IssueLinkState takes exclude = pr.Number but the memo is keyed by owner/repo#issue only (stage_tracker.go:2970-2978). Safe today because Items only lists open PRs (stage_tracker.go:85) and the helper is merged-only, so the exclusion is a no-op; worth a comment if rows ever include merged PRs.
β hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
Fixes #15479
Why
Two tracker rows read as if an issue had been closed before its fix merged: #15422 under #15425 (merge train) and #15058 under #15431 (soaking). Both issues were actually closed by GitHub the second a different, merged PR with
Fixes #Nlanded (#15426 merged 16:38:39Z β issue closed 16:38:41Z; #15068 merged 19:35:52Z β issue closed 19:35:54Z). The open PRs are follow-ups (Refs #15422, "extending #15058"). Hive's close-on-merge already refuses an unmerged PR (pr_not_merged); nothing closed early.The bare
closedchip was the bug: theclosed by #Nchip (#15232) only fills from the in-memory merged ledger, which did not know a hand merge or a merge lost across a roll.What
github.Client.IssueLinkState: one issues GET plus, for a closed issue, one GraphQLclosedByPullRequestsReferencesread that names only a merged PR (an open PR withFixes #Nis listed there too and is never named); best effort β title/state survive a forge that cannot answer.stageTrackerEnrichSoftLinkscarriesstate_reasonandclosed_byon the link; the merged-ledger pass remains the fallback.closed by #N(linking the merged PR) orclosed Β· this PR unmergedwith an explanatory hover β never a bareclosed.Tests
TestIssueLinkStateNamesOnlyMergedCloserβ an unmerged PR withFixes #Nis not the closer, a merged one is; PRs and open issues cost no GraphQL read.TestIssueLinkStateCloserLookupBestEffort.TestStageTrackerEnrichSoftLinksextended with closer + state reason; UI row assertions updated.go build ./...,go test ./pkg/github/... ./pkg/dashboard/...andTestDirectWriteRatchetgreen;go generate ./pkg/dashboard/...output committed.