Skip to content

test(miner-discovery): end-to-end fixture-driven discovery scenario across the full Phase 1 pipeline #2311

Description

@JSONbored

Add one integration-shaped test that exercises the full Phase 1 pipeline end-to-end against fixture data — AI-policy hard-skip, fan-out, goal-model lane-fit, and ranking — in a single realistic scenario, so a future refactor of any individual piece (ranker weights, goal-model matching, AI-policy phrases) has one high-level regression test catching cross-module breakage that the per-module unit tests wouldn't catch individually.

Deliverables

  • test/integration/miner-discovery-pipeline.test.ts — a fixture scenario with ~6 synthetic candidate repos: one AI-PR-banned (must be fully excluded from output), one with no .gittensory-miner.yml (must use goal-model neutral defaults, not error), one perfectly matching a sample MinerGoalSpec's preferredLanes (must rank highest, all else equal), one matching a blockedPaths entry (must rank at/near zero via the goal-model short-circuit), one stale/old issue (must rank lower via the freshness factor), and one with an active duplicate-cluster signal (must rank lower via dupRisk).
  • Assert the final ranked output list's exact expected order matches the scenario's hand-reasoned expectation (a literal array-equality assertion on the ordered owner/repo#issueNumber list), not just "contains" checks — so the test actually pins the composed behavior.
  • Assert zero extra GitHub API calls were attempted for the banned repo beyond its one AI-policy-doc fetch (reuse the vi.stubGlobal("fetch", ...) call-counting pattern from the fan-out unit tests).
  • A doc-comment at the top of the file explaining this test's purpose is cross-module regression protection, and that per-module edge cases belong in the individual unit test files (opportunity-ranker.test.ts, goal-model.test.ts, ai-policy-map.test.ts, opportunity-fanout.test.ts), not duplicated here.

References

  • test/integration/ — existing directory for API-route-level / cross-module integration tests (per the contributing skill's Phase 3 test-location table: test/integration/ = "API routes + D1 via createTestEnv()"; this test is the miner-side analogue, exercising the full discovery module chain instead of an API route)
  • every companion Phase 1 module issue (opportunity-fanout.ts, opportunity-ranker.ts, goal-model.ts, ai-policy-map.ts) — the pieces this test wires together
  • test/fixtures/ai-policy/ (from the AI-policy fixture issue) — reused fixture corpus for the banned-repo scenario

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