From 2b5d38a7f923bf1c72c62e2eba04e07fe75309af Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 1 Jul 2026 15:45:12 +0000 Subject: [PATCH] =?UTF-8?q?Deterministically=20guard=20the=20Gas=20CPSU=20?= =?UTF-8?q?solid-fuel=20and=20electric-boiler=20descriptions=20?= =?UTF-8?q?=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/domain/epc/test_main_heating_guard.py | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/domain/epc/test_main_heating_guard.py b/tests/domain/epc/test_main_heating_guard.py index 452474d61..a32f3710f 100644 --- a/tests/domain/epc/test_main_heating_guard.py +++ b/tests/domain/epc/test_main_heating_guard.py @@ -19,6 +19,38 @@ def test_guard_resolves_high_heat_retention_storage() -> None: assert result is MainHeatingSystemType.ELECTRIC_STORAGE_HIGH_HEAT_RETENTION +@pytest.mark.parametrize( + ("description", "expected"), + [ + # The Gas CPSU dumping ground (ADR-0045): solid-fuel room heaters and + # electric ("NA" type) boilers the LLM sent to Gas CPSU (120, mains gas). + ( + "Solid fuel room heaters: Open fire in grate", + MainHeatingSystemType.SOLID_FUEL_ROOM_HEATER_OPEN_FIRE, + ), + ( + "Solid fuel room heaters: Open fire with back boiler (no radiators)", + MainHeatingSystemType.SOLID_FUEL_ROOM_HEATER_OPEN_FIRE_BACK_BOILER, + ), + ( + "Solid fuel room heaters: Closed room heater with boiler (no radiators)", + MainHeatingSystemType.SOLID_FUEL_ROOM_HEATER_CLOSED_WITH_BOILER, + ), + # "NA" is the boiler-type value meaning "not a gas combi/regular/CPSU" — + # i.e. an electric boiler. + ("Boiler: A rated NA", MainHeatingSystemType.ELECTRIC_BOILER), + ], +) +def test_guard_resolves_the_gas_cpsu_dumping_ground( + description: str, expected: MainHeatingSystemType +) -> None: + # Act + result = main_heating_guard(description) + + # Assert + assert result is expected + + @pytest.mark.parametrize( "description", [ @@ -27,6 +59,12 @@ def test_guard_resolves_high_heat_retention_storage() -> None: "Electric Storage Systems: Old (large volume) storage heaters", "Electric Storage Systems: Modern (slimline) storage heaters", "Electric Storage Systems: Fan storage heaters", + # Genuinely-gas boilers the LLM already classifies correctly (not "NA"). + "Boiler: A rated Combi", + "Boiler: C rated Regular Boiler", + # A plain closed room heater (no boiler) is the existing 633 archetype — + # the LLM keeps it; only "…with boiler" (634) is guarded. + "Solid fuel room heaters: Closed room heater (no boiler)", # Unrelated / varied phrasings are the LLM's job. "Gas boiler", "",