From 42201e42c51efb44ba8d5ce46ca171be2f015b0a Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 14 Jul 2026 09:29:45 +0000 Subject: [PATCH] =?UTF-8?q?Record=20a=20failure=20when=20the=20selection?= =?UTF-8?q?=20yields=20no=20export=20rows=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- orchestration/scenario_export_orchestrator.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/orchestration/scenario_export_orchestrator.py b/orchestration/scenario_export_orchestrator.py index 4166d27c0..282751eb4 100644 --- a/orchestration/scenario_export_orchestrator.py +++ b/orchestration/scenario_export_orchestrator.py @@ -91,6 +91,18 @@ class ScenarioExportOrchestrator: named_sheets.append((self._scenarios.name_for(scenario_id), sheet)) row_count += len(sheet.rows) + if row_count == 0: + # No Property had a default Plan under any requested Scenario (model + # A) — a recorded failure, never an empty workbook emailed (ADR-0065). + raise SubTaskFailure( + "the scenario export selection produced no exportable rows", + details={ + "portfolio_id": portfolio_id, + "scenario_ids": list(scenario_ids), + "property_count": len(property_ids), + }, + ) + data = render_workbook(named_sheets) key = f"{self._key_prefix}/{export_name}.xlsx" self._exports.put_object(key, data)