fix(miner): resolve metrics-cli correct/incorrect via the calibration outcome-join - #8487
fix(miner): resolve metrics-cli correct/incorrect via the calibration outcome-join#8487rsnetworkinginc wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #8487 +/- ##
==========================================
+ Coverage 79.69% 89.30% +9.61%
==========================================
Files 791 99 -692
Lines 79334 22778 -56556
Branches 23960 3898 -20062
==========================================
- Hits 63222 20341 -42881
+ Misses 13047 2259 -10788
+ Partials 3065 178 -2887
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-24 15:39:36 UTC
Review summary Nits — 5 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Summary
packages/loopover-miner/lib/metrics-cli.ts'scollectPredictionMetricRowsmappedprediction-ledger rows onto
MinerPredictionMetricRowbut only ever setconclusion,leaving the optional
correctfield unset on every row. As a resultloopover-miner metrics'sloopover_miner_prediction_correct_total/loopover_miner_prediction_incorrect_totalcounters were permanently stuck at zero forevery self-hosted miner, even though the renderer and the outcome-join both already exist.
This wires the realized-outcome pairing using the join
calibration-cli.tsalreadyimplements — no second join, and
buildCalibrationReport's public contract is untouched.Changes
packages/loopover-miner/lib/metrics-cli.tscollectPredictionMetricRowsnow resolves each prediction'scorrectby looking up thelatest
pr_outcomefor the same(repoFullName, targetId)— reusingtoPredictionRecordsand
toOutcomeRecordsfromcalibration-cli.tsand normalizing both sides throughcalibration.ts'snormalizeDecision, exactly asbuildCalibrationReportdoes. A row isscored
true/falseonly when both the prediction and its realized outcome normalize tomerge/close.holdconclusion (nomerged/closedcounterpart), and an unclassifiable/malformed outcome all stay unresolved (
correctleftunset) — an undecided row is never fabricated as
false, matchingbuildCalibrationReport'sown treatment of
hold.runMetricsopens the event ledger the same way the barecalibrationcommand does(
initEventLedger(resolveEventLedgerDbPath(env)), read once, close in afinally), sometricsstays strictly read-only and offline with no change to its zero-argument usagecontract.
packages/loopover-miner/lib/calibration.ts: export the existingnormalizeDecisionso the metrics join reuses it verbatim (additive; no behavior change).
test/unit/miner-metrics-cli.test.ts: cover every branch of the new join directly — amerge prediction confirmed by
merged(correct: true) and disconfirmed byclosed(
false), acloseprediction confirmed and disconfirmed the same way, aholdprediction(never resolved), a prediction with no outcome yet (pending, unresolved), a well-formed
outcome whose decision is neither
mergednorclosed(unclassifiable, unresolved), and amalformed
pr_outcomeevent (non-integerprNumber, skipped bytoOutcomeRecords); plus thereal event-ledger open path resolving the counters end-to-end.
Expected outcome
loopover_miner_prediction_correct_total/loopover_miner_prediction_incorrect_totalnow moveas real predictions resolve against realized PR outcomes, instead of being permanently zero.
Closes #8315