Skip to content

feat(cdp): drop the email attachments side table - #131643

Merged
trunk-io[bot] merged 1 commit into
masterfrom
feat/drop-cyclotron-email-attachments
Nov 9, 2026
Merged

trunk-io[bot] merged 1 commit into
masterfrom
feat/drop-cyclotron-email-attachments

Conversation

@Silthus

@Silthus Silthus commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Merge gate: merge only after #131567 is deployed in both regions, and cyclotron_email_attachments has zero rows in both regions on the day it merges. The query is in the ticket's proof comment. The drop deletes data, so it can't be undone.

Problem

The side table cyclotron_email_attachments held the file bytes of transactional email in the cyclotron job database.
Email attachments are moving to object storage, and #131567 removed every reader and writer of the table.
The empty table stays in the shared queue database until something drops it.

Refs PostHog/michaelr-context#74

Caution

🔴 Merge risk: high · one-way door: the table and any rows in it are deleted

Rollout

Changes

  • A new cyclotron-node migration drops cyclotron_email_attachments. Its primary key and two indexes go with it.
  • Nothing a user sees changes. Code sends behave as on master.

How did you test this code?

All runs were on a dev stack at this PR's head. The evidence and the merge-day query are in the ticket's proof comment.

  • Red/green: master's migrations leave the table and its three indexes in place. This head's migrations remove them. A second run is a no-op, and cyclotron_jobs is untouched.
  • Live run: the real migration runner applied the drop. A code send through Django, cdp-api, the email worker and maildev was delivered. Several janitor cycles ran with no error about the table. A send with attachments is still refused with field_not_accepted.
  • Cross-version: Node from before feat(cdp): remove inline email attachments and their side table #131567 still delivers on the dropped schema. Its janitor logs a caught "relation does not exist" on each sweep and keeps cleaning up jobs. The merge gate prevents this.
  • Shadow diff: schema dumps of master and this head differ only by the table, its key and its indexes. Three send scenarios give the same results with the table present and with it dropped.

Test rationale: none added. A test that asserts a table is gone guards nothing once the migration has run. The migration runner and the schema dumps above prove the drop.

Release status

  • No feature flag controls this change

Docs update

  • None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, Claude Opus 5.5. Reviews: GPT-6.1 Sol.

Skills: /writing-pr-descriptions, /writing-tests, /writing-code-comments

Question Answer Who Where
Drop the side table once its code is gone A separate migration, merged after the removal is live in both regions 👤 Human PostHog/michaelr-context#74
Build ahead of the merge gate Build and review now; the gate holds the merge 👤 Human PostHog/michaelr-context#74
Lock timeout on the drop None: the table has no readers once the gate holds, so the lock waits on nothing 🤖 Agent PostHog/michaelr-context#74

Involvement: design pass, cross-model review, PostHog Review, qa-swarm; live proofs captured.

More context for AI agents
  • Session: Claude Code in T3, stack worker for PostHog/michaelr-context#74
  • Decisions: no .down.sql: this folder has none, and the fix is forward
  • Read closely: rust/cyclotron-node-migrations/20261109000001_drop_email_attachments.sql

🤖 Generated with Claude Code

Nothing reads or writes cyclotron_email_attachments since the inline
attachments path left Node. Email attachments move to object storage.

Refs PostHog/michaelr-context#74

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Silthus Silthus self-assigned this Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane

This PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 19d4e1d: no findings.

@Silthus
Silthus marked this pull request as ready for review November 9, 2026 10:16
@parameterai

parameterai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Risk: No findings

A single sqlx migration drops the now-unused cyclotron_email_attachments table from the cyclotron job database; no application code changes. I verified no code in the repo references the table anymore — the only matches are the create and drop migrations themselves — so nothing can break at runtime from the drop, and the statement is static SQL with no injection surface.

Sentinel reviewed 19d4e1d · Review settings

@veria-ai

veria-ai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not approved yet — waiting on the conditions below.

Re-add the stamphog label to request another review once you have addressed this.

stamphog can't approve this pull request automatically. The deny-list gate refused it because the added file rust/cyclotron-node-migrations/20261109000001_drop_email_attachments.sql is a database migration, and the tier gate also classified the change as T2-never, a category that always needs a human reviewer. The size gate passed, so the size isn't the issue.

Next, ask a human reviewer to look at it, ideally someone who owns the cyclotron database. The merge-gate conditions in the description (the dependent change deployed in both regions and zero rows confirmed) are worth restating in that request.

  • posthog[bot] reviewed the current head.
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✗ matches: migrations
size ✓ 1L, 1F substantive — within ceiling
tier ✗ classified as T2-never: T2-never (1L, 1F, single-area, feat)
stamphog 2.7.0 .stamphog/policy.yml @ unknown · reviewed head 19d4e1d

@Silthus

Silthus commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/trunk merge

@trunk-io

trunk-io Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@Silthus

Silthus commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/trunk merge

@trunk-io
trunk-io Bot merged commit 2c7105e into master Nov 9, 2026
307 checks passed
@trunk-io
trunk-io Bot deleted the feat/drop-cyclotron-email-attachments branch November 9, 2026 11:52
@deployment-status-posthog

deployment-status-posthog Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-11-09 12:17 UTC Run
prod-us ✅ Deployed 2026-11-09 12:57 UTC Run
prod-eu ✅ Deployed 2026-11-09 13:23 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