Skip to content

πŸ› tracker: name the merged PR that closed an issue under a follow-up PR - #15480

Merged
clubanderson merged 1 commit into
v5from
fix/tracker-closed-issue-closer
Oct 29, 2026
Merged

clubanderson merged 1 commit into
v5from
fix/tracker-closed-issue-closer

Conversation

@clubanderson

Copy link
Copy Markdown
Member

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 #N landed (#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 closed chip was the bug: the closed by #N chip (#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 GraphQL closedByPullRequestsReferences read that names only a merged PR (an open PR with Fixes #N is listed there too and is never named); best effort β€” title/state survive a forge that cannot answer.
  • stageTrackerEnrichSoftLinks carries state_reason and closed_by on the link; the merged-ledger pass remains the fallback.
  • SPA chip: closed by #N (linking the merged PR) or closed Β· this PR unmerged with an explanatory hover β€” never a bare closed.
  • Docs: hive-merge.md "Issues close only after the merge"; dashboard-sections.md closed-issue row.

Tests

  • TestIssueLinkStateNamesOnlyMergedCloser β€” an unmerged PR with Fixes #N is not the closer, a merged one is; PRs and open issues cost no GraphQL read.
  • TestIssueLinkStateCloserLookupBestEffort.
  • TestStageTrackerEnrichSoftLinks extended with closer + state reason; UI row assertions updated.
  • go build ./..., go test ./pkg/github/... ./pkg/dashboard/... and TestDirectWriteRatchet green; go generate ./pkg/dashboard/... output committed.

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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 29, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 29, 2026
@github-actions

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
#15481 πŸ› dashboard: keep the topbar hamburger on-screen on phones same files src/pkg/dashboard/static/index.html
#15470 πŸ› dashboard: Merged counter is an odometer at rest, bee at full size same files src/docs/dashboard-sections.md
src/pkg/dashboard/static/index.html
#15473 πŸ› dashboard: Merged counter is an odometer at rest and the pill bee is 28 px same files src/pkg/dashboard/static/index.html
#15468 πŸ› tracker: reporter-trust hold reads 'Triage needed' same files src/docs/dashboard-sections.md
src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/static/index.html
#15477 ✨ tracker: accept triage for every selected issue at once same files src/docs/dashboard-sections.md
src/pkg/dashboard/static/index.html
#15478 πŸ› fix(dashboard): share tracker row pill assembly; fix shrink-priority comment same files src/pkg/dashboard/static/index.html
#15400 πŸ› fix: keep merge queue position visible during sweeps same files src/pkg/dashboard/static/index.html
#15425 πŸ› fix: identify tracker claims from the local ledger same files src/pkg/dashboard/static/index.html

@github-actions

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

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

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

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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracker: closed issue under a follow-up PR reads as closed before merge (bare closed chip, no closer)

1 participant