The interface was about to restore the lie: null confidence rendered as 0%
The backend already refuses to state a probability it cannot certify. The card
did not. `gradeAdapter.js:59` read
input.confidence != null ? Math.round(Number(input.confidence)) : 0
and `GradeResultCard` printed `{d.confidence}% confidence` unconditionally, so
an UNCERTIFIED Read — which by contract carries no exact probability — would
have rendered "0% CONFIDENCE" to a user. That is `Number(null) === 0`, the
standing fabrication bug in this codebase, arriving at the last surface before
the eye.
Found by running two REAL production rows (model_snapshots 453021 and 453033
from proven cohort 27ce152f) through the real serving seam and the real adapter,
before rendering anything.
Repaired at the two places it lives, presentation only:
- the adapter carries null through instead of coercing;
- the card renders "Confidence unavailable" as TEXT when there is no number.
Wording follows the house pattern already in `readHistory.js` ("History
unavailable") — no dash, no dimmed zero, no icon-only state, and no engineering
language: a test forbids isotonic / artifact / probability_contract /
UNCERTIFIED / certification_version reaching the card.
A second, narrower correction: the derived-field withdrawal was
`if (f in out) out[f] = null`, so it depended on whether the input happened to
carry the key and a field added by a later merge would have arrived
un-withdrawn. An uncertified row now DECLARES each probability-derived claim
null rather than merely lacking it.
The uncertified fixture is the strong case, not a convenient one: Luis Robert
carries value:true and ev_pct 38.5 on the raw row, so the contract has a live
VALUE badge to withdraw rather than an absent one to leave absent. Verified
withdrawn, while grade B+, the side, the Read and the market (book -160,
fair -135) all survive.
The certified case moves the number materially and visibly: raw 0.798 -> served
0.638, and EV is recomputed from the served probability, not carried from raw.
PriceTriplet needed no change — it already renders an absent leg as a dash and
was documented never to print a zero.
Suite 407/407, 5,691 passed. Teeth 45/45 + 10/10 + 23/23. Live OFF.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CQJeAG8vcDoL5zkiaJyVb8
This commit is contained in:
@@ -40,7 +40,9 @@ export interface GradeResultData {
|
||||
line: number;
|
||||
side: 'Over' | 'Under';
|
||||
grade: string;
|
||||
confidence: number;
|
||||
/** Null when the serving contract has no certified probability for this Read.
|
||||
* Rendered as an explicit unavailable state, never as a number. */
|
||||
confidence: number | null;
|
||||
edge: number | null;
|
||||
projection: number | null;
|
||||
phosphorConfirmed?: boolean;
|
||||
@@ -202,7 +204,11 @@ export default function GradeResultCard({
|
||||
user-facing claim is withdrawn until a real price-aware edge (ev_pct) is
|
||||
live. See specs/edge-pct-display-retirement.md. */}
|
||||
<span style={{ color: 'rgba(232,255,244,.4)', margin: '0 9px' }}>·</span>
|
||||
<span>{d.confidence}% confidence</span>
|
||||
{/* An uncertified Read has no exact probability. Say so in words —
|
||||
a dimmed number, a dash or a 0 would each read as a value. */}
|
||||
{d.confidence != null
|
||||
? <span>{d.confidence}% confidence</span>
|
||||
: <span style={{ color: 'rgba(232,255,244,.55)' }}>Confidence unavailable</span>}
|
||||
</div>
|
||||
|
||||
{d.phosphorConfirmed && (
|
||||
|
||||
@@ -56,7 +56,14 @@ function mapScanToGradeResult(input = {}) {
|
||||
const side = direction === 'under' ? 'Under' : 'Over';
|
||||
const line = input.line != null ? Number(input.line) : 0;
|
||||
const projection = input.projection != null ? Number(input.projection) : undefined;
|
||||
const confidence = input.confidence != null ? Math.round(Number(input.confidence)) : 0;
|
||||
// NULL IS NOT ZERO. Under the certified serving contract an UNCERTIFIED Read
|
||||
// carries no exact probability, so `confidence` arrives null — and coercing
|
||||
// that to 0 made the card render "0% confidence", which states a number the
|
||||
// model explicitly declined to give. `Number(null) === 0` is the standing
|
||||
// fabrication bug in this codebase; this was one.
|
||||
const confidence = input.confidence != null && Number.isFinite(Number(input.confidence))
|
||||
? Math.round(Number(input.confidence))
|
||||
: null;
|
||||
const tier = input.tier || 'free';
|
||||
const includeAlt = tier === 'desk';
|
||||
// Tier gating so the new card doesn't give paid content away (free users get
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user