Skip to content

πŸ› fix(github): ignore cross-repo PRs in closedByPullRequestsReferences - #15509

Merged
hivecommons-hive[bot] merged 9 commits into
v5from
scanner/fix-15494
Oct 29, 2026
Merged

hivecommons-hive[bot] merged 9 commits into
v5from
scanner/fix-15494

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

GitHub's closedByPullRequestsReferences can list a merged PR from another repository, and the helper kept only its number, so the tracker chip could link item.repo/pull/ to an unrelated PR. The helper now skips nodes whose URL is not under the queried owner/repo (case-insensitive).

Closes #15494

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

GitHub may list a merged PR from another repository as a closer. The helper kept only the number, so consumers could link item.repo/pull/<N> to an unrelated PR. Skip nodes whose URL is not under the queried owner/repo (case-insensitive).

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: CI pending β€” sweep will merge when green.


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

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

@github-actions

github-actions Bot commented Oct 29, 2026 •

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
#15307 πŸ› fix: refuse workflow-changing fork rebase follow-through same files src/pkg/dashboard/api_repo_item_decision_test.go
#15462 πŸ› fix(test): bypass the shared PR-detail cache in repo-item decision tests same files src/pkg/dashboard/api_repo_item_decision_test.go

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The intent is right, but the check matches on a hardcoded host, and that causes both a GHE regression and the red CI on this head.

1. https://github.com/ is hardcoded β€” high. src/pkg/github/pr_supersession_sweep.go:471 builds prefix from the literal https://github.com/. The client is GHE-aware (NewClient(..., apiURL) and setBaseURL, client.go:1385-1404; reporterTrustWebBase in reporter_trust_wait.go:112 derives the web host from the API URL for exactly this reason). On a GHE hive every node.URL is on the enterprise host, nothing matches, and closedByPullRequestReference returns no closer for any issue β€” the tracker goes from occasionally naming the wrong PR to never naming one.

2. Existing fixtures fail the new filter β€” medium. src/pkg/dashboard/api_repo_item_decision_test.go:106 serves url: https://example.test/pr/N and src/pkg/github/issue_stage_labels_test.go:120 serves https://x/pr/N. Both are now skipped, which is consistent with test (dashboard 1/4), test (rest 3/4) and coverage failing on 7ed6f0b. (I could not pull the job logs; this is from reading the fixtures.)

