Intraday is a market overlay: it may not restate belief

`grade` is a band label over `p_win` and nothing else. `servedGrade.gradeFor`
reads exactly { p_win, refused, refusal_reason, insufficient_data,
factor_adjustment } -- no line, no odds, no edge, no side -- and
`gradeFreeze.TOLERANCES.MAX_LETTER_MISMATCH` is 0, so the served letter MUST
equal the band of the served probability.

The intraday refresh re-graded an adversely-moved prop AT THE CURRENT LINE and
then copied only `res.grade` onto the row for the LOCKED line, discarding the
p_win that produced it. Two defects in one write: the letter stopped matching
the probability beside it, and the letter answered a different proposition than
the claim it was stamped on.

MEASURED on ledger_entries in the current model era
(engine1@2026-08-07-fullwindow): 30,047 unrevised rows carry ZERO letter/p_win
mismatches; all 9 intraday-revised rows are mismatched. The revision was the
sole producer of incoherent authoritative rows. The pre-cutover era is
uninterpretable here (its `grade` was the engine index, not a p_win band, and
mismatches 49.4% of the time WITHOUT any revision) -- which is exactly why the
control was run before quoting a rate.

Simulated over the 57 historical revisions: in the current era, keeping the
published grade restores coherence on 9 of 9.

So the adverse branch now records the move and stops there. No grader is
invoked, no ledger revision is applied, and the grade-rank comparator is
deleted rather than parked -- a dead comparator beside the code is how the
mutation gets re-wired. A production coherence gate compares every output row
to its input on every BELIEF field and, on any divergence, publishes the
untouched slate instead.

History is untouched: the 57 existing `revised_from_grade` rows keep their
values, and the UI that renders them is unchanged. Forward-only.

