mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Add the 5 new components to the override_component pgEnum mirror 🟩
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) <noreply@anthropic.com>
This commit is contained in:
parent
3a0a122b7f
commit
f7ee47118b
2 changed files with 13 additions and 0 deletions
|
|
@ -27,6 +27,11 @@ override_component_sa_enum = SAEnum(
|
||||||
"roof_type",
|
"roof_type",
|
||||||
"property_type",
|
"property_type",
|
||||||
"built_form_type",
|
"built_form_type",
|
||||||
|
"main_fuel",
|
||||||
|
"glazing",
|
||||||
|
"construction_age_band",
|
||||||
|
"water_heating",
|
||||||
|
"main_heating_system",
|
||||||
name="override_component",
|
name="override_component",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ from __future__ import annotations
|
||||||
from infrastructure.landlord_overrides.landlord_override_reader_postgres_repository import ( # pyright: ignore[reportPrivateUsage]
|
from infrastructure.landlord_overrides.landlord_override_reader_postgres_repository import ( # pyright: ignore[reportPrivateUsage]
|
||||||
_ROW_TYPES,
|
_ROW_TYPES,
|
||||||
)
|
)
|
||||||
|
from infrastructure.postgres.property_override_table import override_component_sa_enum
|
||||||
from repositories.property.landlord_override_overlays import ( # pyright: ignore[reportPrivateUsage]
|
from repositories.property.landlord_override_overlays import ( # pyright: ignore[reportPrivateUsage]
|
||||||
_COMPONENT_OVERLAYS,
|
_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:
|
def test_reader_and_overlay_registries_cover_the_same_components() -> None:
|
||||||
# Assert
|
# Assert
|
||||||
assert set(_ROW_TYPES) == set(_COMPONENT_OVERLAYS)
|
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)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue