'use strict'; /** * MODEL VERSION — ONE source, because two were not the same. * * ── WHAT WENT WRONG ────────────────────────────────────────────────────── * `ledgerService` and `retentionService` both read `process.env.MODEL_VERSION`, * and both carried a HARDCODED DEFAULT — but different ones: * * ledgerService.js:57 … || 'engine1@2026-07-20' * retentionService.js:59 … || 'engine1@2026-08-07-fullwindow' * * Production does not set the env var, so the two tables took different * defaults. The 2026-08-07 champion repair bumped one and left the other behind. * Result: `model_snapshots` carried the repaired marker on 34,128 rows while * `ledger_entries` carried the OLD marker on all 15,739 — including rows graded * by the repaired champion. * * That is not a cosmetic mismatch. `reAuditEligibility.isEligible` requires * `model_version === REPAIRED_CHAMPION_VERSION`, so applied to the ledger it * returned ZERO eligible rows and ZERO eligible dates, permanently, for all four * pending measurements. The accrual clock read "blocked" when the real state was * "mis-stamped". * * ── THE RULE ───────────────────────────────────────────────────────────── * There is exactly one place a model version may be declared. Anything that * stamps a row imports it from here. A default that lives next to its consumer * will drift from the other consumer, and the drift is invisible because both * sides look locally correct. * * ── WHAT THIS DOES NOT DO ──────────────────────────────────────────────── * It does not re-stamp history. Rows already written keep the marker they were * written with — rewriting them would destroy the one record of which forecast * actually produced them, which is the thing the marker exists to preserve. Old * rows stay honestly old; a backfill is a separate, explicit decision. */ /** The version every NEW row is stamped with. Override with MODEL_VERSION. */ const MODEL_VERSION = process.env.MODEL_VERSION || 'engine1@2026-08-07-fullwindow'; /** * Rows at or after this marker were produced by the repaired champion and are * eligible for forward re-audit. * * Deliberately NOT `MODEL_VERSION`: the eligibility bar is a fixed historical * fact about a specific repair, and tying it to "whatever we stamp today" would * make every future version silently re-qualify itself. */ const REPAIRED_CHAMPION_VERSION = 'engine1@2026-08-07-fullwindow'; /** The marker that preceded the repair — kept so old rows are nameable. */ const PRE_REPAIR_VERSION = 'engine1@2026-07-20'; module.exports = { MODEL_VERSION, REPAIRED_CHAMPION_VERSION, PRE_REPAIR_VERSION };