Say when a channel cannot be checked, instead of skipping it
CI / test (push) Successful in 5s

The estate's SendGrid key is send-only: mail.send and the batch scopes,
with no suppression.read, no bounces.read, no stats. So email delivery
cannot be reconciled the way SMS now is.

The tempting move is to check SMS and quietly say nothing about email.
That is precisely how a gap disappears - the daily report looks clean
and the unchecked channel stops being a question anyone asks. It now
reports 'email delivery NOT VERIFIED' with the exact scope that would
fix it, every day, until somebody does.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Nirav Patel
2026-08-18 20:50:37 -04:00
co-authored by Claude Opus 5
parent 349f03015f
commit 6b3a09ec1c
3 changed files with 118 additions and 2 deletions
+11 -2
View File
@@ -24,7 +24,9 @@ import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from app.config import Settings # noqa: E402
from app.reconcile import describe, fetch, reconcile, window_start # noqa: E402
from app.reconcile import ( # noqa: E402
describe, describe_email, email_bounces, fetch, reconcile, window_start,
)
def main() -> int:
@@ -45,7 +47,14 @@ def main() -> int:
report = reconcile(messages)
text = describe(report)
if report.ok and args.quiet_when_clean:
# Email is asked about too, and says plainly when it cannot be answered —
# a check that silently skips the channel it cannot see is how a gap
# becomes invisible.
email = email_bounces(api_key=settings.sendgrid_key,
since=window_start(args.hours), timeout=settings.timeout)
text = text + "\n\n" + describe_email(email)
if report.ok and email.checked and not email.bounces and args.quiet_when_clean:
return 0
print(text)