fix: tighten recipient_emails guard to reject empty list

send_max_budget_alert_email previously guarded with `is not None`, which
accepts `[]` and then crashes on `recipient_emails[0]` inside
_get_email_params. The current caller (_handle_multi_threshold_max_budget_alert)
already filters empty lists upstream, but the public method signature makes
no such guarantee — a future caller passing [] would hit IndexError.

Switch to truthiness so both None and [] fall through to the single-recipient
path.
This commit is contained in:
Ryan Crabbe 2026-04-18 14:07:18 -07:00
parent 029d9bcfc7
commit 0a4b02fe76
No known key found for this signature in database

View File

@ -359,7 +359,7 @@ class BaseEmailLogger(CustomLogger):
else "N/A"
)
if recipient_emails is not None:
if recipient_emails:
# Multi-threshold path: batch send with generic key-based greeting
email_params = await self._get_email_params(
email_event=EmailEvent.max_budget_alert,