fix(engine): exclude inline code spans in predicted-gate extractLinkedIssueNumbers#6658
Conversation
…dIssueNumbers (JSONbored#6630) `predicted-gate-engine.ts`'s local `extractLinkedIssueNumbers` (used by `buildPreflightResult` for the miner's local predicted-gate preview) had no inline-code-span exclusion, unlike its canonical twin `extractLinkedIssueNumbersWithOverflow` in `src/db/repositories.ts`. Since this repo's own PR template contains the literal `` `Closes JSONbored#123` `` example, a miner previewing an unfilled/lightly-edited template body would misread that backtick-wrapped boilerplate as a real linked-issue reference — silently suppressing a `missing_linked_issue` warning the live gate would still raise, and breaking predicted/live gate parity. Port the canonical exclusion: collect inline code-span ranges via `text.matchAll(/`[^`\n]*`/g)` and skip any closing-keyword match whose range overlaps a span, across all three match forms (bare `#N`, qualified `owner/repo#N`, full URL). The span text itself is not stripped — per the canonical comment, blanking spans would let text on either side combine into a fake closing reference. Scoped only to this file; the canonical extractor and `engine.ts` (which imports the canonical one) are untouched. Extends test/unit/predicted-gate-engine-coverage.test.ts: a backtick-wrapped `` `Closes JSONbored#123` `` (and qualified/URL variants) resolves to no linked issues, while the same unwrapped `Closes JSONbored#123` still returns [123]. Closes JSONbored#6630
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6658 +/- ##
=======================================
Coverage 93.64% 93.65%
=======================================
Files 680 681 +1
Lines 68026 68086 +60
Branches 18671 18688 +17
=======================================
+ Hits 63704 63764 +60
Misses 3347 3347
Partials 975 975
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-16 18:09:35 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
What
packages/loopover-engine/src/signals/predicted-gate-engine.ts's localextractLinkedIssueNumbers(used bybuildPreflightResultfor the miner's local predicted-gate preview) had no inline-code-span exclusion, unlike its canonical twinextractLinkedIssueNumbersWithOverflowinsrc/db/repositories.ts.This repo's own PR template contains the literal
`Closes #123`example, so a miner previewing an unfilled/lightly-edited template body would misread that backtick-wrapped boilerplate as a real linked-issue reference — silently suppressing amissing_linked_issuewarning the live gate (using the canonical extractor) would still raise, breaking the documented predicted/live gate parity.Resolves #6630.
Fix
Port the canonical exclusion into the local function: collect inline code-span ranges via
text.matchAll(/[^\n]*/g)and skip any closing-keyword match whose range overlaps a span, across all three match forms (bare#N, qualifiedowner/repo#N`, full issue URL). The span text itself is not stripped — per the canonical comment, blanking spans would let text on either side combine into a fake closing reference.Scoped only to this file —
src/db/repositories.ts(already correct) andengine.ts(imports the canonical extractor) are untouched.Acceptance / tests
Per the issue's exact criteria, extended
test/unit/predicted-gate-engine-coverage.test.ts:`Closes #123`inside a code span →[]Closes #123(unwrapped) →[123]`closes owner/repo#77`and URL`closes https://github.com/owner/repo/issues/88`inside spans →[]Locally green:
npx vitest run test/unit/predicted-gate-engine-coverage.test.ts→ 22/22; the file's coverage is 100% lines / 98%+ branch (the new exclusion branches fully covered).