Skip to content

feat(messaging): add hard_bounced_at to the email suppression list - #124637

Merged
trunk-io[bot] merged 1 commit into
masterfrom
posthog/messaging-suppression-hard-bounced-at
Oct 29, 2026
Merged

trunk-io[bot] merged 1 commit into
masterfrom
posthog/messaging-suppression-hard-bounced-at

Conversation

@meikelmosby

Copy link
Copy Markdown
Collaborator

Problem

  • Transactional workflow emails to a suppressed address are skipped, also when the address only soft-bounced (for example a full inbox).
  • The suppression list cannot tell a hard bounce from a soft-bounce suppression, so the send path cannot let the soft ones through.
  • This is the base layer of a stack. The behavior change is in the next PR.

Changes

  • Adds a nullable hard_bounced_at column to posthog_messagesuppression.
  • Nothing reads or writes it yet. Nothing user-visible changes.

How did you test this code?

  • makemigrations generated the migration. It is a plain nullable AddField, with no default and no backfill.

Test rationale: No new test. A nullable column with no reader has no behavior to test. The next PR tests its use.

Release status

  • No feature flag controls this change

Docs update

None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: PostHog Slack app (Claude Code), Claude Opus 5.5

  • Skills invoked: /django-migrations, /writing-pr-descriptions.
  • The migration is split out so the column exists before the Node service starts to read it.
  • No duplicate open PR found.

Created with PostHog from a Slack thread

🤖 Generated with Claude Code

@meikelmosby meikelmosby self-assigned this Oct 28, 2026
@trunk-io

trunk-io Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

⚠️ Django migration SQL — 1 new migration to review

We've detected new migrations on this PR. Review the SQL output for each migration:

products/messaging/backend/migrations/0011_messagesuppression_hard_bounced_at.py

/home/runner/work/tmp/tool_cache/Python/3.14.7/x64/lib/python3.14/site-packages/anyio/from_thread.py:119: SyntaxWarning: 'return' in a 'finally' block
  return result
2026-10-29T10:24:52.509910Z [error    ] Path must be a valid database or directory containing databases. [posthog.exceptions_capture] pid=6525 tid=139833096620928
Traceback (most recent call last):
  File "/home/runner/work/posthog/posthog/posthog/geoip.py", line 15, in <module>
    geoip: Optional[GeoIP2] = GeoIP2(cache=8)
                              ~~~~~~^^^^^^^^^
  File "/home/runner/work/tmp/tool_cache/Python/3.14.7/x64/lib/python3.14/site-packages/django/contrib/gis/geoip2.py", line 116, in __init__
    raise GeoIP2Exception(
        "Path must be a valid database or directory containing databases."
    )
django.contrib.gis.geoip2.GeoIP2Exception: Path must be a valid database or directory containing databases.
/home/runner/work/tmp/tool_cache/Python/3.14.7/x64/lib/python3.14/site-packages/sshtunnel.py:1040: SyntaxWarning: 'return' in a 'finally' block
  return (ssh_host,
/home/runner/work/tmp/tool_cache/Python/3.14.7/x64/lib/python3.14/site-packages/langchain_core/_api/deprecation.py:27: UserWarning: Core Pydantic V1 functionality isn't compatible with Python 3.14 or greater.
  from pydantic.v1.fields import FieldInfo as FieldInfoV1
System check identified some issues:

WARNINGS:
?: (axes.W001) You are using the django-axes cache handler for login attempt tracking. Your cache configuration is however invalid and will not work correctly with django-axes. This can leave security holes in your login systems as attempts are not tracked correctly. Reconfigure settings.AXES_CACHE and settings.CACHES per django-axes configuration documentation.
?: (staticfiles.W004) The directory '/home/runner/work/posthog/posthog/frontend/dist' in the STATICFILES_DIRS setting does not exist.
BEGIN;
--
-- Add field hard_bounced_at to messagesuppression
--
ALTER TABLE "posthog_messagesuppression" ADD COLUMN "hard_bounced_at" timestamp with time zone NULL;
COMMIT;

Last updated: 2026-10-29 10:25 UTC (0c98173)

✅ Django migration risk — migration analysis complete

We've analyzed your migrations for potential risks.

Summary: 1 Safe | 0 Needs Review | 0 Blocked

✅ Safe

Brief or no lock, backwards compatible

messaging.0011_messagesuppression_hard_bounced_at
  └─ #1 ✅ AddField
     Adding nullable field requires brief lock
     model: messagesuppression, field: hard_bounced_at

📚 How to Deploy These Changes Safely

AddField:

This operation acquires a brief lock but doesn't rewrite the table.

Deployment uses lock timeouts with automatic retries, so lock contention will cause retries rather than connection pile-up.

Last updated: 2026-10-29 10:26 UTC (0c98173)

@meikelmosby
meikelmosby marked this pull request as ready for review October 29, 2026 09:12
@parameterai

parameterai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Risk: No findings

This PR adds a nullable hard_bounced_at column to the team-scoped posthog_messagesuppression table, plus the migration and max_migration bump. Nothing reads or writes the field yet and the suppression API serializer declares fields explicitly, so the column is neither exposed nor settable through any endpoint; the actual send-path behavior change is deferred to the next PR in the stack.

Sentinel reviewed 0c98173 · Review settings

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team October 29, 2026 09:13
A nullable column that records when a suppressed address last hard-bounced. The next change uses it so that only a hard bounce blocks transactional workflow email.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 287cfe70-d844-4602-9f36-19a5638e5b50
@meikelmosby
meikelmosby force-pushed the posthog/messaging-suppression-hard-bounced-at branch from 3322c27 to 0c98173 Compare October 29, 2026 10:21
@trunk-io

trunk-io Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@trunk-io

trunk-io Bot commented Oct 29, 2026

Copy link
Copy Markdown

This pull request is queued for merge as part of 125322, which will merge 124637, 124638, 125374, 125322.

@trunk-io
trunk-io Bot merged commit 1d3ead4 into master Oct 29, 2026
255 checks passed
@trunk-io
trunk-io Bot deleted the posthog/messaging-suppression-hard-bounced-at branch October 29, 2026 16:26
@trunk-io

trunk-io Bot commented Oct 29, 2026

Copy link
Copy Markdown

This pull request was merged into master as part of stacked PR 125322.

@deployment-status-posthog

deployment-status-posthog Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-10-29 17:20 UTC Run
prod-us ✅ Deployed 2026-10-29 17:42 UTC Run
prod-eu ✅ Deployed 2026-10-29 17:47 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants