Repository navigation
π fix(github): ignore cross-repo PRs in closedByPullRequestsReferences - #15509
Conversation
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>
|
[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 |
|
hive/awaiting-ci: CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
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>
|
hive/awaiting-ci: pushed 660ad91 β closer filter now matches the URL path π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
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:471buildsprefix := strings.ToLower("https://github.com/"+displayRepo) + "/pull/"and skips any node whoseURLdoes not start with it.src/pkg/github/client.go:1387-1418βNewClient(β¦, apiURL)/setBaseURLpoint the sameClientat a GHE API base (configgithub.api_url). On such a host everyclosedByPullRequestsReferencesnode URL ishttps://<ghe-host>/owner/repo/pull/N, so nothing matches, the loop falls through, andIssueLinkState(...).ClosedByis silently0for 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
There was a problem hiding this comment.
Read against the v5 tree, looks correct to me.
src/pkg/github/pr_supersession_sweep.go:486-493βsameRepoPullURLcompares 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
:438already selectsurl, 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 toissueClosingCommitβListPullRequestsWithCommit(owner, repo, β¦)when this helper returnsfalse, and that path is same-repo by construction β so skipping a cross-repo node can only remove a wrong answer, never a right one. TestIssueLinkStateIgnoresCrossRepoCloserexercises 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
|
stage 060-reviewed β 050-review-pending: required-check-pending:Sign-off survives the squash |
There was a problem hiding this comment.
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 newsameRepoPullURLfilter 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:105writescloser.NumberintoIssueLinkFacts.ClosedBy(an int, no repo),decomposed_parents.go:283keysclosers[n] = closer.Number, andresolveIssueClosingPR(pr_supersession_sweep.go:416) falls through toissueClosingCommit+ListPullRequestsWithCommit(owner, repo, β¦), which is same-repo scoped already. - Matching on
u.PathwithEqualFoldkeeps GHE hosts and GitHub's case-insensitive owner/repo working; the fixture updates inissue_stage_labels_test.goandapi_repo_item_decision_test.goare needed because the oldhttps://x/pr/NURLs would now be (correctly) rejected. TestIssueLinkStateIgnoresCrossRepoCloserfails onv5(returns 55) and passes with the fix (returns 99).
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
urlon 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/Ncase-insensitively and ignores the host, so GHE hosts behave the same as github.com. A node whoseurlis empty or malformed is skipped rather than trusted, which is the conservative direction for all three callers β each of them goes on to buildRepo: owner/repo, Number: Nand would otherwise mis-link.TestIssueLinkStateIgnoresCrossRepoCloserputs the cross-repo node first and asserts the same-repo#99wins, which is the case #15494 describes; the two fixture URL updates are needed because the oldhttps://x/pr/Nshape would now (correctly) be rejected.
No findings.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
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:440already selectsurl, sosameRepoPullURL(: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/Nwere updated to real-shaped URLs, which is required by this change rather than incidental; the newTestIssueLinkStateIgnoresCrossRepoClosercovers the skip.
No findings.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
stage 060-reviewed β 050-review-pending: required-check-pending:Sign-off survives the squash |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
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>
* π 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>
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