From 3dd2dfe92c8354ad9c59cfbd12050276e8255115 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 6 Jul 2026 13:32:13 +0000 Subject: [PATCH] =?UTF-8?q?Empty=20tenancies,=20Abri=20rejections=20and=20?= =?UTF-8?q?ambiguous=20responses=20resolve=20like=20the=20other=20relay=20?= =?UTF-8?q?operations=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- infrastructure/abri/abri_client.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/infrastructure/abri/abri_client.py b/infrastructure/abri/abri_client.py index ab59a6fb2..a07da387f 100644 --- a/infrastructure/abri/abri_client.py +++ b/infrastructure/abri/abri_client.py @@ -226,15 +226,19 @@ class AbriClient: @staticmethod def _parse_tenancy_data(root: ET.Element) -> TenancyData: - tenancy = root.find("Tenancy") + tenancies = root.findall("Tenancy") - if tenancy is None: + if len(tenancies) != 1: raise AbriResponseParseError( - "Tenancy element missing from relay response" + f"expected exactly one Tenancy element, found {len(tenancies)}" ) + tenancy = tenancies[0] tenancy_reference = (tenancy.text or "").strip() + if not tenancy_reference: + raise AbriResponseParseError("Tenancy element missing its reference") + return TenancyData( tenancy_reference=tenancy_reference, tenants=tuple(