From f7ee47118b6a99be043de0d19a303d3b727753ce Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Fri, 19 Jun 2026 18:18:12 +0000 Subject: [PATCH] =?UTF-8?q?Add=20the=205=20new=20components=20to=20the=20o?= =?UTF-8?q?verride=5Fcomponent=20pgEnum=20mirror=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Caught live writing property_overrides on portfolio 796: the Python override_component SAEnum lagged the DB enum, so reading a new-component row back threw LookupError. Guard it with a consistency test. Co-Authored-By: Claude Opus 4.8 (1M context) --- infrastructure/postgres/property_override_table.py | 5 +++++ .../property/test_override_component_consistency.py | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/infrastructure/postgres/property_override_table.py b/infrastructure/postgres/property_override_table.py index 3132ddf5..40490144 100644 --- a/infrastructure/postgres/property_override_table.py +++ b/infrastructure/postgres/property_override_table.py @@ -27,6 +27,11 @@ override_component_sa_enum = SAEnum( "roof_type", "property_type", "built_form_type", + "main_fuel", + "glazing", + "construction_age_band", + "water_heating", + "main_heating_system", name="override_component", ) diff --git a/tests/repositories/property/test_override_component_consistency.py b/tests/repositories/property/test_override_component_consistency.py index df830cd0..3f7f4d31 100644 --- a/tests/repositories/property/test_override_component_consistency.py +++ b/tests/repositories/property/test_override_component_consistency.py @@ -14,6 +14,7 @@ from __future__ import annotations from infrastructure.landlord_overrides.landlord_override_reader_postgres_repository import ( # pyright: ignore[reportPrivateUsage] _ROW_TYPES, ) +from infrastructure.postgres.property_override_table import override_component_sa_enum from repositories.property.landlord_override_overlays import ( # pyright: ignore[reportPrivateUsage] _COMPONENT_OVERLAYS, ) @@ -22,3 +23,10 @@ from repositories.property.landlord_override_overlays import ( # pyright: ignor def test_reader_and_overlay_registries_cover_the_same_components() -> None: # Assert assert set(_ROW_TYPES) == set(_COMPONENT_OVERLAYS) + + +def test_override_component_pgenum_covers_every_component() -> None: + # The property_overrides.override_component pgEnum mirror must list every + # component, or writing/reading a new-component row through it throws a + # LookupError against Postgres (caught live on the Hyde portfolio-796 run). + assert set(override_component_sa_enum.enums) == set(_COMPONENT_OVERLAYS)