Model/backend/documents_parser/tests
Khalim Conn-Kowlessar ff25746f44 Slice S0380.40: parametrized API-path chain sweep for cohort-2 (34/38 at 1e-4)
Mirror of the cohort-2 Summary-path sweep that closed across
S0380.30..38: for each of the 38 cohort-2 certs whose API JSON was
fetched in S0380.39, drive the full API chain (`from_api_response`
→ `cert_to_inputs` → `calculate_sap_from_inputs`) and assert
`sap_score_continuous` vs the worksheet's lodged SAP at abs <= 1e-4.

Per cross-mapper parity ([[feedback-cross-mapper-parity-via-cascade]]):
the SAP cascade is the load-bearing equivalence check between
EpcPropertyData produced by from_api_response and from_elmhurst_site_notes.
If both paths hit the worksheet at 1e-4, they're cascade-output-
equivalent for load-bearing fields — strictly stronger than a noisy
structural EpcPropertyData diff.

Two parametrized tests, both green at HEAD:

- test_api_cohort_2_full_chain_sap_matches_worksheet_at_1e_minus_4:
  34 certs that hit the worksheet at 1e-4 on the API path immediately
  (the cascade can't tell which mapper produced the EPC).

- test_api_cohort_2_open_cert_residual_matches_current_pin:
  4 certs that don't yet hit 1e-4 — pinned at their current cascade
  output as forcing functions per [[project-api-to-sap-residual-test]].
  When a follow-up slice closes the underlying mapper/spec gap, the
  cascade output moves and the pin fires, forcing the cert to migrate
  from _COHORT_2_API_OPEN to _COHORT_2_API_CLOSED.

Open cohort residuals (handover to Slice C+):
  - 0300/1536/9380: tight +0.42..+0.44 band — likely a single shared
    cascade-spec gap (API-mapper-specific, since Summary path hits 1e-4)
  - 2102: -6.30 — Summary test (test_summary_2102_secondary_heating_
    routes_house_coal_for_open_fire) shows the cert lodges house-coal
    open-fire secondary heating; API mapper likely routes secondary
    fuel differently. Probe `secondary_heating` block first.

Test suite: 712 → 750 pass (0 fails). Pyright net-zero on touched file.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 16:45:48 +00:00
..
fixtures Slice S0380.19: count Elmhurst shower outlets by type (no more hardcoded 1) 2026-05-28 07:16:32 +00:00
__init__.py Map to RdSapSiteNotes from site notes JSON 🟥 2026-04-16 13:54:03 +00:00
test_elmhurst_end_to_end.py Slice S0380.17: map Elmhurst §11 glazing-type labels to SAP10 codes 2026-05-27 23:05:52 +00:00
test_elmhurst_extractor.py extract window frame details from elmhurst site notes 🟥 2026-04-27 15:50:25 +00:00
test_end_to_end.py P6.1 follow-on: unbox BuildingPartIdentifier at backend boundaries 2026-05-20 09:58:23 +00:00
test_extractor.py Handle wall thickness "Unmeasurable" 🟩 2026-04-30 16:41:16 +00:00
test_pdf.py rename example site notes to PasHub_ and add Elmhurst example 2026-04-24 13:01:51 +00:00
test_summary_pdf_mapper_chain.py Slice S0380.40: parametrized API-path chain sweep for cohort-2 (34/38 at 1e-4) 2026-05-28 16:45:48 +00:00