Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(workflows): report a test send with no recipient as skipped (#127281)

Michael Reichenbach7496111e7a19
diff --git a/nodejs/src/cdp/services/messaging/email.service.test.ts b/nodejs/src/cdp/services/messaging/email.service.test.ts
index f75e6ade4d29..82decc3b4b5e 100644
--- a/nodejs/src/cdp/services/messaging/email.service.test.ts
+++ b/nodejs/src/cdp/services/messaging/email.service.test.ts
@@ -1470,6 +1470,10 @@ describe('EmailService', () => {
expect(result.error).toBeUndefined()
expect(result.metrics.map((m) => m.metric_name)).toEqual(['email_missing_recipient'])
expect(result.skipped).toBe(true)
+ expect(result.emailSendResult).toEqual({
+ status: 'skipped',
+ reason: expect.stringContaining('the recipient has no email address'),
+ })
expect(invocation.state.vmState?.stack).toEqual([{ success: false }])
})
diff --git a/nodejs/src/cdp/services/messaging/email.service.ts b/nodejs/src/cdp/services/messaging/email.service.ts
index 9967187c63fa..ae1f2961ce96 100644
--- a/nodejs/src/cdp/services/messaging/email.service.ts
+++ b/nodejs/src/cdp/services/messaging/email.service.ts
@@ -589,10 +589,10 @@ export class EmailService {
// so record a skip with its own metric instead of an `email_failed`. Otherwise one project
// with bad data inflates the platform send failure rate.
if (!params.to?.email?.trim()) {
- addLog(
- 'warn',
+ const skipReason =
'Skipping send: the recipient has no email address. Add a filter so only people with an email address reach this step.'
- )
+ addLog('warn', skipReason)
+ result.emailSendResult = { status: 'skipped', reason: skipReason }
if (!isTest) {
result.metrics.push({
team_id: invocation.teamId,