Context
packages/loopover-engine/src/signals/predicted-gate-engine.ts:920-953 defines a local extractLinkedIssueNumbers whose own comment says it matches "the canonical src/db/repositories.ts extractor," but collects every regex match with no size limit. The real canonical extractor is capped: src/db/repositories.ts:7925 defines MAX_LINKED_ISSUE_NUMBERS = 50, and extractLinkedIssueNumbersWithOverflow stops collecting once reached. packages/loopover-engine/src/signals/engine.ts:32 imports and uses that exact capped host function in its own buildPreflightResult, while predicted-gate-engine.ts's own buildPreflightResult calls its uncapped local copy on the same 20,000-char-truncated PR body — a body can easily fit 50+ short "Closes #N" references in that space, so the miner's local pre-submission linked-issue count/set can diverge from what the real maintainer-side gate would compute, undermining this module's stated prediction-parity guarantee.
Requirements
- Cap the local
extractLinkedIssueNumbers at the same limit (50) the host's MAX_LINKED_ISSUE_NUMBERS enforces, stopping collection once reached (mirror extractLinkedIssueNumbersWithOverflow's early-stop behavior).
- Either import the cap from a shared location, or duplicate the literal
50 with a comment cross-referencing MAX_LINKED_ISSUE_NUMBERS in src/db/repositories.ts.
Deliverables
Test Coverage Requirements
99%+ Codecov patch coverage on every changed line and branch, plus a regression test that reproduces the exact failure mode described above and asserts it's fixed.
Expected Outcome
The miner's local gate prediction for linked-issue count/set matches what the real maintainer-side gate would compute, even for PR bodies with many closing references.
Links & Resources
packages/loopover-engine/src/signals/predicted-gate-engine.ts:920-953, src/db/repositories.ts:7925,7932,7973, packages/loopover-engine/src/signals/engine.ts:32.
Context
packages/loopover-engine/src/signals/predicted-gate-engine.ts:920-953defines a localextractLinkedIssueNumberswhose own comment says it matches "the canonicalsrc/db/repositories.tsextractor," but collects every regex match with no size limit. The real canonical extractor is capped:src/db/repositories.ts:7925definesMAX_LINKED_ISSUE_NUMBERS = 50, andextractLinkedIssueNumbersWithOverflowstops collecting once reached.packages/loopover-engine/src/signals/engine.ts:32imports and uses that exact capped host function in its ownbuildPreflightResult, whilepredicted-gate-engine.ts's ownbuildPreflightResultcalls its uncapped local copy on the same 20,000-char-truncated PR body — a body can easily fit 50+ short "Closes #N" references in that space, so the miner's local pre-submission linked-issue count/set can diverge from what the real maintainer-side gate would compute, undermining this module's stated prediction-parity guarantee.Requirements
extractLinkedIssueNumbersat the same limit (50) the host'sMAX_LINKED_ISSUE_NUMBERSenforces, stopping collection once reached (mirrorextractLinkedIssueNumbersWithOverflow's early-stop behavior).50with a comment cross-referencingMAX_LINKED_ISSUE_NUMBERSinsrc/db/repositories.ts.Deliverables
predicted-gate-engine.ts's local extractorTest Coverage Requirements
99%+ Codecov patch coverage on every changed line and branch, plus a regression test that reproduces the exact failure mode described above and asserts it's fixed.
Expected Outcome
The miner's local gate prediction for linked-issue count/set matches what the real maintainer-side gate would compute, even for PR bodies with many closing references.
Links & Resources
packages/loopover-engine/src/signals/predicted-gate-engine.ts:920-953,src/db/repositories.ts:7925,7932,7973,packages/loopover-engine/src/signals/engine.ts:32.