Skip to content

predicted-gate-engine.ts's local extractLinkedIssueNumbers has no cap, unlike the capped extractor it claims to mirror #6771

Description

@JSONbored

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

  • 50-item cap added to predicted-gate-engine.ts's local extractor
  • Regression test with 60+ distinct closing references (spanning all three supported reference forms) asserting the returned array caps at 50

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions