docs: session-6 handover — community fuel collision (waste/biomass/biogas) fixed gated on heat-network

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-08 21:56:56 +00:00
parent a7761ea83f
commit e1adc8d3d5

View file

@ -13,15 +13,47 @@ deproven approaches + the meter/shower data-fidelity findings), and the earlier
`energy_rating_current`. Headline gauge:
`PYTHONPATH=/workspaces/model python scripts/eval_api_sap_accuracy.py`.
| metric | session-3 (`a8e5563a`) | session-4 (`faf29942`) | **session-5 (`19235d11`)** |
|--------|------------------|------------------|------------------|
| **% \|err\| < 0.5** | 45.1% | 47.6% | **53.1%** |
| % \|err\| < 1.0 | 59.4% | 62.6% | **68.0%** |
| % \|err\| < 2.0 | 77.7% | 79.6% | **~81%** |
| mean \|err\| | 1.702 | 1.586 | **1.329** |
| median \|err\| | — | — | **0.467** |
| computed / raises | 909 / 0 | 909 / 0 | **909 / 0** |
| unsupported_schema | 100 (deferred) | 100 (deferred) | 100 (deferred) |
| metric | session-3 (`a8e5563a`) | session-4 (`faf29942`) | session-5 (`19235d11`) | **session-6 (`a7761ea8`)** |
|--------|------------------|------------------|------------------|------------------|
| **% \|err\| < 0.5** | 45.1% | 47.6% | 53.1% | **53.14%** |
| % \|err\| < 1.0 | 59.4% | 62.6% | 68.0% | **67.99%** |
| % \|err\| < 2.0 | 77.7% | 79.6% | ~81% | **81.85%** |
| mean \|err\| | 1.702 | 1.586 | 1.329 | **1.312** |
| median \|err\| | — | — | 0.467 | **0.467** |
| computed / raises | 909 / 0 | 909 / 0 | 909 / 0 | **909 / 0** |
| unsupported_schema | 100 (deferred) | 100 (deferred) | 100 (deferred) | 100 (deferred) |
### SESSION-6 — community fuels 30/31/32 collide with electricity codes, `a7761ea8`
Picked up the deferred "fuel-collision part 2". The profiler's strongly-biased
`main_control=2306` bucket (n=11, signed 3.75, nearly uniform) was a PROXY: every
cert in it is `sap_main_heating_code=301` (community heating). ROOT: gov-API
`main_fuel_type` codes **30=waste-combustion / 31=biomass / 32=biogas** (all
"(community)" in `epc_codes.csv`) collide in VALUE with the Table-32 electricity
codes 30 (standard) / 31 (7h-low) / 32 (7h-high). All three sit in
`_ELECTRIC_FUEL_CODES`, so `is_electric_fuel_code` flagged a community-scheme main as
electric and `_is_electric_main` routed its cost through the off-peak electricity
branch — BYPASSING `_heat_network_factor_fuel_code`. Cert 8536 (biomass community)
billed 5.5 p grid electricity instead of the 4.24 p heat-network rate → 17.2 SAP.
Per SAP 10.2 Table 12 the community waste/biomass/biogas rows are 42/43/44 (the same
rows the backwards-compat enum codes 11/12/13 already map to). Added 30→42, 31→43,
32→44 to `API_FUEL_TO_TABLE_12` + `API_FUEL_TO_TABLE_32`.
**CRITICAL — the remap is GATED, NOT global.** A prototype putting 30/31/32 in
`canonical_fuel_code` regressed certs 2211 (+16 SAP) and 3420 (+7): the cascade uses
the bare Table-32 code 30 internally as `_STANDARD_ELECTRICITY_FUEL_CODE` (the RdSAP
no-water-heating whc=999 immersion default writes `water_heating_fuel=30`), so a
blanket remap mis-prices genuine grid electricity as community waste. New
`_heat_network_community_fuel_code(fuel, main)` translates only when
`_is_heat_network_main(main)` is true, wired into `_main_fuel_code` AND
`_water_heating_fuel_code` (water gated via `_water_heating_main(epc)`).
**STRICT-RAISE (user-requested):** a heat-network main lodging a colliding community
fuel the table doesn't cover raises `UnmappedSapCode` rather than silently falling
through to the same-numbered electricity code (currently can't fire — all of
{30,31,32} are mapped — but guards future community fuels 56/57/58/99). Cert 8536
17.25 → 6.51 (residual now flat fabric), 5036 6.29 → +1.36; mean|err|
1.329→1.312, within-1.0/2.0 up, within-0.5 held. 3 AAA tests, regression green
(only pre-existing 2 stone-wall U + a flaky historic-epc ordering test), pyright
net-zero. **STILL DEFERRED: dual-fuel API-9; the per-cert FABRIC tail (8536's 6.5
is now flat fabric, 2100 demand 110905); the 100 unsupported-schema certs.**
### SESSION-5 — fuel-code collision (anthracite/coal), `19235d11`
The re-audit traced the cohort's WORST cert (2100 anthracite, 61) + the 20/21 coal cluster to