Repository navigation
Conversation
Silthus
force-pushed
the
email-v2/11-first-code-send-event
branch
from
October 26, 2026 04:05
6716e7a to
dc584c1
Compare
The first new send on send/email/ behind a project secret API key captures `email first code send` for the key's creator, with the org group, so the launch drip can exit on it. A unique row per team in messaging_firstcodesend keeps it to one event, also across retries and parallel sends. A key without a creator captures nothing, and a failed capture is logged without touching the send. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A send now checks for the project's row before it inserts, so only the first send of a project writes. The unique row still settles two sends that both miss the check. The key's creator loads only when the send claims the row, and the addressing mode binds before the commit hook. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tor is gone The commit callback now checks for an existing row first, then resolves the key's creator from the database, and claims the project's row only when that creator still exists. A send whose creator was deleted before the callback no longer uses up the event for a later send. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silthus
force-pushed
the
email-v2/10-mcp-strict-email-bodies
branch
from
October 26, 2026 05:30
f52712d to
fe51fc2
Compare
Silthus
force-pushed
the
email-v2/11-first-code-send-event
branch
from
October 26, 2026 05:30
dc584c1 to
42bfa91
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the code-first rebuild of the email send stack; new in the rebuild, with no closed PR to replace: the event the launch drip campaign exits on.
Problem
Impact
Pays into Grow Workflows: the drip stops for projects that already send from code, so it talks only to those still getting started. In scope: Messaging,
send/email/sends with a project secret API key.Merge Danger
Warning
🟡 Merge risk: medium · one-way door: the migration creates
messaging_firstcodesend, and a captured event stays capturedmessaging_firstcodesend: one row per project, with a unique constraint on the team. The migration is a plainCREATE TABLE. Its team key has no database constraint, so it takes no lock onposthog_team.workflows-email-from-code: after a project's first send, each send with a key that has a creator adds one root-team lookup and oneexists()query. The insert runs once per project.202.Changes
send/email/with a project secret API key capturesemail first code sendfor the person who created that key, with the organization and project as groups. Its properties areteam_idandaddressed_by(template_key,keyorid).messaging_firstcodesendrow decides it, through its unique constraint, not through a read and then a write. Retries, replays and parallel sends never capture a second time. A send from a project's other environments counts for the project.How did you test this code?
Test seams:
send/email/through the DRF client (test_transactional_email.py), andrecord_first_code_sendfor the once-only rule.Test rationale, each run red first:
Proofs: a live run on a local stack, Django at this head, with cdp-api and the workers at #580. Capture is replaced by a recorder, so no event leaves the machine (saved with
fleet proof).email first code sendcapturedreplayed: true, no second emailProd shape: a gap until read-only production access exists on 2026-11-02.
CI: the fork has no Depot runners, so those jobs never start, and no secret for the project-board app, so
flags-project-boardfails; the other GitHub-hosted checks pass. The lane check passes: the PR changes only the Python side.Release status
Docs update
None.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5 (claude-opus-5-5)
srv2of map Map: send code-managed email templates with one PostHog call #461.tdd,writing-tests,django-migrations,pr-description,writing-pr-descriptions.email first code send, once per project, on the key's creator, with the org as a groupTeam(a hot table) or a workflows config rowInvolvement: one brief from Michael; review round 1 (GPT-6.1 Sol, Opus fresh eyes) fixed; live run captured.
🤖 Generated with Claude Code