Repository navigation
Conversation
Silthus
force-pushed
the
feat/email-send-code-form
branch
from
October 23, 2026 21:24
5067eed to
f55e16e
Compare
Silthus
force-pushed
the
feat/email-send-admission-checks
branch
from
October 23, 2026 21:24
1af2c08 to
5cec76f
Compare
🤖 CI report
|
| File | Comment lines | Added lines |
|---|---|---|
nodejs/src/cdp/services/hogflows/hogflow-manager.service.ts |
6 | 61 |
nodejs/src/cdp/services/hogflows/transactional-email.ts |
5 | 31 |
nodejs/src/cdp/services/messaging/email-send-policy.ts |
5 | 45 |
nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.consumer.ts |
4 | 43 |
nodejs/src/cdp/cdp-api.serial.test.ts |
3 | 180 |
nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.test.ts |
1 | 111 |
nodejs/src/cdp/services/messaging/email-validation.service.ts |
1 | 23 |
products/messaging/backend/facade/contracts.py |
1 | 6 |
This check does not block merging. It updates on every push and clears when the share drops.
The transactional email route now runs the email send policy before it queues, so a suppressed recipient, a paused workflow, a suspended project or an unusable sender answers 400 with its code, why and fix instead of a 202 that delivery later skips. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ive it The send route now checks that the recipient's address is well formed and that its domain has mail servers, and answers 400 `invalid_recipient` with why and fix. Delivery keeps its own check, which skips the send when a domain stops taking mail after the 202. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A send check that fails in the CDP service now reaches the caller with its code, why, fix and docs link, instead of a 503. Every refused send carries the docs link for its code. A `from` address that no verified sender can send from answers `sender_not_allowed`, so callers can tell it from a project with no verified sender at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The worker reloads a workflow's live steps when it dequeues a job, so a template edit after the 202 changed an email that was already queued. A transactional email now runs the steps of the version it was accepted at, read from the workflow's revisions. Other workflows keep picking up live edits. When no revision holds that version, it sends the live one and counts it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A queued transactional email is now recognized by its own event, and runs the trigger of its accepted version too, so a later trigger edit cannot unpin it. A step marked sensitive after the send was accepted stays sensitive, and a version whose step holds secret inputs runs live, because revisions do not store secrets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An admission refusal's detail read "Skipping send: ...", although the send was refused and never queued. The policy and the address check now state what they found, and the delivery log adds "Skipping send:". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silthus
force-pushed
the
feat/email-send-admission-checks
branch
from
October 24, 2026 17:28
5cec76f to
ca8b9f0
Compare
Silthus
force-pushed
the
feat/email-send-code-form
branch
from
October 24, 2026 17:28
f55e16e to
b20afdb
Compare
This was referenced Oct 25, 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.
Moved here from #121850, closed on 2026-10-25 so this fork stack is the only copy. It opens upstream again after review.
Problem
202can still be skipped later in the worker: a suppressed or invalid recipient, a paused workflow, a suspended project, or an unverified sender. The caller sees success and the email never leaves. Contract #120921 promises "no silent skips": those checks answer before the202, withwhyandfix.202and the worker run went out with the new content, so the caller could not tell which version they sent.Impact
Pays into Grow Workflows through billed
workflows_emailsactions per paying org (not measured yet as a monthly count). In scope: Messaging, email API sends. Expected move: small, up: a caller who learns why a send failed fixes it instead of churning. Run cost: one suppression lookup and one cached MX lookup per send, before the queue.Merge Danger
Warning
🟡 Merge risk: medium · two-way door: no migration and no queued-format change, so a revert restores the old behavior (merge-risk rubric)
202. A wrong lookup would send the wrong content. A missing revision, or a step with secret inputs, falls back to the live version and countscdp_hogflow_pinned_version_missing_total.workflows-transactional-email-apiflag. It stays off until every stack PR has deployed on Django, cdp-api, the hogflow worker and the email worker (#121272 has the reason). Before that, an old Django would read a new cdp-api's refusal as a retryable503.Changes
What a caller now sees
400before queueing when a send check fails. The body carriescode,detail,attr,why,fixanddocs_url. Nothing is queued, and the idempotency key is released, so a fixed retry with the same key goes through.codeattrinvalid_recipienttorecipient_suppressedtotemplate_pausedsending_suspendedsender_not_verifiedfromsender_not_allowedfromnames an address no verified sender coversfromsender_not_verifiedkeeps its meaning for a project with no verified sender at all. An explicitfromoff the verified domains is nowsender_not_allowed, as the contract names it. It wassender_not_verifiedon #121272.detailsays what the check found, without run-log wording. The worker's run log writes "Skipping send." before the same detail.429body of the existing throttling. It tells the two cases apart:throttled(rate limit, retry) andquota_limited(monthly quota, do not retry).202before any check runs.202applies to the next send, not to one already queued.202stays sensitive, and a step with secret inputs runs the live version.How it works
EmailSendPolicy.check(candidate)after the idempotency reserve and before the quota check. It is the same policy the worker runs at delivery, so the two cannot drift.EmailValidationService.findUndeliverable, the syntax and MX check the worker already used to skip a recipient. It fails open when DNS errors.EmailValidationServiceinstance as the hog flow executor, so both read one MX cache.400with a send-check code toRejected(code, detail, why, fix)and renders the full error body.$transactional_emailand whoseflowVersionis older. So a trigger edit after the202cannot unpin it. The lookup is cached per flow and version.sensitiveflag of each email step, and the flag only turns on.cdp_hogflow_pinned_version_missing_total, and runs the live version.$transactional_emailevent, also when it refreshes the person.masterdecided this from the live trigger, so a trigger edit after the202could change it.Mechanical:
getSkipReasonnow delegates tofindUndeliverable;emailPauseMetadatais extracted for reuse.How did you test this code?
Test rationale: each case below failed before its fix and passes after it.
Test seams:
400body, the outcome counter, and that nothing was queued.400 template_paused. After the pause is lifted, the same key and body answer202and queue one email. It catches a refusal that keeps the key.detaildoes not start with "Skipping send".sender_not_verifiedand queues nothing.429tellsthrottledfromquota_limited, and an explicitfromoff the verified domains answerssender_not_allowed.loadHogFlows: a transactional email edited after its202runs the accepted version, also when the edit changes the trigger toschedule. A step turned sensitive after the202stays sensitive. A step with secret inputs runs the live version. An event workflow runs its live version.Red before green:
Expected - 1, Received + 1: the edited exit reason) and passes on HEAD.test_transactional_email.pyfail. They pass on HEAD.Local gate at the stack top
987b927630e, which holds this head unchanged, all green: CDP jest 3690 (1 skipped), cdp-api serial 288, pytest 1764, repo-wide mypy, nodejstsc, and the rest of the gate. The pre-push preflight ran in strict mode with 0 failures.Live run at
987b927630e(Django, cdp-api and the email worker on a migrated clone of the local test database, delivering to maildev), case 05: a code send with a cc the project suppresses answered400 recipient_suppressedwithattr: "cc",whyandfix. The job count stayed the same, and after 15 seconds maildev held nothing.Earlier live run at
1e18413cd1c, before the review fixes: a suppressedtoCross-version (base
b20afdb4465, headca8b9f00c38, real cdp-api route, worker and Django handling in each tree):202, this head's DjangoQueued.400toUnavailable, so the caller gets a503withoutwhyandfix.202, base cdp-api and this head's workerGaps:
202. The worker tests and the cross-version harness show the pin.Release status
Docs update
None. The transactional email API docs page is written after the stack lands.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5 (
claude-opus-5-5)Open: the rollout decision on #121272: keep the deploy order plus the flag, or give code sends their own cdp-api path so an old cdp-api answers
404and Django answers503(➡️ the current plan is the deploy order plus the flag).Gap: the cross-version base-built values sit in proof storage, not in committed tests.
Review (GPT-6.1 Sol, round 1 over the whole stack, then a final read of the fixes):
invalid_recipientnames the recipient addressinvalid_recipientname the recipient so a caller can skip it, asmaster'srecipient_suppresseddoes.The stack's QA swarm then reviewed this layer. Round 1 fixed the pin (decided from the run's own event, trigger from the revision,
sensitivekept, live version for secret inputs), the refusaldetailwording, and three smaller items. Round 2 fixed person masking on a pinned run and two copy nits. Final read 1 and the rebase check in final read 3 found nothing.Involvement: strand conductor relays answered, one choice from Michael on replay scope, no grilling rounds. Reviews: GPT-6.1 Sol round 1 over the whole stack and a final read of the fixes. Stack QA swarm: design pass (GPT-6.1 Sol high); round 1 and round 2 (review and team lanes GPT-6.1 Sol high, fresh eyes Claude Opus 5.5 high); final read 1 and final read 3 over the rebase (GPT-6.1 Sol high, clean); fixers Claude Opus 5.5 high; cross-version proof (Claude Opus 5.5); live run at the stack top.
/tdd,/improving-drf-endpoints,/writing-tests,/writing-code-comments,/writing-pr-descriptions.example.comand.invaliddomains.🤖 Generated with Claude Code