Repository navigation
chore(cdp): drive email service tests through a faithful SES fake - #132730
Conversation
The email service tests asserted on the arguments of spied SES SDK calls. They now send through the real SESv2 client to an in-process SES v2 fake and assert on the delivered message, and they read produced email status and message asset rows from recording ingestion outputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
😎 Stack merged successfully - details. |
🤖 CI report✅ Trunk lane — non-backend laneThis 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. ✅ Duplication (Python) — cleanNew Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying. ✅ Duplication (TypeScript) — cleanNew TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying. |
There was a problem hiding this comment.
PostHog Review · Standard · reviewed fade0df: 1 Should fix.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
The SDK's default credential chain skips the environment key pair when AWS_PROFILE is set, so a developer with a profile hit their real profile instead of the fake's static credentials. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SES refuses a subject or body part that has no Data. The fake accepted one, so an html-only send that also emitted an empty Text part passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Risk: No findings Test-only change: replaces SES SDK call spying in email.service.test.ts with an in-process SES v2 HTTP fake and a helper that records ingestion outputs as JSON. No production code changes, and the fake binds to 127.0.0.1 with dummy credentials, so no new attack surface. Sentinel reviewed |
PR overviewNo security issues were found in this pull request. Reviews
|
|
/trunk merge |
|
/trunk cancel |
|
/trunk merge |
|
/trunk cancel |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New commits were pushed — dismissing the stamphog approval from an earlier head. Re-add the trigger label to request a fresh review.
There was a problem hiding this comment.
Approved.
Contained test-only changes with no production-path edits, guard suppressions, or unresolved substantive review concerns. A current-head agent review also reports no findings.
- Author wrote 25% of the modified lines and has 8 merged PRs in these paths (familiarity MODERATE).
- PostHog Review (Standard) reviewed the current head: no findings.
- posthog[bot] reviewed the current head.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 0L, 0F substantive, 809L/3F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (809L, 3F, single-area, chore) |
| stamphog 2.7.0 | .stamphog/policy.yml @ 401c9e8 · reviewed head 401c9e8 |
|
/trunk merge |
Deploy status
This table shows the |
…ocess SES fake Master's email service suite now sends through the real SESv2 client to an in-process SES fake (#132730) and already covers most of this outcome matrix. Add the cases it lacks there: shadow mode charges the team budget and sends past an empty one, every to, cc and bcc copy is charged and a send with more copies than the budget takes all of it and still sends, and a send that a team suspension, a workflow pause or the suppression list skips spends neither the workflow pacing nor the team budget. Drop the Docker SES fake, its CI step, compose service, package scripts and handbook line, which only served the separate suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fake (#127175) * chore(workflows): cover the email send outcome matrix Send test email through a local SES fake, so the send outcome matrix runs against real SDK requests without mocking SES. * test(workflows): tighten the email outcome matrix after review - Use the production Redis pool and drop the TestRedisV2 copy. - Cap and pacing cases assert their own log reason and a drained bucket, so a limiter outage cannot pass for a denial. - Rows carry their own setup and expected values; tests with two flows are split. - Titles name the behavior only, without matrix numbers or fork references. - Drop the harness self-test and the duplicate SES throttle row. - Keep the handbook to how to run the suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(workflows): name the start command when the local SES fake is down The SES suite runs in the default Jest set, but the fake sits behind the compose `ses` profile. A run without it now fails with the command that starts it, instead of an error that reads like a regression. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(workflows): share one Valkey pool across the SES suite RedisV2 has no close, so a pool per test left one connection per test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(workflows): start the SES fake in test:full and services:start Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(workflows): close the SES suite's redis client so jest exits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(cdp): pass the activation reporter in the local SES email tests EmailService now takes a required WorkflowsActivationReporter (#127135). The local SES suite built the service without it and stopped compiling after the master merge. It passes a stub, as the email service suite does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(workflows): move the uncovered email budget cases onto the in-process SES fake Master's email service suite now sends through the real SESv2 client to an in-process SES fake (#132730) and already covers most of this outcome matrix. Add the cases it lacks there: shadow mode charges the team budget and sends past an empty one, every to, cc and bcc copy is charged and a send with more copies than the budget takes all of it and still sends, and a send that a team suspension, a workflow pause or the suppression list skips spends neither the workflow pacing nor the team budget. Drop the Docker SES fake, its CI step, compose service, package scripts and handbook line, which only served the separate suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(workflows): pin each skip gate's own metric and the full starting budget Assert that each skipped send records its own gate's metric with no error, and that the shadow test starts from a full budget, so a send that stops early for another reason cannot pass as a gate skip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Note
🔵 Merge risk: low · two-way door
Problem
Changes
email.service.test.tssends through the real SESv2 client to an in-process SES v2 fake, and asserts on the delivered message.How did you test this code?
Test rationale: no new behavior. Mutating
email.service.tsshows the rewritten tests guard the same regressions:Mutation run details
perTestcoverage anddisableBail, so every killing test is recorded.email.service.ts; only the test file differs.Release status
Docs update
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5
Skills:
/full-stop,/stamp-pr,/merge-risk,/qa-swarm,/writing-tests,/writing-code-comments,/writing-pr-descriptionsMore context for AI agents
fake-ses.tslives innodejs/src/cdp/_tests/;recording-ingestion-outputs.tslives innodejs/tests/helpers/besidecreateMockIngestionOutputs.Date.nowonly, so SDK retry timers stay real and the reschedule lands exactly 500 to 1000 ms past it.AWS_PROFILEwhile it runs, because the SDK ignores the env key pair when a profile is set.email.service.test.ts;email-status.service.test.tsproduce assertions; the CDP consumer suites that usemockQueueInvocationsandmockProducer.nodejs/src/cdp/_tests/fake-ses.ts, the request validation and fault handling.🤖 Generated with Claude Code