Problem
Epic #8172's foundation: the miner already records every predicted gate verdict (prediction-ledger.sqlite3's predictions table — target, head_sha, conclusion, readiness_score, blocker codes, engine_version) and every realized result (pr_outcome events in miner_event_ledger — merged/closed + reason, via lib/pr-outcome.ts), but nothing pairs them into the BacktestCase shape the shared calibration primitives consume. Without that corpus, no AMS knob can ever be backtested.
Requirements
⚠️ Required pattern. The pairing transform is PURE and lives in @loopover/engine (the miner is a thin IO/SQLite shell — every calibration primitive already flows through that seam, e.g. lib/calibration-run.ts). The miner side contributes only ledger readers reusing the existing readPrOutcomes() / prediction-ledger read paths.
- Pure adapter: prediction rows + realized outcomes (+ optional governor
attempt_blocked/halt verdicts from governor_events) → BacktestCase[] compatible with buildBacktestCorpus/splitBacktestCorpus. Deterministic join key: repo + PR number, latest-prediction-per-head_sha semantics matching lib/calibration.ts's existing precision join.
- Positive/negative class mapping documented in the module header: a
closed outcome against a merge-shaped prediction is the miner's reversal analog; engine_version is carried so a corpus can be filtered to comparable engine builds.
- Fully local: reads only the node's own ledgers. No network, no cross-node data.
Deliverables
Links & Resources
#8172 (epic), #8083 (the ORB analog), packages/loopover-engine/src/calibration/**, packages/loopover-miner/lib/prediction-ledger.ts, lib/pr-outcome.ts, lib/calibration.ts
Boundaries
No knob changes, no writes to any ledger — read-and-transform only. Corpus never leaves the node.
maintainer-only — epic decomposition of #8172.
Problem
Epic #8172's foundation: the miner already records every predicted gate verdict (
prediction-ledger.sqlite3'spredictionstable — target, head_sha, conclusion, readiness_score, blocker codes, engine_version) and every realized result (pr_outcomeevents inminer_event_ledger— merged/closed + reason, via lib/pr-outcome.ts), but nothing pairs them into theBacktestCaseshape the shared calibration primitives consume. Without that corpus, no AMS knob can ever be backtested.Requirements
attempt_blocked/halt verdicts fromgovernor_events) →BacktestCase[]compatible withbuildBacktestCorpus/splitBacktestCorpus. Deterministic join key: repo + PR number, latest-prediction-per-head_sha semantics matching lib/calibration.ts's existing precision join.closedoutcome against amerge-shaped prediction is the miner's reversal analog; engine_version is carried so a corpus can be filtered to comparable engine builds.Deliverables
buildCalibrationReportneighborhood)Links & Resources
#8172 (epic), #8083 (the ORB analog), packages/loopover-engine/src/calibration/**, packages/loopover-miner/lib/prediction-ledger.ts, lib/pr-outcome.ts, lib/calibration.ts
Boundaries
No knob changes, no writes to any ledger — read-and-transform only. Corpus never leaves the node.
maintainer-only — epic decomposition of #8172.