From e9eb068be9ad47ed7ece7a7a38d47ece7da7326b Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 7 Jul 2026 12:05:39 +0000 Subject: [PATCH] =?UTF-8?q?Filters=20that=20match=20no=20properties=20refu?= =?UTF-8?q?se=20the=20run=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 --- backend/app/modelling/router.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/app/modelling/router.py b/backend/app/modelling/router.py index 6be284523..d71c699f6 100644 --- a/backend/app/modelling/router.py +++ b/backend/app/modelling/router.py @@ -83,6 +83,16 @@ async def trigger_run( properties: list[FilteredProperty] = resolve_filtered_property_ids( session, body.portfolio_id, body.filters ) + if not properties: + # A task with zero sub_tasks could never roll up to complete; the + # app's preview shows the same zero from the same rule (ADR-0056). + raise HTTPException( + status_code=400, + detail=( + f"The filters resolve to no properties in portfolio " + f"{body.portfolio_id} — nothing to distribute." + ), + ) batches = pack_postcode_batches(properties) # Pre-create one sub_task per (scenario, batch) message under the