Repository navigation
fix(cdp): treat malformed transactional email recipients as unreachable - #125908
trunk-io[bot] merged 1 commit into
Conversation
|
😎 Merged successfully - details. |
🤖 CI report✅ Trunk lane — non-backend lane (
|
| File | Comment lines | Added lines |
|---|---|---|
nodejs/src/cdp/cdp-api.ts |
2 | 11 |
This check does not block merging. It updates on every push and clears when the share drops.
HostHog preview —
|
0686d7f to
f049ca2
Compare
|
Risk: No findings This PR changes cdp-api's transactional-email send endpoint to answer a syntactically malformed recipient address with 422 recipient_unreachable (the same outcome as its existing no-mail-server check) instead of 400 invalid_request, and adds a warn log of validation issue paths/codes — never values — for the remaining 400 cases. I traced the new branch end to end (zod schema, classifier condition, check ordering, Django-side error mapping in posthog/email.py) and found no security issue: the 422 fires before any queueing, idempotency, or quota action, only the Sentinel reviewed |
There was a problem hiding this comment.
Approved.
The risky email-send behavior has owning-team authorship assurance and focused regression coverage. No unresolved review concerns or other policy refusal grounds were found.
- Author wrote 0% of the modified lines and has 38 merged PRs in these paths (familiarity MODERATE).
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 11L, 1F substantive, 47L/2F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (47L, 2F, single-area, fix) |
| stamphog 2.6.1 | .stamphog/policy.yml @ f049ca2 · reviewed head f049ca2 |
Problem
user@ph。example.com) passes Django's validation but fails cdp-api's.Changes
recipient_unreachable.invalid_request, and cdp-api now logs which fields failed. It logs field names and error codes, never the values.How did you test this code?
Locally, through Django's send endpoint, then cdp-api, the email worker, maildev and the dev Postgres. Ran on master first, then on this branch.
user@ph。example.com, plus U+FF0E, U+FE52 and U+2024 dotsdelivery_unavailable, metricinvalid_request+4recipient_unreachable, metricrecipient_unreachable+4posthog/email.pyWorkflowsEmailError, no send recordvariablesas a listissues:[{path:"variables",code:"invalid_type"}]Not checked: the six Celery retries and the alert itself. Both follow from code this PR doesn't change.
Test rationale: one parameterized case list in the existing transactional email block of
cdp-api.serial.test.ts. It fails if a bad address goes back to a 400, if another invalid field gets reported as unreachable, or if the log starts including the address.Release status
Docs update
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, claude-opus-5-5
Skills:
/posthog-local-e2e-qa,/writing-tests,/writing-pr-descriptions,/writing-plainlyMore context for AI agents
ivan@пример.рф; converting the domain to punycode before the check would fix that.issues.every(...)condition incdp-api.ts, which decides between 422 and 400.🤖 Generated with Claude Code