Record a failure when the selection yields no export rows 🟩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-14 09:29:45 +00:00
parent 4220ce4bf0
commit 42201e42c5

View file

@ -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)