Schedule daily bounce->source reconcile (06:20 UTC, before scrub+builder)

This commit is contained in:
justin 2026-07-02 15:40:43 -05:00
parent 9147470155
commit 97c67a7ecf
2 changed files with 20 additions and 0 deletions

View file

@ -118,3 +118,4 @@
- pw-hc-rampcap
- pw-ip-rehab
- pw-warmup-tg-alert
- pw-bounce-reconcile

View file

@ -0,0 +1,19 @@
# Daily bounce → source reconciliation. Propagates every HARD bounce Listmonk
# recorded back into the fmcsa_carriers source of truth (demotes the matching
# smtp_valid/send_confirmed row to 'hard_bounced', which the builders + the
# fuel-tax newsletter both treat as never-sendable), then rebuilds the
# pw_smtp_valid_stage staging table the newsletter joins to so it only ever
# contains still-live, non-blocklisted addresses.
#
# WHY: the audience queries already filter to the clean pool, but nothing
# demoted an address AFTER it hard-bounced on a real send. Trucking mailboxes
# churn fast, so the "clean" pool silently decayed to ~12% dead and the
# "filtered" newsletters were still running 10-15% bounce, re-damaging sender
# reputation. This closes that feedback loop so the clean pool self-heals.
# (See scripts/reconcile_bounces_to_source.py + docs/email-deliverability-runbook.md.)
#
# Runs as deploy (needs docker exec for psql). 06:20 UTC — after the every-5-min
# bounce-sync has ingested the overnight bounces, before the 06:30 UTC consumer
# scrub and well before the 08:00 UTC trucking builder. Includes the healthcare
# listmonk_hc bounces too so the HC pool stays clean as that stream scales.
20 6 * * * deploy cd /opt/performancewest && python3 scripts/reconcile_bounces_to_source.py --days 90 --include-hc >> /opt/performancewest/logs/pw-bounce-reconcile.log 2>&1