Model/tests/infrastructure/epc_client
Khalim Conn-Kowlessar 85fe51b623 Reclassify terraced room-in-roof gables as party, not external
A mid-terrace / enclosed-mid-terrace (built_form 4/6) has external walls on
its two opposite (front/rear) faces only (RdSAP 10 §1.1, p.7-8); both end/
gable elevations — and their room-in-roof continuations — abut a neighbour
and are party walls (§1.4.3, p.9). The gov-API path is built_form-blind, so a
cert lodging an "Exposed" RR gable (`gable_wall_type=1`) on such a form had it
billed at the masonry main-wall U (~2.5) instead of the party 0.25 (Table 4,
p.22), over-counting fabric heat loss and under-rating the dwelling.

`_api_type_1_gable_kind` now takes `built_form` and reclassifies an Exposed RR
gable to Party on the both-ends-party forms {4, 6} only; end-terrace {3, 5},
semi {2} and detached {1} keep their genuine exposed gable. The API path lodges
no per-gable U, so this only ever overrides a cascade fallback.

Corroborated three ways: RdSAP §1.1 + Table 4; S10TP-05 Appendix A (a
mid-terrace's roof-gable junction length is zero); and three accredited
Elmhurst mid-terrace worksheets (000477/000480/000516), which all lodge Party
gables. Those worksheets run the site-notes path (already correct) so the 195
Elmhurst pins are untouched.

Corpus (RdSAP-21.0.1, 1000 certs): within-0.5 78.8% -> 79.5%, SAP MAE
0.625 -> 0.599, PE MAE 2.85 -> 2.71, CO2 MAE 0.070 -> 0.068. Cert
100040550095 -10.13 -> +0.37; the 18-cert terraced-external-gable cohort mean
-1.94 -> +0.11; end-terrace/semi/detached untouched. Thresholds ratcheted.

Tests: new test_mapper_rir_gable_terraced (9); 195 Elmhurst pins, 288
cert_to_inputs/real-cert pins, 54 mapper tests, and the corpus gauge all green;
no new pyright errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 09:32:42 +00:00
..
__init__.py python upgraded due to enum 2026-06-12 15:47:28 +00:00
conftest.py python upgraded due to enum 2026-06-12 15:47:28 +00:00
test_client.py docs(adr): record nearby-postcode broadening (0034) + share HTTP retry primitive 2026-06-23 16:54:06 +00:00
test_mapper_corpus.py python upgraded due to enum 2026-06-12 15:47:28 +00:00
test_mapper_dispatcher.py Unsupported EPC schema versions are skipped with a warning, not a crash 2026-07-10 11:17:07 +00:00
test_pv_battery_sap_neutrality.py test(pv-battery): pin SAP cost-neutrality on export-capable standard tariff 2026-06-14 09:51:34 +00:00
test_sap_accuracy_corpus.py Reclassify terraced room-in-roof gables as party, not external 2026-07-17 09:32:42 +00:00