fix(miner): bring extractLinkedIssueNumbers to parity with the host's code-span and URL handling - #7560
Closed
shin-core wants to merge 1 commit into
Closed
Conversation
… code-span and URL handling extractLinkedIssueNumbers stripped inline code spans with a string replace before matching, which could pull a bare #N up against a preceding closing keyword that was not adjacent in the original text (e.g. "Fixes `x` JSONbored#45" -> "Fixes JSONbored#45"), spuriously linking JSONbored#45. It also missed GitHub's full issue-URL closing form, so a contributor pasting the browser URL produced zero linked issues and could trip the no-linked-issue hard rule on a PR that genuinely had one. Match the host's extractLinkedIssueNumbersWithOverflow: exclude code spans by byte range (preserving the original keyword/#N adjacency the regex depends on) and recognize the `https://github.com/owner/repo/issues/N` form alongside the qualified and bare forms, counting the qualified and URL forms only when they target this repo. Closes JSONbored#7527
Contributor
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
JSONbored
reviewed
Jul 20, 2026
JSONbored
left a comment
Owner
There was a problem hiding this comment.
Merge conflicts/issue already resolved.
This branch has conflicts that must be resolved
Use the [web editor](https://github.com/JSONbored/loopover/pull/7560/conflicts) or the command line to resolve conflicts before continuing.
packages/loopover-miner/lib/self-review-context.js
packages/loopover-miner/lib/self-review-context.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
extractLinkedIssueNumbers(miner self-review context) is a port of the host'sextractLinkedIssueNumbersWithOverflow(src/db/repositories.ts). It had drifted from the host in two ways this PR fixes:body.replace(/[^]*/g, "")*deletes* a span's characters, which can pull a bare#Nup against a preceding closing keyword that was **not** adjacent in the original text — e.g.Fixes `x` chore(deps): bump the npm-minor-and-patch group with 7 updates #45collapses toFixes chore(deps): bump the npm-minor-and-patch group with 7 updates #45and spuriously links **#45**. The fix matches code-span byte ranges and skips any keyword hit overlapping one, preserving the original keyword→#N` adjacency the regex depends on.Closes https://github.com/owner/repo/issues/N(a common paste from the browser address bar). The old regex required a literal#, so that form produced zero linked issues and could trip the "no linked issue" hard rule on a PR that genuinely had one. The regex now recognizes the URL form (http/https, optionalwww.) alongside the qualifiedowner/repo#Nand bare#Nforms.Both the qualified and URL forms count only when
owner/repocase-insensitively matches the repo being fetched; a reference to a different repo never spoofs a same-repo link. This mirrors the host exactly (match.groups!,owner && owner.toLowerCase() !== target,Number(...)+Number.isInteger && > 0).Tests (regression + branch coverage)
Six
REGRESSION (#7527)cases via the existingfetchSelfReviewContext+routedFetch/prPayloadharness:Fixes \x` chore(deps): bump the npm-minor-and-patch group with 7 updates #45) → **not** linked ([]) — **proven** to fail under the old string-replace ([45]`).[7].www.) same-repo →[88, 89].[].#N+ qualified same-repo + qualified different-repo →[3, 4].Closes #0→ rejected by thenumber > 0guard, only#6survives →[6](covers that guard's false branch — proven to fail if> 0is dropped).Validation
npm run typecheck— exit 0 after a fresh@loopover/enginebuild.test/unit/miner-self-review-context.test.ts— 44/44 pass.npm run test:miner-packpasses;git diff --checkclean. Generated.js/.d.tsregenerated by the miner build.Closes #7527