Lineage is not touched and stays 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:
Kev
2026-08-28 18:48:07 -04:00
parent f7cc19772b
commit 889a96584a
4 changed files with 451 additions and 96 deletions
+31 -37
View File
@@ -1,7 +1,8 @@
// Session 60 (night2/D) — Phase 2.5 intraday refresh. Direction is the
// signal: WITH the grade = STEAM (no re-grade); AGAINST ≥1.0 = re-grade
// that prop only (holds → VALUE, drops → PUBLIC revision). All lines are
// real feed values; the refresh recaptures the close.
// Session 60 (night2/D) — Phase 2.5 intraday refresh, as amended by the
// INTRADAY BELIEF INTEGRITY repair. Direction is still the signal: WITH the
// grade = STEAM, AGAINST = recorded with its signed delta. The re-grade branch
// is GONE — `grade` is a band label over p_win, so a market move may not
// restate it. All lines are real feed values; the refresh recaptures the close.
const { runIntradayRefresh, inSlateHours, __internals } = require('../../src/services/intradayRefreshService');
const { signedDelta, trackHistory, HISTORY_CAP } = __internals;
@@ -50,7 +51,7 @@ describe('runIntradayRefresh — directional handling', () => {
test('moved WITH the grade → STEAM, NO re-grade', async () => {
const { deps, store, calls } = harness({ grades: [GRADE], oddsProps: [prop(1.5)], analyzeResult: null });
const res = await runIntradayRefresh('mlb', deps);
expect(res).toMatchObject({ status: 'ok', steam: 1, value: 0, revised: 0 });
expect(res).toMatchObject({ status: 'ok', steam: 1, against: 0, belief_mutations: 0 });
expect(calls.analyze).toHaveLength(0); // steam never re-grades
const snap = store.get('snapshot:mlb:latest');
expect(snap.grades[0].movement).toMatchObject({ kind: 'steam', delta: 1, currentLine: 1.5 });
@@ -58,50 +59,43 @@ describe('runIntradayRefresh — directional handling', () => {
expect(calls.ticker[0].text).toContain('o0.5 → o1.5');
});
test('moved AGAINST ≥1.0, re-grade HOLDS → VALUE (better entry)', async () => {
test('moved AGAINST >= 1.0 records the move and NEVER re-grades', async () => {
const { deps, store, calls } = harness({
grades: [{ ...GRADE, gradedAt: { line: 2.5, odds: -110, timestamp: NOW }, line: 2.5 }],
oddsProps: [prop(1.5)],
analyzeResult: { grade: 'A', confidence: 70 }, // same grade at the new line
analyzeResult: { grade: 'C', confidence: 40, p_win: 0.31 },
});
const res = await runIntradayRefresh('mlb', deps);
expect(res).toMatchObject({ value: 1, revised: 0 });
expect(calls.analyze).toHaveLength(1);
expect(calls.analyze[0].line).toBe(1.5); // re-graded at the REAL current line
expect(store.get('snapshot:mlb:latest').grades[0].movement.kind).toBe('value');
expect(res).toMatchObject({ against: 1, belief_mutations: 0 });
// The grader is never consulted. Injecting one and finding it untouched is
// the point: the torn state is unreachable, not merely unwritten.
expect(calls.analyze).toHaveLength(0);
expect(calls.revisions).toHaveLength(0);
});
test('moved AGAINST ≥1.0, grade DROPS → PUBLIC revision (original preserved)', async () => {
const { deps, store, calls } = harness({
grades: [{ ...GRADE, gradedAt: { line: 2.5, odds: -110, timestamp: NOW }, line: 2.5 }],
oddsProps: [prop(1.5)],
analyzeResult: { grade: 'C', confidence: 40 },
});
const res = await runIntradayRefresh('mlb', deps);
expect(res).toMatchObject({ revised: 1 });
const g = store.get('snapshot:mlb:latest').grades[0];
expect(g.grade).toBe('C');
expect(g.revised_from_grade).toBe('A'); // the original, forever
expect(calls.revisions[0]).toMatchObject({ newGrade: 'C', fromGrade: 'A', line: 2.5, side: 'over' });
expect(g.movement).toMatchObject({ kind: 'against', delta: -1, currentLine: 1.5 });
expect(g.grade).toBe('A');
expect(g.revised_from_grade).toBeUndefined();
});
test('a second drop keeps the ORIGINAL revised_from_grade', async () => {
test('a favourable grade the old branch would have adopted is still refused', async () => {
const { deps, store, calls } = harness({
grades: [{ ...GRADE, grade: 'C', gradedAt: { line: 2.5, odds: -110, timestamp: NOW }, line: 2.5 }],
oddsProps: [prop(1.5)],
analyzeResult: { grade: 'B+', confidence: 82, p_win: 0.81 },
});
await runIntradayRefresh('mlb', deps);
expect(calls.analyze).toHaveLength(0);
expect(store.get('snapshot:mlb:latest').grades[0].grade).toBe('C');
});
test('a row already carrying a historical revised_from_grade is left alone', async () => {
const already = { ...GRADE, grade: 'B', revised_from_grade: 'A', gradedAt: { line: 2.5, odds: null, timestamp: NOW }, line: 2.5 };
const { deps, store } = harness({ grades: [already], oddsProps: [prop(1.5)], analyzeResult: { grade: 'C' } });
await runIntradayRefresh('mlb', deps);
expect(store.get('snapshot:mlb:latest').grades[0].revised_from_grade).toBe('A');
});
test('an insufficient re-read HOLDS the original grade (never blanks it)', async () => {
const { deps, store } = harness({
grades: [{ ...GRADE, gradedAt: { line: 2.5, odds: null, timestamp: NOW }, line: 2.5 }],
oddsProps: [prop(1.5)],
analyzeResult: { grade: null, insufficient_data: true },
});
const res = await runIntradayRefresh('mlb', deps);
expect(res.value).toBe(1);
expect(store.get('snapshot:mlb:latest').grades[0].grade).toBe('A');
const g = store.get('snapshot:mlb:latest').grades[0];
// History is preserved verbatim — the repair is forward-only.
expect(g.revised_from_grade).toBe('A');
expect(g.grade).toBe('B');
});
test('prop gone from the feed → frozen untouched; close recaptured every run', async () => {