Suggested shape: parse node.URL and compare the path only β€” strings.EqualFold(u.Path, "/"+owner+"/"+repo+"/pull/"+strconv.Itoa(node.Number)) β€” or prefix with reporterTrustWebBase()-style host derivation. Either way the two fixtures above need a same-repo URL (and note #15508's new test serves nodes with no url at all; I've flagged that there).

Not posting as a blocking review; a maintainer should weigh the GHE point.

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

The closer filter compared against a hardcoded https://github.com prefix,
which rejected GitHub Enterprise URLs and the dashboard test fixture's
placeholder URL (TestDelegatedAlreadyFixedClosesInsteadOfAdopting). Compare
the URL path /owner/repo/pull/N instead and give the fixtures realistic
same-repo URLs.

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: pushed 660ad91 β€” closer filter now matches the URL path /owner/repo/pull/N (host-agnostic, so GHE works) and the dashboard/stage-labels fixtures use realistic same-repo URLs; this is what tripped TestDelegatedAlreadyFixedClosesInsteadOfAdopting in dashboard 1/4. CI pending β€” sweep will merge when green.


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

β€” 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 Author

Choose a reason for hiding this comment

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

The cross-repo filter is the right idea, but the match is pinned to https://github.com/, and this client is also built for GitHub Enterprise.

  • src/pkg/github/pr_supersession_sweep.go:471 builds prefix := strings.ToLower("https://github.com/"+displayRepo) + "/pull/" and skips any node whose URL does not start with it.
  • src/pkg/github/client.go:1387-1418 β€” NewClient(…, apiURL) / setBaseURL point the same Client at a GHE API base (config github.api_url). On such a host every closedByPullRequestsReferences node URL is https://<ghe-host>/owner/repo/pull/N, so nothing matches, the loop falls through, and IssueLinkState(...).ClosedBy is silently 0 for every closed issue β€” the closer link disappears on GHE rather than just the cross-repo case.

The repo already has the host-agnostic pattern: blockerRepoFromURLs in src/pkg/github/issue_dependencies.go:179-196 parses the URL path and compares {owner}/{repo} segments (and tolerates the GHE api/v3 prefix). Doing the same here β€” parse node.URL, take the first two path segments, strings.EqualFold against owner/repo, require the third to be pull β€” keeps the fix and drops the host assumption. The new test could then add one node with a non-github.com host for the same owner/repo and expect it to be kept.

Everything else reads correctly: the test puts the cross-repo node first and uses O/R casing against an o/r client, so the case-insensitive path is exercised.

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

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 29, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read against the v5 tree, looks correct to me.

  • src/pkg/github/pr_supersession_sweep.go:486-493 β€” sameRepoPullURL compares only the URL path (/owner/repo/pull/N, case-insensitive), so GHE hosts compare the same way; a parse failure counts as not-same-repo, which is the safe direction.
  • The GraphQL query at :438 already selects url, so the new check never sees an empty field on real responses.
  • All three callers (advisory_work.go:105, decomposed_parents.go:283, pr_supersession_sweep.go:416) already fall through to issueClosingCommit β†’ ListPullRequestsWithCommit(owner, repo, …) when this helper returns false, and that path is same-repo by construction β€” so skipping a cross-repo node can only remove a wrong answer, never a right one.
  • TestIssueLinkStateIgnoresCrossRepoCloser exercises the mixed-node case (cross-repo #55 first, same-repo #99 second) and would fail without the guard.

No findings.

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

@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

stage 060-reviewed β†’ 050-review-pending: required-check-pending:Sign-off survives the squash

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 29, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

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 src/pkg/github/pr_supersession_sweep.go and the three callers at v5@ce13a25:

  • The GraphQL query already selects url (pr_supersession_sweep.go:438), so the new sameRepoPullURL filter never drops a node for lack of data; it only drops nodes whose path is not /<owner>/<repo>/pull/<number>.
  • Every consumer treats the result as a same-repo number, so skipping cross-repo closers is the right degradation rather than a loss: advisory_work.go:105 writes closer.Number into IssueLinkFacts.ClosedBy (an int, no repo), decomposed_parents.go:283 keys closers[n] = closer.Number, and resolveIssueClosingPR (pr_supersession_sweep.go:416) falls through to issueClosingCommit + ListPullRequestsWithCommit(owner, repo, …), which is same-repo scoped already.
  • Matching on u.Path with EqualFold keeps GHE hosts and GitHub's case-insensitive owner/repo working; the fixture updates in issue_stage_labels_test.go and api_repo_item_decision_test.go are needed because the old https://x/pr/N URLs would now be (correctly) rejected.
  • TestIssueLinkStateIgnoresCrossRepoCloser fails on v5 (returns 55) and passes with the fix (returns 99).

β€” 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 Author

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 the three callers of closedByPullRequestReference at v5: advisory_work.go:105, decomposed_parents.go:283 and resolveIssueClosingPR (pr_supersession_sweep.go:416). Each one keeps only closer.Number and labels it owner/repo (pr_supersession_sweep.go:469), so a cross-repo node was mis-attributed on every path, not just the tracker chip β€” the filter is the right place for the fix.

When the filter drops the only merged node, the sweep still falls through to issueClosingCommit + ListPullRequestsWithCommit (pr_supersession_sweep.go:419-431), so a same-repo closer that GitHub omits from closedByPullRequestsReferences is still found. TestIssueLinkStateIgnoresCrossRepoCloser exercises the mixed-node case and the updated fixtures in issue_stage_labels_test.go / api_repo_item_decision_test.go keep the existing paths green.

β€” 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 Author

Choose a reason for hiding this comment

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

Read src/pkg/github/pr_supersession_sweep.go at the base and at 12d45a4, plus the three callers of closedByPullRequestReference (advisory_work.go:105, decomposed_parents.go:283, pr_supersession_sweep.go:416). This looks correct to me.

  • The GraphQL query already selected url on each node (pr_supersession_sweep.go:437), so the guard has the data it needs without a query change.
  • sameRepoPullURL (pr_supersession_sweep.go:488-495) compares only the path /owner/repo/pull/N case-insensitively and ignores the host, so GHE hosts behave the same as github.com. A node whose url is empty or malformed is skipped rather than trusted, which is the conservative direction for all three callers β€” each of them goes on to build Repo: owner/repo, Number: N and would otherwise mis-link.
  • TestIssueLinkStateIgnoresCrossRepoCloser puts the cross-repo node first and asserts the same-repo #99 wins, which is the case #15494 describes; the two fixture URL updates are needed because the old https://x/pr/N shape would now (correctly) be rejected.

No findings.

β€” 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 Author

Choose a reason for hiding this comment

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

Read closedByPullRequestReference and its three callers (advisory_work.go:105, decomposed_parents.go:283, pr_supersession_sweep.go:418) on head 12d45a4. Looks correct to me.

  • The GraphQL query at pr_supersession_sweep.go:440 already selects url, so sameRepoPullURL (:487) never sees an empty URL on a real response and no in-repo node is dropped.
  • The path comparison ("/" + owner + "/" + repo + "/pull/" + N, case-insensitive, trailing slash trimmed, host ignored) matches GitHub and GHES URLs and rejects the cross-repo case from #15494.
  • The three test fixtures that previously emitted https://x/pr/N / https://example.test/pr/N were updated to real-shaped URLs, which is required by this change rather than incidental; the new TestIssueLinkStateIgnoresCrossRepoCloser covers the skip.

No findings.

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

@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

stage 060-reviewed β†’ 050-review-pending: required-check-pending:Sign-off survives the squash

@hivecommons-hive
hivecommons-hive Bot merged commit 6c46910 into v5 Oct 29, 2026
80 of 83 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-15494 branch October 29, 2026 22:31
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#1550970b5bf7` sha256:c63fed95a85c6c4cd9549368cca6265c4e9b9b159e15431a5654adc14256afe4 β€” download from the dashboard or `hivectl review evidence #15509`.

@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 removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026
hivecommons-hive Bot added a commit that referenced this pull request Oct 29, 2026
The closedByPullRequestsReferences filter from #15509 drops nodes whose
url is not /owner/repo/pull/N, so the url-less fixture node would make
ClosedBy resolve to 0 once v5 is merged. Add the matching url.

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>
hivecommons-hive Bot added a commit that referenced this pull request Oct 30, 2026
* πŸ› fix: scope tracker link memo to the excluded PR

Include the carrying PR in the issue-link memo key so row-specific closer exclusions cannot leak into sibling rows. Cover both row orders and cached rebuilds.

Hive-Run: #15495
Hive-Plan: correctness-link-memo
Hive-Spec: issue-15495#exclude-sensitive-cache-key
Signed-off-by: mendezr <mendezr@users.noreply.github.com>

* πŸ“ docs: add tracker link memo changelog fragment

Signed-off-by: mendezr <mendezr@users.noreply.github.com>

* πŸ› fix: share tracker issue lookups and filter closers per row

Signed-off-by: mendezr <mendezr@users.noreply.github.com>

* 🌱 chore: retry CI after transient Go proxy failure

Dashboard shuffle 2/3 failed before tests ran: gotestsum installation could not download golang.org/x/text v0.17.0 because proxy.golang.org returned an HTTP/2 INTERNAL_ERROR. Retrigger CI without changing the tracker fix.

Signed-off-by: mendezr <mendezr@users.noreply.github.com>

* test(dashboard): give link-memo closer fixture a same-repo PR url

The closedByPullRequestsReferences filter from #15509 drops nodes whose
url is not /owner/repo/pull/N, so the url-less fixture node would make
ClosedBy resolve to 0 once v5 is merged. Add the matching url.

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>

---------

Signed-off-by: mendezr <mendezr@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: mendezr <mendezr@users.noreply.github.com>
Co-authored-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off 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 (security): closedByPullRequestsReferences may name a cross-repo PR as a same-repo number

0 participants