new-site/api/migrations/097_fmcsa_mx_provider.sql
justin 9e40965092 trucking: per-MX-operator throttling + Google/MS-Workspace warmup exclusion
The Jun 13-14 Gmail+Outlook block storm came from the main/trucking pool having
NO per-MX throttling (only HC had it) -- it concentrated warmup volume on
Google/Microsoft-Workspace-hosted business domains. Port the HC fix:

- migration 097: fmcsa_carriers.mx_provider column.
- mx_tag_carriers.py: resolve MX once per distinct domain (reuses the verifier's
  classifier+cache), tag every carrier with that domain's operator. Bounded per
  run, prioritizes unsent verified carriers.
- build_trucking_campaigns: during warmup (day<=6) EXCLUDE tagged Google/MS/
  Proofpoint/etc. carriers in fetch_carriers; per-MX cap in select_sendable_
  carriers so known operators never dominate the quota. Untagged carriers pass
  (not collapsed onto one bucket) until tagging fills in. mx_daily_caps ramps
  with the main warmup day; MAIN_SKIP_BIG_MX=0 disables once warmed.
2026-06-14 21:11:23 -05:00

13 lines
677 B
SQL

-- Per-MX-operator throttling for the trucking/main warmup pool.
-- Sender reputation is tracked by the RECEIVING mail operator (Microsoft 365,
-- Google Workspace, Proofpoint, ...), not by recipient domain. The Jun 13-14
-- Gmail + Outlook block storm came from hammering Google/MS-Workspace-hosted
-- business domains. mx_provider lets the builder exclude those during warmup and
-- cap volume per operator (mirrors the HC pool). Populated by mx_tag_carriers.py.
ALTER TABLE fmcsa_carriers
ADD COLUMN IF NOT EXISTS mx_provider TEXT;
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_fmcsa_carriers_mx_provider
ON fmcsa_carriers (mx_provider)
WHERE mx_provider IS NOT NULL;