Skip to content

feat(engine): extract src/signals/engine.ts's 7 blocked builder functions (tracking issue) #4256

Description

@JSONbored

Found during a 2026-07-08 miner-roadmap audit. src/signals/engine.ts (5,541 lines) is the largest and most explicitly-acknowledged unextracted file blocking full miner/live-gate parity.

src/signals/reward-risk.ts (lines 7-14) names the exact blockers in its own comment: buildRoleContext, buildLaneAdvice, buildCollisionReport, buildQueueHealth, buildRepoFitRecommendation, buildContributorIntakeHealth, buildPullRequestReviewIntelligence (all in engine.ts) plus isFailingCheckSummary (in local-branch.ts) — its own words: "not yet extracted (and are far too large to port under the size cap)." The reward-risk module already takes these as an injected RewardRiskEngineDeps specifically to allow staged extraction later — this was designed to be split up.

Naming collision to handle during extraction: engine.ts (lines 811, 939) and packages/gittensory-engine/src/signals/predicted-gate-engine.ts (lines 114, 232) independently define buildCollisionReport/buildQueueHealth under the same names — different implementations for different bounded contexts (maintainer noise-report vs. miner pre-submission preview). Not a bug today since they're in different modules, but will need a deliberate rename for one pair once both live in the same package.

This is a large, multi-part effort — scoping as one tracking issue with a checklist (mirroring #2353's own pattern) rather than either one mega-PR or eagerly filing 8 separate issues before the first one lands and informs the rest.

Deliverables (one PR per item recommended, in roughly this order)

  • isFailingCheckSummary (local-branch.ts) — smallest, do first to unblock the others' dependency graph
  • buildRoleContext
  • buildLaneAdvice
  • buildCollisionReport — resolve the naming collision with predicted-gate-engine.ts's function of the same name during this extraction
  • buildQueueHealth — same naming-collision handling as above
  • buildRepoFitRecommendation
  • buildContributorIntakeHealth
  • buildPullRequestReviewIntelligence
  • Once all 8 land, update reward-risk.ts's RewardRiskEngineDeps injection to use the real extracted functions directly instead of the injection seam (or confirm the seam should stay for testability — maintainer call)

References

  • src/signals/engine.ts (5,541 lines — source)
  • src/signals/reward-risk.ts:7-14 (names the exact blockers, explains why extraction was deferred)
  • packages/gittensory-engine/src/signals/predicted-gate-engine.ts:114,232 (the naming-collision counterpart)
  • packages/gittensory-engine/src/signals/test-evidence.ts (extraction pattern to mirror per sub-item)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions