Merge pull request #1362 from Hestia-Homes/audit/portfolio-796-scenario-1268

docs(audit): record stale-default-plan expectation + default-plan-only rule
This commit is contained in:
Daniel Roth 2026-06-30 08:36:29 +01:00 committed by GitHub
commit 398016505d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -114,9 +114,27 @@ durable, compounding output of every audit.
## Notes
- Read-only on the DB. `run_modelling_e2e` is a dry run.
- **Audit the default plan only** — every check, and every characterisation
query, must filter `plan.is_default = TRUE` (the FE-shown plan). The runner's
`_QUERY`/`_ROLLUP_QUERY` already do; keep ad-hoc SQL consistent or the counts
mix superseded plans into the picture.
- **The stored default plan can be STALE vs the live model** — the persisted plan
is the output of an *earlier* modelling run; `run_modelling_e2e` re-models
against current logic + live EPC/solar. A stored-vs-live gap is the single
biggest driver of MEDIUM/HIGH anomalies on a not-yet-re-modelled portfolio, and
it spans more checks than the one below names. The fix is operational
(**re-model the portfolio, then re-audit**), not a code change — confirm a
sample with `run_modelling_e2e` before debugging the calculator.
- **Expected, not bugs** (until the override-aware-rebaseline + persistence-fidelity
PR deploys and the portfolio is re-modelled): much of `zero-works-post-differs`
and `plan-score-below-baseline` is the pre-fix baseline-vs-plan divergence and
should shrink after re-model — note it, don't re-debug it.
work — see `docs/adr/` — is re-modelled into the portfolio): much of
`zero-works-post-differs`, `plan-score-below-baseline`, `already-meets-goal-with-works`,
and the non-fuel-switch slice of `negative-bill-savings` is the same stale
stored-plan-vs-live divergence and should shrink after re-model — note it,
don't re-debug it. Confirm a sample's stored plan differs from `run_modelling_e2e`
(stored `air_source_heat_pump` for tens of £k where the live plan is a cheap
profitable `solar_pv`; stored works on a property the live model leaves at £0
because it already meets goal). The `negative-bill` certs that DO carry an
`air_source_heat_pump` are a genuine gas→electric fuel-switch (bills rise at
current price ratios) — expected by design.
- Adding a check is one decorated `(PropertyAudit) -> Optional[str]` function in
`scripts/audit/anomalies.py`; see its module docstring.