'use strict'; /** * Which stats serve a calibrated number in the live pipeline. * * The rule this locks: a stat that cannot survive dropping a single settled date * was never calibrated — it was fitted to that date. hits WAS served calibrated * and is not any more, which is the honest consequence of measuring it. */ const snapshotService = require('../../src/services/snapshotService'); describe('the deployed set is LODO-gated', () => { it('serves the stats that passed LODO at the powered threshold', () => { expect(snapshotService.CALIBRATION_DEPLOYED).toContain('total_bases'); // hits was withdrawn at 6ae11f1 under a hand-chosen threshold that admitted // 20-row dates as evidence, and is restored here because the powered // instrument finds no reversal. Through the gate, not around it. expect(snapshotService.CALIBRATION_DEPLOYED).toContain('hits'); }); it('does NOT serve rbi or runs — both fail on dates ABOVE the threshold', () => { // These are DATE-DRIVEN failures, not underpowered ones: rbi reverses on a // 99-row date and runs on 86- and 244-row dates. No threshold rescues them. for (const stat of ['rbi', 'runs']) { expect(snapshotService.CALIBRATION_DEPLOYED).not.toContain(stat); } }); it('every deployed stat cleared the power-derived threshold, not a chosen one', () => { const { LODO_MIN_HELD_ROWS, LODO_THRESHOLD_BASIS } = require('../../src/services/model/calibrationRegistry'); expect(LODO_MIN_HELD_ROWS).toBe(70); expect(LODO_THRESHOLD_BASIS.derived_blind).toBe(true); // The reversing dates that keep rbi/runs out are all at or above it, so // their exclusion cannot be an artefact of the threshold. for (const n of [99, 86, 244]) expect(n).toBeGreaterThanOrEqual(LODO_MIN_HELD_ROWS); }); it('is frozen, so a stat cannot be added at runtime without a code change', () => { expect(Object.isFrozen(snapshotService.CALIBRATION_DEPLOYED)).toBe(true); expect(() => { snapshotService.CALIBRATION_DEPLOYED.push('hits'); }).toThrow(); }); });