:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(workflows): add global email hard-bounce table (#128088)
Harley Alexander554d49669d30
diff --git a/.github/scripts/check-idor-model-coverage.py b/.github/scripts/check-idor-model-coverage.pyindex 5adbe0f1b140..b7a43f09d572 100644--- a/.github/scripts/check-idor-model-coverage.py+++ b/.github/scripts/check-idor-model-coverage.py@@ -345,6 +345,7 @@ def get_scoped_models() -> tuple[dict[str, set[str]], set[str], set[str], set[st"MCPRegistryTool", # tools of an MCPRegistryServer (scoped via the catalog row)"MCPRankingRun", # one scoring pass over the global registry index"MCPRankingScore", # per-server score of an MCPRankingRun (scoped via the run/catalog rows)+ "EmailHardBounce", # instance-global email addresses that do not exist, written from hard bounces# --- Special (has source_team + destination_team, not a plain team) ---"ResourceTransfer",# --- Organization-scoped (correctly above team level) ---diff --git a/products/messaging/backend/migrations/0012_email_hard_bounce.py b/products/messaging/backend/migrations/0012_email_hard_bounce.pynew file mode 100644index 000000000000..a057f316d204--- /dev/null+++ b/products/messaging/backend/migrations/0012_email_hard_bounce.py@@ -0,0 +1,26 @@+# Generated by Django 6.1.2 on 2026-11-03 10:31++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("messaging", "0011_messagesuppression_hard_bounced_at"),+ ]++ operations = [+ migrations.CreateModel(+ name="EmailHardBounce",+ fields=[+ (+ "email",+ models.CharField(max_length=512, primary_key=True, serialize=False),+ ),+ ("first_bounced_at", models.DateTimeField()),+ ("last_bounced_at", models.DateTimeField()),+ ],+ options={+ "db_table": "posthog_emailhardbounce",+ },+ ),+ ]diff --git a/products/messaging/backend/migrations/max_migration.txt b/products/messaging/backend/migrations/max_migration.txtindex 83e9b0609d9c..309226c3f69b 100644--- a/products/messaging/backend/migrations/max_migration.txt+++ b/products/messaging/backend/migrations/max_migration.txt@@ -1 +1 @@-0011_messagesuppression_hard_bounced_at+0012_email_hard_bouncediff --git a/products/messaging/backend/models/__init__.py b/products/messaging/backend/models/__init__.pyindex c09870b3b017..d4c0d97749b6 100644--- a/products/messaging/backend/models/__init__.py+++ b/products/messaging/backend/models/__init__.py@@ -1,3 +1,4 @@+from .email_hard_bounce import EmailHardBouncefrom .message_category import MessageCategory, MessageCategoryTypefrom .message_preferences import ALL_MESSAGE_PREFERENCE_CATEGORY_ID, MessageRecipientPreference, PreferenceStatusfrom .message_suppression import MessageSuppression, SuppressionSource@@ -8,6 +9,7 @@ from .supabase_auth_email_config import SupabaseAuthEmailConfig__all__ = ["ALL_MESSAGE_PREFERENCE_CATEGORY_ID",+ "EmailHardBounce","MessageCategory","MessageCategoryType","MessageRecipientPreference",diff --git a/products/messaging/backend/models/email_hard_bounce.py b/products/messaging/backend/models/email_hard_bounce.pynew file mode 100644index 000000000000..d06e0daac68f--- /dev/null+++ b/products/messaging/backend/models/email_hard_bounce.py@@ -0,0 +1,23 @@+from django.db import models+++class EmailHardBounce(models.Model):+ """+ Instance-global list of email addresses that do not exist. A hard bounce that proves the address does+ not exist adds it, whichever team sent the email. Every team's sends skip a listed address, except a+ team that removed the address from its own suppression list. A later successful delivery from any team+ proves the address exists, and deletes the row.++ The table has no team_id because the fact belongs to the address, not to a team.+ """++ # Lower-cased recipient email address.+ email = models.CharField(max_length=512, primary_key=True)+ first_bounced_at = models.DateTimeField()+ last_bounced_at = models.DateTimeField()++ class Meta:+ db_table = "posthog_emailhardbounce"++ def __str__(self) -> str:+ return self.email