docs: handover post S0380.141..145

Five slices closing pcdb 1 (+6.95→+0.57 via §9.4.11 + §4 cylinder
gates + RdSAP10 Table 29) and the electric storage cluster (e3/e6/e7
+2.5/+1.3 SAP → <0.21 each via Table 4e (92)m→(93)m). Cumulative
|ΔSAP| 18.0 → 12.2 (-32%). Open fronts ranked + spec-source index.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-05-31 21:55:53 +00:00
parent b1478cff63
commit 1636cfbc83

View file

@ -0,0 +1,247 @@
# Handover — post Slices S0380.141..145
Branch: `feature/per-cert-mapper-validation`. **HEAD `b1478cff`**.
Predecessor: [`HANDOVER_POST_S0380_143.md`](HANDOVER_POST_S0380_143.md).
## TL;DR
Five slices landed on top of `8ee877e4` this session, all driven by
the user clarification "target is ΔSAP_c = 0 vs worksheet at 1e-4,
not 0.5". Cumulative impact closed pcdb 1 from SAP +6.95 → +0.57
(via S0380.141..143) and closed the electric storage cluster
(e3/e6/e7/e2) to <0.21 SAP each (via S0380.145).
| Slice | Commit | Scope |
|---|---|---|
| S0380.141 | `6636f1c3` | SAP 10.2 §9.4.11 -5pp boiler-interlock applied to BOTH SH eff AND PCDB Eq D1 (was DHW scalar only). |
| S0380.142 | `7f9074fc` | SAP 10.2 §4 line 7702 + Table 3 cylinder-presence gates: combi_loss=0 when cylinder lodged + primary_loss applies for PCDB Table 322 boilers. Golden cert 0390 re-pinned. |
| S0380.143 | `eda6f449` | RdSAP 10 §10.11 Table 29 (p.56) — inaccessible-cylinder insulation defaults: age G/H → 25mm foam, I-M → 38mm foam, A-F → loose-jacket strict-raise. |
| S0380.144 | `ec6661cb` | SAP 10.2 Table 11 — per-Table-4a-code dispatch for electric storage sec_frac (401/402/403/405/406 → 0.15, 404/407 → 0.10). Remove 408 from `_FORCE_SECONDARY_FOR_MAIN_CODES` per §A.2.2. Cost-invariant for off-peak certs (legacy scalar path billing main and secondary at same rate). |
| **S0380.145** | **`b1478cff`** | **SAP 10.2 Table 4e (p.170-173) "Temperature adjustment, °C" applied to (92)m → (93)m per Table 9c step 8. 52-entry dispatch dict covering all 8 control groups. Closes e3 +2.55→-0.09, e6 +1.33→-0.17, e7 +1.29→-0.20, e2 +0.47→-0.18. e5 regressed +0.07→-1.43 (was net-zero from offsetting bugs).** |
Extended handover suite at HEAD: **888 pass, 0 fail.**
## Current residual state at HEAD `b1478cff`
### Cascade-OK tier (25 variants on pin grid) — sorted by |ΔSAP_c|
| Variant | SAP code | ΔSAP_c | Δcost | ΔPE | Notes |
|---|---:|---:|---:|---:|---|
| solid fuel 6 | 160 | +0.03 | -£0.65 | +45 | |
| electric 1 | 191 | -0.06 | +£1.32 | +94 | |
| solid fuel 8 | 160 | -0.08 | +£1.85 | +45 | |
| **electric 3** | **401** | **-0.09** | **+£2.01** | **+82** | closed via S0380.145 |
| solid fuel 7 | 160 | +0.10 | -£2.33 | +17 | |
| electric 9 | 421 | -0.12 | +£2.72 | +91 | |
| solid fuel 10 | 634 | -0.16 | +£3.70 | +67 | |
| solid fuel 5 | 153 | -0.17 | +£3.81 | +93 | |
| **electric 6** | **404** | **-0.17** | **+£3.91** | **+103** | closed via S0380.145 |
| electric 2 | 524 | -0.18 | +£4.24 | +393 | closed via S0380.145; PE outlier remains |
| solid fuel 9 | 636 | -0.20 | +£4.51 | +93 | |
| **electric 7** | **408** | **-0.20** | **+£4.71** | **+113** | closed via S0380.145 |
| ashp | — | +0.24 | -£5.57 | -12 | (closed) |
| solid fuel 11 | 634 | -0.26 | +£6.07 | +104 | |
| electric 8 | 409 | -0.26 | +£5.92 | +126 | |
| solid fuel 4 | 633 | -0.29 | +£6.73 | +90 | |
| oil pcdb 1/2 | (PCDB) | +0.42 | -£9.77 | -84 | (closed) |
| pcdb 1 | (PCDB oil) | +0.57 | -£12.55 | -109 | closed via S0380.141..143 |
| gshp | — | +1.15 | -£26.48 | -455 | open |
| oil pcdb 3 | (PCDB) | +1.16 | -£26.72 | -271 | open |
| solid fuel 3 | 160 | +1.32 | -£30.45 | -935 | PE outlier |
| **electric 5** | **402** | **-1.43** | **+£32.85** | **+535** | regressed by S0380.145 |
| solid fuel 2 | 158 | +2.64 | -£60.79 | -1211 | PE outlier |
| **oil 1** | **(Table 4b)** | **+2.66** | **-£61.24** | **-1050** | open: non-PCDB oil HW eff |
Σ |ΔSAP_c| across 25 variants ≈ **12.2 SAP points** (was 18.0 pre-
session, **-32%** progress).
### Blocked tier (16 variants — `MissingMainFuelType`)
Unchanged from previous handover. Categories: community heating × 5,
electric storage 11-14, no system, oil 2-6, pcdb 3.
## Next-slice candidates ranked by leverage
### 1. **oil 1 SAP +2.66 / cost -£61 / PE -1050** — biggest open variant
Table 4b oil boiler (code 127, eff 84%) with cylinder lodged +
Boiler Interlock=Yes per cert. The §9.4.11 -5pp interlock fix from
S0380.141 doesn't apply (interlock present).
Cascade HW kWh 2785 vs worksheet 3639. Worksheet effective HW
efficiency ≈ 65% suggests:
- Summer/winter blend the cascade isn't applying for non-PCDB oil
boilers per SAP 10.2 Appendix D §D2.1
- Or a Table 4b row that lodges separate HW efficiency
Probe needed before implementing. Spec target: SAP 10.2 Appendix D
or Table 4b HW eff row.
### 2. **electric 5 SAP -1.43** — regressed by S0380.145
Pre-S0380.145 was +0.07 (close to zero from offsetting bugs: cascade
SH was under by 236 kWh, missing the +0.4 K Table 4e adjustment that
would have added ~484 kWh). Post-slice with +0.4 K applied: cascade
now OVER worksheet by ~248 kWh.
Root cause: there's a residual cascade-SH OVER-count for electric 5
specifically that S0380.145 exposed. Likely §9 MIT calc for
fan-assisted storage heater R=0.40 (Table 4a code 402) OR Table 9b
Tsc formula divergence for the specific (R, control_type) pair.
### 3. **solid fuel 2 (+2.64) / 3 (+1.32) PE -935..-1211** — anthracite outliers
Both Table 4a codes 158/160. Distinct cause from oil 1 (no PCDB,
solid fuel). Per-variant probe required. Likely Table 4b solid-fuel
efficiency row, Table 4f auxiliary energy, or §9 anthracite-specific
secondary fraction.
### 4. **gshp +1.15, oil pcdb 3 +1.16** — mid-tier
Each needs its own probe. gshp is heat-pump PCDB Table 362 dispatch;
oil pcdb 3 is gas/oil PCDB Table 322 with different boiler model.
### 5. **community heating unblocking (5 variants)** — sizable
Extend extractor to capture §14.1 Community Heating block
(heat-network codes 41-58). Each cert maps to a Table 32
heat-network code via the lodged heat source type.
### 6. **Electric storage unblocking (variants 11-14)** — small
Extend `_ELMHURST_MAIN_HEATING_EES_TO_FUEL_CODE` for EES codes WEA,
REA, OEA.
## Important diagnostic findings from this session
1. **The "+2.5 SAP cluster" was heterogeneous**, NOT a single shared
cause. Per-variant probing was essential. The Table 4e fix
(S0380.145) closed electric 3/6/7 to <0.21 SAP each; oil 1 +
solid fuel 2 remain open with separate drivers.
2. **Off-peak electric certs route through `_ZERO_FUEL_COST_FOR_OFF_
PEAK`** sentinel + legacy scalar cost math. Main and secondary
are billed at the SAME off-peak low rate (7.41 p/kWh), so changes
to sec_frac don't affect cost / SAP for these certs. Only CO2 /
PE shift. Discovered while implementing S0380.144.
3. **Coincidence-zero closures are NOT real closures.** electric 5
was +0.07 pre-S0380.145, which looked like "near-closure". It was
actually two opposing bugs canceling. The spec-correct Table 4e
fix exposed the underlying SH-demand divergence (-1.43). Per
zero-error strict: chase the spec, not the residual sign.
4. **Cascade SH demand undercount on electric storage certs** was
the driver, not Table 11 sec_frac. Table 4e (92)m→(93)m
adjustment was the missing spec piece. After S0380.145 the
remaining undercount for electric 5 specifically is small enough
that overshooting now matters.
## Standard slice workflow
1. Read spec page + identify rule
2. Probe one cluster variant; verify diagnosis via monkey-patch
3. Write failing AAA test (literal `# Arrange / # Act / # Assert`)
4. Implement helper / dispatch entry / mapper extension
5. Re-pin affected variants (DO NOT widen tolerance)
6. Run extended handover suite (command below)
7. Pyright net-zero check (`git stash` → pyright → `git stash pop`
pyright)
8. Commit with spec citation +
`Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>`
9. Update `project-heating-systems-corpus` + `MEMORY.md` index
## Test baseline at HEAD `b1478cff`
```bash
PYTHONPATH=/workspaces/model python -m pytest \
backend/documents_parser/tests/test_summary_pdf_mapper_chain.py \
backend/documents_parser/tests/test_heating_systems_corpus.py \
backend/documents_parser/tests/test_elmhurst_extractor.py \
backend/documents_parser/tests/test_elmhurst_end_to_end.py \
domain/sap10_calculator/worksheet/tests/test_e2e_elmhurst_sap_score.py \
domain/sap10_calculator/worksheet/tests/test_heat_transmission.py \
domain/sap10_calculator/worksheet/tests/test_internal_gains.py \
domain/sap10_calculator/worksheet/tests/test_solar_gains.py \
domain/sap10_calculator/worksheet/tests/test_dimensions.py \
domain/sap10_calculator/worksheet/tests/test_rating.py \
domain/sap10_calculator/worksheet/tests/test_ventilation.py \
domain/sap10_calculator/worksheet/tests/test_appendix_h_solar.py \
domain/sap10_calculator/worksheet/tests/test_mev.py \
domain/sap10_calculator/rdsap/tests/test_cert_to_inputs.py \
domain/sap10_calculator/rdsap/tests/test_golden_fixtures.py \
domain/sap10_calculator/tests/test_pcdb_table_322_lookup.py \
domain/sap10_calculator/tests/test_pcdb_table_329_lookup.py \
domain/sap10_calculator/tests/test_table_12a.py \
--no-cov -q
```
Expected: **888 pass, 0 fail**.
## Memories to load (in order)
```
project-heating-systems-corpus # HEAD b1478cff
feedback-sap-10-2-only-never-10-3 # CRITICAL — never reference SAP 10.3
feedback-worksheet-not-api-reference
feedback-spec-citation-in-commits
feedback-verify-handover-claims
feedback-zero-error-strict # TARGET: ΔSAP_c < 1e-4 vs worksheet
feedback-commit-per-slice
feedback-aaa-test-convention
feedback-e2e-validation-philosophy
feedback-abs-diff-over-pytest-approx
feedback-spec-floor-skepticism
feedback-golden-residuals-near-zero
feedback-one-e-minus-4-across-the-board
reference-unmapped-sap-code # updated S0380.145
reference-unmapped-api-code
project-oil-price-spec-divergence
```
## What NOT to do
- **Don't reference SAP 10.3** — track 10.2 deliberately
- **Don't widen pin tolerances** to make pins pass — re-pin smaller
or find the spec gap
- **Don't re-investigate Slices .91..145** — all settled
- **Don't add new helpers to `domain/sap10_ml/`** — on deprecation
path
- **Don't treat ΔSAP=0.07 as "closed"** — it might be offsetting
bugs. Target is < 1e-4 vs worksheet.
- **Don't follow the previous handover's "shared cluster cause"
framing** — S0380.144/.145 confirmed each of the original +2.5
SAP cluster members has a distinct driver.
## Spec source quick-reference
All under `domain/sap10_calculator/docs/specs/`:
- **SAP 10.2 full spec**: `sap-10-2-full-specification-2025-03-14.pdf`
- **§4** (p.135-137) — water heating worksheet (45..65),
Tables 2/2a/2b
- **§9** (p.155+) — MIT calc, Tables 9/9a/9b/9c
- **§9.4.11** (p.30) — Boiler interlock: -5pp to BOTH SH and DHW
- **§A.2.2** (~p.189) — Forced-secondary set "401 to 407, 409 and
421"
- **Table 3** (p.160) — Primary circuit loss; zero-loss list
- **Table 4a** (p.163-170) — heating systems incl. R column
- **Table 4b** — gas/liquid boilers seasonal efficiency
- **Table 4c** (p.169-170) — Efficiency adjustments
- **Table 4d** (p.170) — heat-emitter R
- **Table 4e** (p.170-173) — heating system controls + temperature
adjustment column (8 groups)
- **Table 4f** (p.174) — pumps + fans
- **Table 9** (p.182) — heating periods and temperatures
- **Table 9c** (p.184) — heating requirement (step 8 = apply
Table 4e adjustment)
- **Table 11** (p.188) — secondary heating fraction
- **Table 12** (p.191) — SAP rating fuel prices
- **Table 12a** (p.191) — high/low-rate fraction by system × tariff
- **Appendix D §D2.1** — PCDB monthly cascade Eq D1
- **RdSAP 10 spec**: `RdSAP 10 Specification 10-06-2025.pdf`
- **§10.11 Table 29** (p.56) — Heating and hot water parameters;
inaccessible cylinder defaults
- **§19 Table 32** (p.95) — RdSAP10 fuel prices / CO2 / PE
## Good luck.