Skip to content

feat(miner-discovery): goal model — translate MinerGoalSpec into ranker weights #2304

Description

@JSONbored

Bridge MinerGoalSpec (the parsed .gittensory-miner.yml) to the ranker's laneFit input: a pure function that, given a candidate issue's labels/paths and a repo's MinerGoalSpec, produces a 0-1 laneFit score — 1.0 when the candidate matches every preferredLanes entry, 0 when it touches a blockedPaths entry, and a smooth interpolation between. This is the "goal model" the task description calls for: what a miner looks for, tied directly to MinerGoalSpec from Phase 0.

Deliverables

  • packages/gittensory-engine/lib/goal-model.tsexport type GoalModelInput = { candidatePaths: string[]; candidateLabels: string[]; goalSpec: MinerGoalSpec } and export function computeLaneFit(input: GoalModelInput): number, returning 0 immediately if any candidatePaths entry matches a goalSpec.blockedPaths glob (short-circuit, mirrors the blockedPaths precedence in src/signals/focus-manifest.ts's gate config), else a ratio of preferredLanes matches (label or path-glob) over total preferredLanes count, defaulting to a neutral 0.5 when preferredLanes is empty (no stated preference ⇒ don't penalize or favor).
  • Reuse matchesManifestPath (src/signals/focus-manifest.ts:1142) for glob matching rather than reimplementing path-glob logic — import it directly (or, if it's not exported for external package use yet, note the import gap explicitly in a comment and use an equivalent minimal glob helper scoped to this file).
  • Unit tests: empty preferredLanes yields exactly 0.5; a blockedPaths hit always yields 0 regardless of preferredLanes matches (short-circuit precedence test); a full-match candidate yields 1.0; a partial match yields the correct fractional ratio; label-based and path-based lane matches are both exercised.
  • A doc-comment cross-referencing rankOpportunityScore's laneFit parameter (from the ranker issue) so the two files' contracts stay obviously paired.

References

  • src/signals/focus-manifest.ts:1142 (matchesManifestPath) — the existing glob-matching helper to reuse
  • src/signals/focus-manifest.ts FocusManifestGateConfig (line 20) — blockedPaths-takes-precedence convention to mirror
  • packages/gittensory-engine/lib/miner-goal-spec.ts (from the MinerGoalSpec parser issue) — the MinerGoalSpec type this consumes
  • packages/gittensory-engine/lib/opportunity-ranker.ts (from the ranker issue) — the laneFit input this feeds

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions