Repository navigation
Conversation
A sandbox send also records email_sandbox_sent, which the tier history and the team's sending allowance subtract from email_sent per day. The SES webhook captures a delivered event for the sandbox configuration set. Refs Silthus/personal#199 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 27, 2026
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.
Note
Replaced by #609 (Python tier subtraction) and #610 (worker metric and delivered event). This PR mixed lanes that upstream's merge rules keep apart, so it was split in two. Same code, carved by file.
Problem
A team's sending tier grows with the email it sends through its own domain.
Sandbox sends go out through a shared PostHog identity, but they still record
email_sent, which the tier history and the team's sending allowance read.So sandbox sends could lift a team's own tier, or use up its allowance.
This PR keeps sandbox sends out of both, and gives sandbox delivery its own event.
Part of Silthus/personal#199 (sandbox delivery, slice 3 of 3 there). Stacked on #605.
Replaces #454.
Impact
Grow Workflows, activation rate: sandbox sends stay a separate funnel step, and the tier keeps measuring a team's own sending.
No production team sees this yet:
WORKFLOWS_SANDBOX_SENDER_ENABLEDstays off.Merge Danger
Warning
🟡 Merge risk: medium · two-way door (merge-risk rubric)
email_sandbox_sentfromemail_sentper day, and the allowance per workflow, floored at zero. No sends recordemail_sandbox_sentuntil the sandbox switch is on, so tier results do not change before then.SES_SANDBOX_CONFIGURATION_SET, and does nothing new while that setting is empty.Production lines: 114 changed (
git diff --numstatagainst #605, tests and docs excluded).Changes
email_sentemail_sentandemail_sandbox_sent_history_from_daily)email_sentemail_sentminusemail_sandbox_sentper day, floored at zeroemail_sentworkflows sandbox email deliveredwith the recipient count, test sends includedemail_sentstays, so the workflow's metrics tab still shows sandbox sends.How did you test this code?
tscpasses. eslint, oxlint, prettier and ruff pass on the changed files.semgrep --config .semgrep/rules/security/reports nothing on the lines this PR adds.email_sandbox_sent, 4 webhook cases capture no delivered event, and 5 tier and allowance tests count sandbox sends.email.service.test.ts,email-tracking.service.test.ts,sandbox-email-sender.test.ts,rate-limiter.service.test.ts,sandbox-sender-state.service.test.tsandses.test.ts; Djangotest_email_sending_tier.py,test_email_reputation.pyandtest_workflow_email_health.py.EmailService.executeSendEmailwith a sandbox integration: the metrics it records.CdpApi, with the SNS signature check stubbed: the delivered event._history_from_dailyand the allowance endpoint, with ClickHouse app metrics seeded.fleet proof gate):Silthus/posthog.Test rationale: the tier tests cover per-day subtraction, because a sandbox excess on one day must not erase own sends on another, and sandbox feedback must still count. The webhook tests cover the configuration set and the signed-code check, which decide whether an event fires.
Release status
Docs update
docs/internal/workflows-email-sending-tiers.mddocuments the subtraction, the delivered event, and that the switch waits for this metric.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5 (implementation). Design pass and review by Codex, GPT-6.1 Sol.
Ported from the reviewed source PR above onto #605 as a wayfinder ticket lane. The worker metric is new here: the source stack recorded it in a PR this stack does not carry. Skills:
tdd,/writing-tests,pr-description,merge-risk,qa-swarmdesign pass.No duplicate: this replaces the source fork PR named above, which stays open until the stack exists.
Public artifact: all test data is invented.
Decisions
email_sentfor the metrics tab, addemail_sandbox_sent, and subtract it in the tier and the allowanceInvolvement: no grilling rounds; design pass (1 lane, no findings); review (GPT-6.1 Sol, 1 round, no findings); proof captured as test output.
🤖 Generated with Claude Code