'use strict'; /** * Which stats serve a calibrated number, and on what basis. * * The claim that survived on this sample is the bias DIRECTION, tested model-free * and map-free. What did not survive is any certification of a specific map's * stability. These lock that distinction into the serving path. */ const snapshotService = require('../../src/services/snapshotService'); const lp = require('../../src/services/model/lowParamCalibrator'); describe('the deploy set rides a low-parameter correction, not isotonic', () => { it('serves the two stats whose correction beat RAW out-of-sample', () => { expect(snapshotService.CALIBRATION_DEPLOYED).toEqual(['hits', 'total_bases']); }); it('WITHDRAWS rbi — the low-parameter fit does not beat raw', () => { // rbi was deployed at ced4042 on isotonic. Its CI vs raw is [-0.0007, 0], // which touches zero, so it serves raw again. expect(snapshotService.CALIBRATION_DEPLOYED).not.toContain('rbi'); }); it('does NOT serve runs — its fitted slope would invert the forecast', () => { expect(snapshotService.CALIBRATION_DEPLOYED).not.toContain('runs'); }); it('labels the basis honestly: direction robust, magnitude provisional', () => { for (const stat of snapshotService.CALIBRATION_DEPLOYED) { expect(snapshotService.CALIBRATION_BASIS[stat]).toBe('direction_robust_magnitude_provisional'); } }); it('the served correction cannot encode a single odd day', () => { // Two parameters over the whole curve is the entire reason for the swap. expect(typeof lp.fitPlatt).toBe('function'); expect(lp.MIN_SLOPE).toBeGreaterThan(0); }); it('is frozen, so a stat cannot be added at runtime', () => { expect(Object.isFrozen(snapshotService.CALIBRATION_DEPLOYED)).toBe(true); expect(() => { snapshotService.CALIBRATION_DEPLOYED.push('rbi'); }).toThrow(); }); });