Repository navigation
π fix(dashboard): only link cross-referenced PRs that actually fix the issue - #14974
Conversation
|
[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 |
Generated by changelog-fragment-guard from the PR title (#5675). Edit the wording freely, or replace this file with the no-changelog label if the change is not user-visible. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
|
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 |
There was a problem hiding this comment.
I don't think this should land as-is: the new guard filters the one case the timeline path was added for, and leaves the case the PR body describes untouched.
Mechanism (at f87dd1e)
src/pkg/dashboard/contribute_prlink.go:146β the Search queryrepo:X type:pr Nruns first and accepts any PR whose title/body contains a bare#N(prReferencesIssue,:280-296). A PR whose body says "see also #N for context" is therefore still promoted to the linked PR by the search path; the newprClosesIssueguard at:183never sees it.- The timeline loop at
:182exists for PRs that reference the issue only in a PR comment or commit (#14859, landed in #14922 β see the comment at:174-177). Those PRs have a real title and a body that doesn't name the issue, soprClosesIssuereturnsfalseand they are dropped. The net effect is the inverse of the stated intent: body mentions still link, comment-only references (the #14859 scenario) no longer do. - The existing fixtures only keep passing because
openPR/mergedPRatcontribute_prlink_test.go:396-397have notitle/body, which hits the "empty β accept" branch at:268. Real timelinesource.issuepayloads always carry a title, so that branch is not representative of production.
Mismatch with the body: the body says "a PR that merely mentioned the issue promoted it to Reviewing" is fixed; with the search path unchanged, that is still true for body mentions.
Suggested direction: either apply the closing-keyword requirement in both paths (search at :163 and timeline at :183) and accept that comment-only references stop counting β which would re-open the #14859 expectation and should be called out β or keep the timeline path as a bare-reference catch (its original purpose) and drop this guard. #14966/#14967 are P3 advisories, so the status quo is also acceptable.
Also blocking: changelog-fragment-guard is red β changelog.d/fixed-14966-prlink-cross-reference-mentions.md needs a leading - (changelog.d/README.md:23).
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Read src/pkg/dashboard/contribute_prlink.go at f87dd1e against v5, plus src/pkg/github/prclaims.go:507 (FindClosingKeywordReference) and the merged #14922 that introduced the timeline path.
This regresses #14859 β the bug the timeline path was added to fix. searchLinkedPR already filters the Search results by title/body (prReferencesIssue, L163). The comment above the timeline loop (L174β179) says why the loop exists: "The title/body check above cannot see a PR that names the issue only in a PR comment (#14859)." The new prClosesIssue gate at L183 requires a closing keyword in title or body for every timeline source. A PR that references the issue only in commits and a PR comment β exactly #14656 in #14859 β has no such text, so it is dropped here too, and the dashboard goes back to saying the issue has no PR.
contribute_prlink.go:183+:267β276β mechanism:FindClosingKeywordReference(title+"\n"+body, β¦)returns false for a comment-only or commit-only reference; theGetBody()=="" && GetTitle()==""escape at L268 never fires in production because the timelinecross-referencedsource.issueis a full issue object with title and body. Severity: high β it reintroduces a human-reported false "no reference" (#14859) in order to fix an info/P3 advisory.- The existing timeline cases in
contribute_prlink_test.go:396β397(openPR,mergedPR) have notitle/bodyfields, so they pass only via that escape hatch and don't show the regression. A fixture with a non-closing body plus a comment reference (the #14859 shape) would fail at this head.
On scope: #14966 is a P3 advisory finding filed from reviewing #14922 and says "Fix it in the PR, or leave it β¦ check the finding still applies on the base branch." It did not ask for closing-keyword-only linking. If the goal is to stop mention-only PRs promoting an issue to Reviewing, a filter that preserves #14859 would need evidence the timeline path can see (e.g. keep the PR when any of its commits/comments reference the issue, or apply the keyword gate only when the PR also appears nowhere else), rather than title/body alone.
Recommend not merging as-is.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
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 |
There was a problem hiding this comment.
Correctness (delta re-review at 2e85793) β the delta is changelog-only (changelog.d/fixed-14966-prlink-cross-reference-mentions.md now a - bullet; stray fixed-14974.md removed), so the two prior correctness findings stand unchanged:
-
Still present β
src/pkg/dashboard/contribute_prlink.go:183-185regresses #14859. The timeline loop exists (per the comment at:176-179) to catch a PR that names the issue only in a PR comment.prClosesIssue(:268-274) now requires a Closes/Fixes/Resolves keyword in the PR's title/body; a comment-only reference has none, so it is skipped β exactly the #14859 case. Thetitle=="" && body==""fallback at:269never fires in production: timelinecross-referencedsource.issueis a full issue object and PR titles are required. Concrete fix: only reject when the title/body mentions#Nwithout a closing keyword (the "see also #N" case from #14966); if title/body does not mention the issue at all, the reference must have come from a comment β keep it (preserves #14859). -
Still present β
src/pkg/dashboard/contribute_prlink_test.go:396-397masks the regression.openPR/mergedPRfixtures have notitle/body, so the existing timeline cases pass only through the empty-fallback. Add a fixture with a non-empty, non-referencing title/body reaching the issue via timeline only and assert it is still linked.
β hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Deferred to shared-CI incident #14976: the red check here failed on a π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
β¦ keywords prClosesIssue rejected any cross-referencing PR whose title/body lacked a Closes/Fixes/Resolves keyword, which dropped PRs that reference the issue only from a PR comment β the case the timeline read exists for (#14859). Now a PR whose title/body never names the issue (bare #N, owner/repo#N, or issue URL) is kept, and the keyword gate applies only when the title/body does mention it without closing it. Add a timeline fixture with a populated, non-referencing title/body so the #14859 path exercises the gate rather than the empty-title/body fallback, and a prClosesIssue table test covering the mention forms. Hive-Fix-Attempt: 1/6 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Read the tree at 23cd226. The new timeline gate is correct for what it does, and it resolves #14966/#14967 as those issues scoped them (the loop at contribute_prlink.go:182). Two things a maintainer should weigh before merging:
1. The changelog claims more than the diff delivers (docs-currency, medium).
changelog.d/fixed-14966-prlink-cross-reference-mentions.md says "the dashboard no longer marks an issue as Reviewing just because an open pull request mentions it." That is not what happens. searchLinkedPR runs Search.Issues with repo:X type:pr N first (contribute_prlink.go:147-151), and that loop still admits any PR whose title/body contains a bare #N via prReferencesIssue (:161, :312-328) β no closing keyword required. A same-repo PR saying "see also #N" is indexed by that search and promoted at :161-168 before the timeline loop at :182 is ever reached. The new prClosesIssue gate only bites when search misses (index lag, or the PR falls outside the prLinkSearchPerPage = 10 window). Either apply the same gate to the search loop, or narrow the changelog line to the timeline path. The tests don't exercise this: every new case in TestSearchLinkedPR_CountsCommitCommentAndTimelineReferences that expects a mention-only PR to be skipped uses search: [].
2. Known residual, low. prMentionsIssue falls through to prReferencesIssue, which only trims trailing punctuation (:322). A body like Follow-up (#13135) tokenises to (#13135, is treated as "does not mention the issue", and is therefore kept by prClosesIssue:273-274 β the comment-only fallback. Pre-existing behaviour, so not a regression, but it is the exact "passing mention" shape the fix targets.
Otherwise: FindClosingKeywordReference(text, repo, repo, number) is called with the right repo args (prclaims.go:493-514 compares r[1]-or-default against issueRepo), the digit-boundary check in prMentionsIssue correctly rejects #131350, and pkg/dashboard already imports pkg/github elsewhere (api.go:21) so no new cycle.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
The gate is applied to only one of the two lookup paths, so a mention-only PR is still promoted whenever Search returns it β which is the common case.
What I verified in the tree (v5 @ 583fe8d + this diff):
src/pkg/dashboard/contribute_prlink.go:146queriesrepo:%s type:pr %d. GitHub's search index matches a bare#Nin title/body, so a PR whose body sayssee also #13135 for contextis normally a Search hit.- The Search loop at
:157-171filters withprReferencesIssue(:264-280), which accepts a bare#Ntoken without any keyword β the exact text this PR now rejects on the timeline path. - The new
prClosesIssuegate is only inserted in the timeline loop (:183-185). The timeline is only reached after Search, and Search'sopencandidate is kept and returned at:191regardless of what the timeline loop decides.
Consequence: for the mentionPR shape in your own test (body: "see also #13135 for context"), the real system takes the Search path, prReferencesIssue returns true, and the issue is still reported as Reviewing. The new tests pass only because every mention-only case sets search: '[]', i.e. models a PR the search index does not see. The timeline gate therefore only bites for PRs Search missed (indexing lag, or beyond the prLinkSearchPerPage = 10 window).
Two concrete effects:
changelog.d/fixed-14966-prlink-cross-reference-mentions.mdclaims "the dashboard no longer marks an issue as Reviewing just because an open pull request mentions it" β broader than what the code does.- The same PR is now judged differently by the two paths: accepted via Search, rejected via timeline. Which answer the dashboard shows depends on indexing timing rather than on the PR.
Suggested fix: apply the same gate in the Search loop β replace prReferencesIssue(iss, number) at :160 with prReferencesIssue(iss, number) && prClosesIssue(iss, repo, number) (or fold the closing-keyword requirement into prReferencesIssue itself, since both loops want "names the issue as a fix"), and add one table case with search: '[' + mentionPR + ']' expecting no link. Note that #14966/#14967 were scoped to the timeline line (:182), so if the intent is deliberately to leave Search's bare-mention behaviour alone, say so in the PR body and narrow the changelog line.
One lower-priority observation, not blocking: prMentionsIssue relies on prReferencesIssue for the bare form, which splits on whitespace and trims only trailing .,);:. A body like related: (#13135) yields token (#13135, is not recognised as a mention, and so is treated as the comment-only case and accepted by prClosesIssue. Pre-existing tokenisation, but the new gate inherits the hole.
Security, style and import direction (pkg/dashboard β pkg/github, already used in tests, no cycle) look fine.
β hive: agent=reviewer 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. |
Search.Issues indexes bare "#N" mentions, so a PR whose body says "see also #N" was still returned as the open linked PR via the search path even though the timeline path required Closes/Fixes/Resolves. Apply the same closing-keyword gate to search hits (searchHitClosesIssue), accept "(#N)"/"[#N]" as mentions in prReferencesIssue so a parenthesised bare mention is not misread as comment-only, refresh the searchLinkedPR doc comment, and narrow the changelog wording to match. Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Read src/pkg/dashboard/contribute_prlink.go at 071a132, the FindClosingKeywordReference it now calls (src/pkg/github/prclaims.go:480-514), and the new tests. go build ./pkg/dashboard/ passes; pkg/github does not import dashboard, so no cycle. The change does what #14966 asks and looks correct to me, with one narrow gap worth knowing about:
Low β URL-form closing references are no longer linked. claimRefPattern (prclaims.go:480-481) matches only #N and owner/repo#N, but GitHub also honours Fixes https://github.com/o/r/issues/N. For such a PR, prMentionsIssue (contribute_prlink.go:310) returns true via the URL form, so prClosesIssue (:300) falls through to FindClosingKeywordReference, which returns false β the PR is dropped. On v5 any mention linked it, so this is a small regression for URL-style bodies. The test table at contribute_prlink_test.go:106 only covers the URL without a keyword, so the positive URL case is unpinned. Hive-authored bodies use Closes #N, and the same parser governs claims elsewhere, so I'd call this acceptable β but it is the one case the issue's "title or body closes the issue" wording would expect to pass. Fix, if wanted, is in claimRefPattern, not here.
Everything else checks out: search hits gated by searchHitClosesIssue (:163), timeline hits by prClosesIssue (:185) with the comment-only path preserved (no title/body mention β keep), and prReferencesIssue's wider punctuation trim (:339) only broadens the mention detector. tide is waiting on approved/lgtm.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me, with one low-severity edge a maintainer may want to accept knowingly.
Verified at 071a132. pkg/dashboard already imports pkg/github (src/pkg/dashboard/api.go, agent_last_action.go), so the new import in contribute_prlink.go:11 adds no cycle. github.FindClosingKeywordReference (src/pkg/github/prclaims.go:493-512) matches a closing keyword followed by #N or owner/repo#N, compares the resolved repo case-insensitively to issueRepo, and deliberately ignores "see #N"-style mentions β exactly the gate #14966 asks for. The two-tier timeline rule in prClosesIssue (contribute_prlink.go:290-301) is right: a PR whose own title/body never names the issue can only be on the timeline because of a PR comment, which is the #14859 case the timeline read exists for, so keeping it unconditionally preserves that fix while mention-only PRs are dropped. The prMentionsIssue digit-boundary loop (:308-324) correctly keeps #13135 from matching #131350, and the table test pins both directions.
Low β URL-form closes are now dropped on the timeline path. FindClosingKeywordReference runs stripClosingFalsePositiveText first (prclaims.go:498, :518-523), which replaces every https://β¦ with a space, so a body like Closes https://github.com/o/r/issues/13135 yields no keyword match. prMentionsIssue does recognise the URL form (:313), so prClosesIssue takes the keyword branch and returns false. Before this PR the timeline path accepted every cross-referencing PR, so such a PR was linked; after it, it is not, even though GitHub itself closes the issue on that syntax. This is consistent with how ParseClaimedIssues already treats URL closes everywhere else in hive, so it is a known limitation rather than a new class of bug β but it is a behaviour change on this path, and the changelog line ("counts as the linked PR only when its title or body closes the issue") slightly overstates it. If you want to keep it, a one-line note in the prClosesIssue doc comment would stop the next reader from treating it as a bug; if not, prMentionsIssue could skip the URL form so URL-only bodies fall into the comment-only branch.
I have not approved, merged, or changed anything.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1
|
stage 080-awaiting-merge-admission β 060-reviewed: 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 |
Any same-repo open PR named in a timeline cross-referenced event was reported as the issue's linked PR, so a PR that merely mentioned the issue promoted it to Reviewing. The timeline loop now requires the PR's title/body to carry a closing keyword for the issue, reusing github.FindClosingKeywordReference.
Closes #14966
Closes #14967
β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88