You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/db/repositories.ts's extractLinkedIssueNumbersWithOverflow (the canonical, production implementation, around line 8076) explicitly excludes regex matches that fall inside inline code spans (backtick-wrapped text), with this documented rationale:
// GitHub's native closing-keyword linker does not treat backtick-wrapped text as a real// "Closes #N" directive, and this repo's own PR template contains "(e.g. `Closes #123`)".// Keep the original text while rejecting regex hits that occur inside inline code spans; replacing// spans with whitespace would let text on either side combine into a fake closing reference.constinlineCodeSpanRanges=[...text.matchAll(/`[^`\n]*`/g)].map((match)=>({start: match.index!,end: match.index!+match[0].length,}));
...and later filters out any keyword match whose range overlaps one of these spans.
packages/loopover-engine/src/signals/predicted-gate-engine.ts has its own, separate local extractLinkedIssueNumbers (around line 920), used internally by this file's buildPreflightResult (the function the miner's local predicted-gate preview calls via predicted-gate.ts) to detect linked issues from a PR body. This local copy has NO inline-code-span exclusion at all:
Since this repo's OWN PR template contains the literal example text `Closes #123` (backtick-wrapped, per the comment in src/db/repositories.ts quoted above), a miner running the local predicted-gate preview against an unfilled or lightly-edited PR template body would have this unfilled template boilerplate misread as a real linked-issue reference to issue #123 — the exact false-positive the canonical src/db/repositories.ts implementation was fixed to guard against, still present in this file's separate local copy. This breaks predicted-gate.ts's documented predicted/live gate parity contract: the miner's local preview can silently suppress a missing_linked_issue warning (because it thinks issue #123 is linked) in a case where the live gate, using the canonical extractor, would correctly still raise it.
Requirements
packages/loopover-engine/src/signals/predicted-gate-engine.ts's local extractLinkedIssueNumbers function must exclude regex matches that fall inside inline code spans (backtick-wrapped text, `...`), using the same "collect inline code span ranges via text.matchAll(/[^\n]*/g), then skip any keyword match whose range overlaps one of those spans" approach as src/db/repositories.ts's extractLinkedIssueNumbersWithOverflow`. Do not replace or strip the code-span text itself (only skip matches whose range overlaps a span) — the canonical implementation's comment explains why: replacing spans with whitespace would let text on either side combine into a fake closing reference.
This fix is scoped ONLY to packages/loopover-engine/src/signals/predicted-gate-engine.ts's local extractLinkedIssueNumbers function. Do not modify src/db/repositories.ts (the already-correct canonical implementation) or packages/loopover-engine/src/signals/engine.ts (which imports the canonical implementation directly and does not have this bug).
extractLinkedIssueNumbers in packages/loopover-engine/src/signals/predicted-gate-engine.ts skips closing-keyword matches that fall inside inline code spans.
New unit test asserting a backtick-wrapped `Closes #123` reference in a PR body is NOT detected as a linked issue, while the same unwrapped reference is.
Test Coverage Requirements
This repo's Codecov patch gate is 99%+ for src/**/packages/**. The new inline-code-span exclusion branch must be covered by a new test in the suite covering predicted-gate-engine.ts (check test/unit/predicted-gate-engine-coverage.test.ts / test/unit/predicted-gate-engine-branch-coverage.test.ts for the existing coverage pattern to extend).
Expected Outcome
The miner's local predicted-gate preview no longer misreads unfilled PR-template boilerplate (or any other backtick-wrapped example text) as a real linked-issue reference, matching the canonical src/db/repositories.ts extractor's already-fixed behavior and restoring predicted/live gate parity for linked-issue detection.
Context
src/db/repositories.ts'sextractLinkedIssueNumbersWithOverflow(the canonical, production implementation, around line 8076) explicitly excludes regex matches that fall inside inline code spans (backtick-wrapped text), with this documented rationale:...and later filters out any keyword match whose range overlaps one of these spans.
packages/loopover-engine/src/signals/predicted-gate-engine.tshas its own, separate localextractLinkedIssueNumbers(around line 920), used internally by this file'sbuildPreflightResult(the function the miner's local predicted-gate preview calls viapredicted-gate.ts) to detect linked issues from a PR body. This local copy has NO inline-code-span exclusion at all:Since this repo's OWN PR template contains the literal example text
`Closes #123`(backtick-wrapped, per the comment insrc/db/repositories.tsquoted above), a miner running the local predicted-gate preview against an unfilled or lightly-edited PR template body would have this unfilled template boilerplate misread as a real linked-issue reference to issue #123 — the exact false-positive the canonicalsrc/db/repositories.tsimplementation was fixed to guard against, still present in this file's separate local copy. This breakspredicted-gate.ts's documented predicted/live gate parity contract: the miner's local preview can silently suppress amissing_linked_issuewarning (because it thinks issue #123 is linked) in a case where the live gate, using the canonical extractor, would correctly still raise it.Requirements
packages/loopover-engine/src/signals/predicted-gate-engine.ts's localextractLinkedIssueNumbersfunction must exclude regex matches that fall inside inline code spans (backtick-wrapped text,`...`), using the same "collect inline code span ranges viatext.matchAll(/[^\n]*/g), then skip any keyword match whose range overlaps one of those spans" approach assrc/db/repositories.ts'sextractLinkedIssueNumbersWithOverflow`. Do not replace or strip the code-span text itself (only skip matches whose range overlaps a span) — the canonical implementation's comment explains why: replacing spans with whitespace would let text on either side combine into a fake closing reference.packages/loopover-engine/src/signals/predicted-gate-engine.ts's localextractLinkedIssueNumbersfunction. Do not modifysrc/db/repositories.ts(the already-correct canonical implementation) orpackages/loopover-engine/src/signals/engine.ts(which imports the canonical implementation directly and does not have this bug).extractLinkedIssueNumbers("See the template: \Closes feat(data): add contributor reconciliation reports #123` for the format.", "owner/repo")must return[](no linked issues detected), whileextractLinkedIssueNumbers("Closes feat(data): add contributor reconciliation reports #123", "owner/repo")(the same reference NOT inside a code span) must still return[123]`.Deliverables
extractLinkedIssueNumbersinpackages/loopover-engine/src/signals/predicted-gate-engine.tsskips closing-keyword matches that fall inside inline code spans.`Closes #123`reference in a PR body is NOT detected as a linked issue, while the same unwrapped reference is.Test Coverage Requirements
This repo's Codecov patch gate is 99%+ for
src/**/packages/**. The new inline-code-span exclusion branch must be covered by a new test in the suite coveringpredicted-gate-engine.ts(checktest/unit/predicted-gate-engine-coverage.test.ts/test/unit/predicted-gate-engine-branch-coverage.test.tsfor the existing coverage pattern to extend).Expected Outcome
The miner's local predicted-gate preview no longer misreads unfilled PR-template boilerplate (or any other backtick-wrapped example text) as a real linked-issue reference, matching the canonical
src/db/repositories.tsextractor's already-fixed behavior and restoring predicted/live gate parity for linked-issue detection.Links & Resources
packages/loopover-engine/src/signals/predicted-gate-engine.ts(extractLinkedIssueNumbers, ~line 920)src/db/repositories.ts(canonicalextractLinkedIssueNumbersWithOverflow, ~line 8076, with the inline-code-span exclusion this issue ports over)