fix(review): derive the proof-page accuracy from real reversals and surface ledger exclusions - #10178
Conversation
…urface ledger exclusions The public proof page published two figures that could never be anything but perfect. 1. accuracy was always 1. confirmed was SUM(action IN (merge,close) AND reason_code NOT LIKE 'reversal%'), but decision_records.reason_code is written once at decision time from two derivations, neither of which can produce a 'reversal…' value, and nothing updates it — reversals are separate audit_events rows. So confirmed === decided for every repo and buildProofAccuracy published accuracy = round3(confirmed/decided) = 1 with a Wilson interval hugging 1, the exact denominator-choice failure the codebase already diagnosed once on public-stats. Count confirmed as merge/close decisions with NO reversal_reverted/reversal_reopened/reversal_superseded audit row for their <repo>#<pull>, in its OWN section: a failing read degrades to insufficient_data (null confirmed) rather than asserting confirmed === decided. 2. a ledger with declared waivers or pruned preimages still badged plain 'verified'. verifyDecisionLedger reports prunedRecords / waivedContentMismatches / waivedUnchainedRecords, but the proof page's verifyLedger dependency dropped them, so buildProofLedgerStatus could only ever render 'verified · anchored'. Carry the three counts onto the verified status; buildProofBadgeMessage now returns 'verified · N excluded' (N = their sum) with the neutral colour when the sum is > 0, and today's exact strings and colours when it is 0. Unchanged: PROOF_MIN_DECISIONS, PROOF_SAMPLE_RECORDS, round3, buildProofAccuracy's published/insufficient_data shape, the anchor status, the empty/broken/unavailable ledger states, and the allowlist-by-name privacy discipline. Closes JSONbored#10012
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-31 11:16:15 UTC
Review summary Nits — 5 non-blocking
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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10178 +/- ##
===========================================
- Coverage 92.21% 80.46% -11.75%
===========================================
Files 932 283 -649
Lines 114114 58829 -55285
Branches 27566 8706 -18860
===========================================
- Hits 105229 47339 -57890
- Misses 7583 11199 +3616
+ Partials 1302 291 -1011
Flags with carried forward coverage won't be shown. Click here to find out more.
|
What & why
src/review/proof-summary.tsrenders the unauthenticated per-repo proof page. Two of its published claims were structurally unable to be anything but perfect.1.
confirmedcould never differ fromdecided, so accuracy was always exactly1decision_records.reason_codeis written once at decision time fromderiveDecisionReasonCode/defaultDecisionRecordReasonCode, neither of which can produce areversal…value, and nothing everUPDATEs it. Reversals are recorded as separateaudit_eventsrows (reversal_reverted/reversal_reopened/reversal_superseded), which this query never touched. Soconfirmed === decidedfor every repo, always, andbuildProofAccuracypublishedaccuracy: round3(confirmed / decided)=1with a Wilson interval hugging 1 — the exact denominator-choice failure the codebase already diagnosed once onpublic-stats.ts("STILL 100% for all three repos").2. A ledger with declared waivers or pruned preimages still badged plain
"verified"verifyDecisionLedgerreportsprunedRecords,waivedContentMismatchesandwaivedUnchainedRecords, but the proof page'sverifyLedgerdependency signature dropped them — sobuildProofLedgerStatuscould only ever produce{ state: "verified" }andbuildProofBadgeMessagerendered"verified · anchored". On an instance carrying theLOOPOVER_LEDGER_*_WAIVERdeclarations those parsers exist to support, the most public surface rendered exactly the silence the internal verifier refuses to.The fix
Accuracy: count
confirmedas merge/close decisions with noreversal_*audit_eventsrow for their<repo>#<pull>(anti-join, mirroringpublic-rule-precision's treatment of the same event types), in its ownsection(...). A failing reversal read degrades toinsufficient_data(confirmed= null) rather than assertingconfirmed === decided.decidedstays the count ofaction IN ('merge','close').Ledger: carry
prunedRecords/waivedContentMismatches/waivedUnchainedRecordsonto theverifiedstatus (and the twoverifyLedgerdependency signatures).buildProofBadgeMessagenow returns"verified · N excluded"(N = the sum) withbuildProofBadgeColorreturning the neutral"#9e9e9e"whenever that sum is > 0; a sum of 0 keeps today's exact strings/colours byte-identically.Unchanged:
PROOF_MIN_DECISIONS,PROOF_SAMPLE_RECORDS,round3,buildProofAccuracy'spublished/insufficient_datashape,buildProofAnchorStatus,PROOF_BOUNDARY_STATEMENT, the allowlist-by-name privacy discipline, and theempty/broken/unavailableledger states.Tests (
test/unit/proof-summary.test.ts)reversal_revertedrows →accuracy: { state: "published", decided: 25, confirmed: 23, accuracy: 0.92 }(fails onmain, which publishes 1).accuracy: 1— the perfect case stays expressible.insufficient_data, never a fabricated rate.buildProofBadgeMessage/buildProofBadgeColorfor averifiedledger withwaivedUnchainedRecords: 231→"verified · 231 excluded"/"#9e9e9e"; the zero-excluded case keeps"verified · anchored"/"#3fb950".Validation
src/review/proof-summary.tsis 100% line and branch.npm run typecheckclean (the productionverifyLedgerbinding forwardsverifyDecisionLedger's full result, which already carries the three counts);engine-parity:drift-check,ui:openapi:checkandui-derived-types:checkall pass;dead-exports:checkclean; the suite (29 tests) green.git diff --checkclean; no migration (the reversal signal is already inaudit_events).Closes #10012