Model/tests/applications/modelling_e2e
Khalim Conn-Kowlessar de08d93369 Refresh a stale stored gov cert on a refetch when its content differs
refetch_epc=True fetched a fresh cert but the recency tie-break (strict >)
dropped it whenever the stored row shared the cert's inspection date — so a
row written before a schema field/table existed (e.g. room-in-roof geometry)
could never be healed by re-fetching. The dwelling was modelled on stale
fabric indefinitely.

Reconcile instead of just comparing dates: on an equal inspection date,
refresh a public gov cert (uploaded_file_id NULL) when the fetched cert
differs from the stored one, so a plain re-fetch re-ingests it. One of our
own surveys (PasHub / ECMK / Elmhurst — uploaded_file_id set) is preserved on
the tie, keeping the survey-wins rule (ADR-0001 / #1589); an unchanged public
cert is still not re-persisted.

`_reconcile_lodged` layers the content refresh over `_newer_lodged` (recency
untouched). New `EpcRepository.survey_lodged_uprns` surfaces the row-level
uploaded_file_id provenance the hydrated EpcPropertyData drops. Together with
the property_id-anchored persist, a refetch_epc=True re-run now heals both a
missing epc_property row and a stale one.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-27 14:34:26 +00:00
..
__init__.py process multiple properties in one message 2026-06-22 15:46:18 +00:00
test_handler.py Refresh a stale stored gov cert on a refetch when its content differs 2026-07-27 14:34:26 +00:00
test_predict_epc_errors.py feat(modelling_e2e): condition prediction on the expired Historic EPC (ADR-0054) 2026-07-14 11:15:39 +00:00
test_predict_epc_historic.py feat(modelling_e2e): condition prediction on the expired Historic EPC (ADR-0054) 2026-07-14 11:15:39 +00:00