Resolve a depthless sloping-ceiling marker to as built 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-23 13:46:49 +00:00
parent 0625b9b179
commit 6603d98c2c
2 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,9 @@
from __future__ import annotations
from typing import Optional
from domain.epc.property_overrides.roof_type import RoofType
def roof_sloping_ceiling_guard(description: str) -> Optional[RoofType]:
raise NotImplementedError

View file

@ -0,0 +1,42 @@
"""The pitched-sloping-ceiling roof guard (ADR-0066).
`PitchedWithSlopingCeiling: <As Built | Unknown | N mm>` is a slope-following
ceiling (gov-API roof_construction 8), NOT a horizontal loft so it must
resolve deterministically to the `Pitched, sloping ceiling, ` family and never
reach the LLM to be routed onto the `Pitched, N mm loft insulation` ladder. Same
defect class the party-ceiling guard was created for (#1376): the LLM resolves
identical inputs inconsistently, and the near-duplicate loft members are exactly
the ambiguity. Returns None for anything that is not a sloping-ceiling marker so
the LLM (and the party-ceiling guard) still handle the rest.
"""
from __future__ import annotations
import pytest
from domain.epc.property_overrides.roof_sloping_ceiling_guard import (
roof_sloping_ceiling_guard,
)
from domain.epc.property_overrides.roof_type import RoofType
@pytest.mark.parametrize(
"description",
[
"PitchedWithSlopingCeiling: As Built",
"PitchedWithSlopingCeiling: Unknown",
"PitchedWithSlopingCeiling",
"PitchedWithSlopingCeiling: ",
],
)
def test_sloping_ceiling_without_a_depth_resolves_to_as_built(
description: str,
) -> None:
# ADR-0066: a sloping ceiling with no measured depth ("As Built" / "Unknown"
# / nothing) folds to `as built`, which defers the U-value to the age band.
# Act
member = roof_sloping_ceiling_guard(description)
# Assert
assert member is RoofType.PITCHED_SLOPING_CEILING_AS_BUILT