: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(workflows): remove suppression list rollout flags (#72822)
Meikel Ratzca4a261f1a5c
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 0aa3656ab257..850cb86fa308 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -541,7 +541,6 @@ export const FEATURE_FLAGS = {WORKFLOWS_EMAIL_REPUTATION: 'workflows-email-reputation', // owner: #team-workflowsWORKFLOWS_INTERNAL_EVENT_FILTERS: 'workflows-internal-event-filters', // owner: @haven #team-workflowsWORKFLOWS_PUSH_NOTIFICATIONS: 'workflows-push-notifications', // owner: #team-workflows- WORKFLOWS_SUPPRESSION_LIST: 'workflows-suppression-list', // owner: #team-workflowsXAA_AUTHENTICATION: 'xaa-authentication', // owner: @reecejones #team-platform-features} as constexport type FeatureFlagLookupKey = keyof typeof FEATURE_FLAGSdiff --git a/nodejs/src/cdp/cdp-services.ts b/nodejs/src/cdp/cdp-services.tsindex 31ad270d75ba..238b04a6dd77 100644--- a/nodejs/src/cdp/cdp-services.ts+++ b/nodejs/src/cdp/cdp-services.ts@@ -146,8 +146,6 @@ export type CdpCoreServicesConfig = Pick<| 'SES_SECRET_ACCESS_KEY'| 'SES_REGION'| 'SES_ENDPOINT'- | 'EMAIL_SUPPRESSION_WRITE_ENABLED'- | 'EMAIL_SUPPRESSION_ENFORCE_ENABLED'| 'EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD'| 'CDP_GOOGLE_ADWORDS_DEVELOPER_TOKEN'| 'CDP_FETCH_RETRIES'@@ -401,8 +399,6 @@ export function createCdpCoreServices(// into EmailService — the pre-send suppression check lives there so every send path shares one// choke point regardless of whether the invocation came from a workflow action or a hog function.const emailSuppressionService = new EmailSuppressionService(deps.postgres, {- writeEnabled: config.EMAIL_SUPPRESSION_WRITE_ENABLED,- enforceEnabled: config.EMAIL_SUPPRESSION_ENFORCE_ENABLED,transientBounceThreshold: config.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD,})const emailService = new EmailService(diff --git a/nodejs/src/cdp/config.ts b/nodejs/src/cdp/config.tsindex 105128818c8a..b96425c9a6fb 100644--- a/nodejs/src/cdp/config.ts+++ b/nodejs/src/cdp/config.ts@@ -136,12 +136,6 @@ export type CdpConfig = ClickhouseConfig & {// means no restriction (dev/test); production should set this to the workflow SES topic ARN(s).SES_ALLOWED_SNS_TOPIC_ARNS: string- // Two independent kill switches for the email suppression list, both OFF by default so the- // feature ships dark. WRITE controls whether the SES webhook populates the list; ENFORCE- // controls whether the pre-send check actually skips suppressed recipients. Separating them- // lets us turn on writing first and observe what would be suppressed before enforcing.- EMAIL_SUPPRESSION_WRITE_ENABLED: boolean- EMAIL_SUPPRESSION_ENFORCE_ENABLED: boolean// Consecutive soft bounces before an address is auto-suppressed. Tunable without a deploy.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD: number@@ -316,8 +310,6 @@ export function getDefaultCdpConfig(): CdpConfig {SES_SECRET_ACCESS_KEY: isTestEnv() || isDevEnv() ? 'test' : '',SES_REGION: isTestEnv() || isDevEnv() ? 'us-east-1' : '',SES_ALLOWED_SNS_TOPIC_ARNS: '',- EMAIL_SUPPRESSION_WRITE_ENABLED: false,- EMAIL_SUPPRESSION_ENFORCE_ENABLED: false,EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD: 5,// Destination migration diffingdiff --git a/nodejs/src/cdp/hog-transformations/hog-transformer.service.ts b/nodejs/src/cdp/hog-transformations/hog-transformer.service.tsindex 842253625e7c..33a9f44f9405 100644--- a/nodejs/src/cdp/hog-transformations/hog-transformer.service.ts+++ b/nodejs/src/cdp/hog-transformations/hog-transformer.service.ts@@ -511,8 +511,6 @@ export function createHogTransformerService(const trackingCodeSigner = new EmailTrackingCodeSigner(config.ENCRYPTION_SALT_KEYS, config.CDP_EMAIL_TRACKING_URL)const teamWorkflowsConfigService = new TeamWorkflowsConfigService(deps.postgres)const emailSuppressionService = new EmailSuppressionService(deps.postgres, {- writeEnabled: config.EMAIL_SUPPRESSION_WRITE_ENABLED,- enforceEnabled: config.EMAIL_SUPPRESSION_ENFORCE_ENABLED,transientBounceThreshold: config.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD,})const emailService = new EmailService(diff --git a/nodejs/src/cdp/services/messaging/email-suppression.service.test.ts b/nodejs/src/cdp/services/messaging/email-suppression.service.test.tsindex d6287673e454..e917c22e6e86 100644--- a/nodejs/src/cdp/services/messaging/email-suppression.service.test.ts+++ b/nodejs/src/cdp/services/messaging/email-suppression.service.test.ts@@ -16,30 +16,16 @@ interface SuppressionRow {describe('EmailSuppressionService', () => {let hub: Hublet team: Team- let originalWriteEnv: string | undefined- let originalEnforceEnv: string | undefinedlet originalThresholdEnv: string | undefinedbeforeEach(async () => {await resetTestDatabase()hub = await createHub()team = await getFirstTeam(hub.postgres)- originalWriteEnv = process.env.EMAIL_SUPPRESSION_WRITE_ENABLED- originalEnforceEnv = process.env.EMAIL_SUPPRESSION_ENFORCE_ENABLEDoriginalThresholdEnv = process.env.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD})afterEach(async () => {- if (originalWriteEnv === undefined) {- delete process.env.EMAIL_SUPPRESSION_WRITE_ENABLED- } else {- process.env.EMAIL_SUPPRESSION_WRITE_ENABLED = originalWriteEnv- }- if (originalEnforceEnv === undefined) {- delete process.env.EMAIL_SUPPRESSION_ENFORCE_ENABLED- } else {- process.env.EMAIL_SUPPRESSION_ENFORCE_ENABLED = originalEnforceEnv- }if (originalThresholdEnv === undefined) {delete process.env.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD} else {@@ -60,9 +46,8 @@ describe('EmailSuppressionService', () => {return res.rows[0]}- describe('recordTransientBounces (write flag on, threshold=3)', () => {+ describe('recordTransientBounces (threshold=3)', () => {beforeEach(() => {- process.env.EMAIL_SUPPRESSION_WRITE_ENABLED = 'true'// Threshold=3 gives a clean boundary: 2 bounces must not flip, 3 must.process.env.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD = '3'})@@ -86,9 +71,8 @@ describe('EmailSuppressionService', () => {})})- describe('recordDeliveries (write flag on)', () => {+ describe('recordDeliveries', () => {beforeEach(() => {- process.env.EMAIL_SUPPRESSION_WRITE_ENABLED = 'true'process.env.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD = '5'})@@ -153,9 +137,8 @@ describe('EmailSuppressionService', () => {})})- describe('recordHardBounces (write flag on)', () => {+ describe('recordHardBounces', () => {beforeEach(() => {- process.env.EMAIL_SUPPRESSION_WRITE_ENABLED = 'true'// Threshold irrelevant — hard bounces suppress on the first hit.process.env.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD = '5'})@@ -222,12 +205,6 @@ describe('EmailSuppressionService', () => {})describe('cache invalidation', () => {- beforeEach(() => {- process.env.EMAIL_SUPPRESSION_WRITE_ENABLED = 'true'- process.env.EMAIL_SUPPRESSION_ENFORCE_ENABLED = 'true'- process.env.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD = '5'- })-it("a write for one team does not evict another team's cached entries", async () => {// Guards against a regression from markForRefresh(touchedKeys) back to clear() — clear()// would drop every team's cache on any write, causing a thundering-herd read against@@ -267,50 +244,26 @@ describe('EmailSuppressionService', () => {})describe('isSuppressed', () => {- it('returns false when enforcement is disabled, even if a suppressed row exists (dark-launch gate)', async () => {- // enforce env deliberately left unset — the gate must short-circuit before hitting the DB.+ it.each([+ ['returns true for a suppressed row', true],+ ['returns false for an identifier that is not on the list', false],+ ])('%s', async (_label, expected) => {const svc = new EmailSuppressionService(hub.postgres, emailSuppressionConfigFromEnv())- const email = '[email protected]'- await hub.postgres.query(- PostgresUse.COMMON_WRITE,- `INSERT INTO posthog_messagesuppression- (id, team_id, identifier, source, reason, transient_bounce_count,- suppressed, suppressed_at, deleted, created_at, updated_at)- VALUES (gen_random_uuid(), $1, $2, 'BOUNCE', 'test row', 5,- true, NOW(), false, NOW(), NOW())`,- [team.id, email],- 'test-insert-suppression'- )-- expect(await svc.isSuppressed(team.id, email)).toBe(false)- })-- describe('with enforcement enabled', () => {- beforeEach(() => {- process.env.EMAIL_SUPPRESSION_ENFORCE_ENABLED = 'true'- })+ const email = expected ? '[email protected]' : '[email protected]'+ if (expected) {+ await hub.postgres.query(+ PostgresUse.COMMON_WRITE,+ `INSERT INTO posthog_messagesuppression+ (id, team_id, identifier, source, reason, transient_bounce_count,+ suppressed, suppressed_at, deleted, created_at, updated_at)+ VALUES (gen_random_uuid(), $1, $2, 'BOUNCE', 'test row', 5,+ true, NOW(), false, NOW(), NOW())`,+ [team.id, email],+ 'test-insert-suppression'+ )+ }- it.each([- ['returns true for a suppressed row', true],- ['returns false for an identifier that is not on the list', false],- ])('%s', async (_label, expected) => {- const svc = new EmailSuppressionService(hub.postgres, emailSuppressionConfigFromEnv())- const email = expected ? '[email protected]' : '[email protected]'- if (expected) {- await hub.postgres.query(- PostgresUse.COMMON_WRITE,- `INSERT INTO posthog_messagesuppression- (id, team_id, identifier, source, reason, transient_bounce_count,- suppressed, suppressed_at, deleted, created_at, updated_at)- VALUES (gen_random_uuid(), $1, $2, 'BOUNCE', 'test row', 5,- true, NOW(), false, NOW(), NOW())`,- [team.id, email],- 'test-insert-suppression'- )- }-- expect(await svc.isSuppressed(team.id, email)).toBe(expected)- })+ expect(await svc.isSuppressed(team.id, email)).toBe(expected)})})})diff --git a/nodejs/src/cdp/services/messaging/email-suppression.service.ts b/nodejs/src/cdp/services/messaging/email-suppression.service.tsindex 02b8da165f35..f72b0bf40a2f 100644--- a/nodejs/src/cdp/services/messaging/email-suppression.service.ts+++ b/nodejs/src/cdp/services/messaging/email-suppression.service.ts@@ -17,10 +17,6 @@ const normalizeIdentifier = (email: string): string => email.trim().toLowerCase(const toKey = (teamId: number, identifier: string): string => `${teamId}:${identifier}`export type EmailSuppressionConfig = {- // Populate the list on soft bounces / hard bounces / deliveries.- writeEnabled: boolean- // Skip sends to suppressed recipients (pre-send hook).- enforceEnabled: boolean// Consecutive soft bounces before auto-suppression.transientBounceThreshold: number}@@ -28,12 +24,9 @@ export type EmailSuppressionConfig = {// Test helper — production paths take config from `CdpConfig`; tests that still mutate process.env// can call this to construct the same shape without duplicating the parse logic.export function emailSuppressionConfigFromEnv(): EmailSuppressionConfig {- const flagOn = (value: string | undefined): boolean => value === '1' || value?.toLowerCase() === 'true'const rawThreshold = process.env.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLDconst parsedThreshold = rawThreshold ? parseInt(rawThreshold, 10) : NaNreturn {- writeEnabled: flagOn(process.env.EMAIL_SUPPRESSION_WRITE_ENABLED),- enforceEnabled: flagOn(process.env.EMAIL_SUPPRESSION_ENFORCE_ENABLED),transientBounceThreshold: Number.isFinite(parsedThreshold) && parsedThreshold > 0 ? parsedThreshold : 5,}}@@ -62,16 +55,12 @@ export function emailSuppressionConfigFromEnv(): EmailSuppressionConfig {*/export class EmailSuppressionService {private readonly threshold: number- private readonly writeEnabled: boolean- private readonly enforceEnabled: booleanprivate readonly lazyLoader: LazyLoader<boolean>constructor(private postgres: PostgresRouter,config: EmailSuppressionConfig) {- this.writeEnabled = config.writeEnabled- this.enforceEnabled = config.enforceEnabledthis.threshold = config.transientBounceThresholdthis.lazyLoader = new LazyLoader({name: 'email_suppression',@@ -85,10 +74,6 @@ export class EmailSuppressionService {/** Pre-send check: is this recipient currently on the team's suppression list? */public async isSuppressed(teamId: number, email: string): Promise<boolean> {- // Enforcement is gated: when off, the list never blocks a send (writes may still populate it).- if (!this.enforceEnabled) {- return false- }const identifier = normalizeIdentifier(email)if (!identifier) {return false@@ -112,9 +97,6 @@ export class EmailSuppressionService {* entries keep their suppressed state untouched.*/public async recordTransientBounces(teamId: number, emails: string[], diagnostic?: string): Promise<void> {- if (!this.writeEnabled) {- return- }const identifiers = Array.from(new Set(emails.map(normalizeIdentifier).filter(Boolean)))if (identifiers.length === 0) {return@@ -184,9 +166,6 @@ export class EmailSuppressionService {* touched. If a row already exists as an unsuppressed BOUNCE counter, this escalates it.*/public async recordHardBounces(teamId: number, emails: string[], diagnostic?: string): Promise<void> {- if (!this.writeEnabled) {- return- }const identifiers = Array.from(new Set(emails.map(normalizeIdentifier).filter(Boolean)))if (identifiers.length === 0) {return@@ -252,9 +231,6 @@ export class EmailSuppressionService {* recorded bounce.*/public async recordDeliveries(teamId: number, emails: string[], deliveryTimestamp?: string): Promise<void> {- if (!this.writeEnabled) {- return- }const identifiers = Array.from(new Set(emails.map(normalizeIdentifier).filter(Boolean)))if (identifiers.length === 0) {returndiff --git a/nodejs/src/cdp/services/messaging/email-tracking.service.test.ts b/nodejs/src/cdp/services/messaging/email-tracking.service.test.tsindex aaf6bb514615..0e05920d1b21 100644--- a/nodejs/src/cdp/services/messaging/email-tracking.service.test.ts+++ b/nodejs/src/cdp/services/messaging/email-tracking.service.test.ts@@ -401,7 +401,7 @@ describe('EmailTrackingService', () => {})describe('SES webhook writes to the suppression list', () => {- // EmailSuppressionService reads its flags from `hub.EMAIL_SUPPRESSION_*` (via CdpConfig),+ // EmailSuppressionService reads its threshold from `hub.EMAIL_SUPPRESSION_*` (via CdpConfig),// not directly from process.env. The outer beforeEach recreates `hub` per test, so overriding// here doesn't leak across tests — no restore in afterEach needed. Threshold=1 keeps the test// to a single POST — the counter arithmetic is not what this test is guarding, the write-path@@ -412,7 +412,6 @@ describe('EmailTrackingService', () => {let verifySignatureSpy: jest.SpyInstancebeforeEach(() => {- hub.EMAIL_SUPPRESSION_WRITE_ENABLED = truehub.EMAIL_SUPPRESSION_TRANSIENT_BOUNCE_THRESHOLD = 1api = new CdpApi(hub, createCdpConsumerDeps(hub), {diff --git a/nodejs/src/cdp/services/messaging/recipient-preferences.service.test.ts b/nodejs/src/cdp/services/messaging/recipient-preferences.service.test.tsindex 3e39db4b725e..2bc0e4b086cc 100644--- a/nodejs/src/cdp/services/messaging/recipient-preferences.service.test.ts+++ b/nodejs/src/cdp/services/messaging/recipient-preferences.service.test.ts@@ -346,31 +346,9 @@ describe('RecipientPreferencesService', () => {expect(mockRecipientsManagerGetAllMarketingMessagingPreference).toHaveBeenCalledWith(recipient)})- describe('when the recipient is on the suppression list (enforce enabled)', () => {- // EmailSuppressionService reads EMAIL_SUPPRESSION_ENFORCE_ENABLED once in its- // constructor, so we flip the env then rebuild both services so the fresh instance- // reads it. Suppression is a deliverability signal that must apply even to- // transactional messages — the parameterized case guards that ordering.- let originalEnforceEnv: string | undefined-- beforeEach(() => {- originalEnforceEnv = process.env.EMAIL_SUPPRESSION_ENFORCE_ENABLED- process.env.EMAIL_SUPPRESSION_ENFORCE_ENABLED = 'true'- mockEmailSuppressionService = new EmailSuppressionService(- hub.postgres,- emailSuppressionConfigFromEnv()- )- service = new RecipientPreferencesService(mockRecipientsManager, mockEmailSuppressionService)- })-- afterEach(() => {- if (originalEnforceEnv === undefined) {- delete process.env.EMAIL_SUPPRESSION_ENFORCE_ENABLED- } else {- process.env.EMAIL_SUPPRESSION_ENFORCE_ENABLED = originalEnforceEnv- }- })-+ describe('when the recipient is on the suppression list', () => {+ // Suppression is a deliverability signal that must apply even to transactional+ // messages — the parameterized case guards that ordering.const insertSuppressionRow = async (email: string): Promise<void> => {await hub.postgres.query(PostgresUse.COMMON_WRITE,diff --git a/products/workflows/frontend/WorkflowsScene.test.ts b/products/workflows/frontend/WorkflowsScene.test.tsdeleted file mode 100644index 17a438bb9005..000000000000--- a/products/workflows/frontend/WorkflowsScene.test.ts+++ /dev/null@@ -1,47 +0,0 @@-import { router } from 'kea-router'-import { expectLogic } from 'kea-test-utils'--import { FEATURE_FLAGS } from 'lib/constants'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'--import { initKeaTests } from '~/test/init'--import { workflowsSceneLogic } from './WorkflowsScene'--describe('workflowsSceneLogic', () => {- beforeEach(() => {- initKeaTests()- featureFlagLogic.mount()- })-- describe('deep-link to /workflows/suppression', () => {- // Guards the "flag-off user hits the suppression URL, activeKey stays 'suppression', but- // the tab isn't in the tabs list" edge case — LemonTabs would render with no matching tab- // and an empty content area. The logic should fall back to 'workflows' when the flag is off.- it('falls back to workflows when WORKFLOWS_SUPPRESSION_LIST flag is off', async () => {- featureFlagLogic.actions.setFeatureFlags([], {})- const logic = workflowsSceneLogic()- logic.mount()-- await expectLogic(logic, () => {- router.actions.push('/workflows/suppression')- }).toMatchValues({- currentTab: 'workflows',- })- })-- it('honors the suppression tab when the flag is on', async () => {- featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.WORKFLOWS_SUPPRESSION_LIST], {- [FEATURE_FLAGS.WORKFLOWS_SUPPRESSION_LIST]: true,- })- const logic = workflowsSceneLogic()- logic.mount()-- await expectLogic(logic, () => {- router.actions.push('/workflows/suppression')- }).toMatchValues({- currentTab: 'suppression',- })- })- })-})diff --git a/products/workflows/frontend/WorkflowsScene.tsx b/products/workflows/frontend/WorkflowsScene.tsxindex a98d86309145..bee723151b30 100644--- a/products/workflows/frontend/WorkflowsScene.tsx+++ b/products/workflows/frontend/WorkflowsScene.tsx@@ -121,13 +121,6 @@ export const workflowsSceneLogic = kea<workflowsSceneLogicType>([let possibleTab: WorkflowsSceneTab = (tab as WorkflowsSceneTab) ?? 'workflows'possibleTab = WORKFLOW_SCENE_TABS.includes(possibleTab) ? possibleTab : 'workflows'- // The suppression tab is only rendered when its feature flag is on. Without this- // guard, a flag-off user deep-linking to /workflows/suppression would set currentTab- // to a tab that isn't in the tabs list — LemonTabs would show no active tab and no- // content. Fall back to 'workflows' so the scene stays usable.- if (possibleTab === 'suppression' && !values.featureFlags[FEATURE_FLAGS.WORKFLOWS_SUPPRESSION_LIST]) {- possibleTab = 'workflows'- }if (possibleTab === 'reputation' && !values.featureFlags[FEATURE_FLAGS.WORKFLOWS_EMAIL_REPUTATION]) {possibleTab = 'workflows'}@@ -211,10 +204,6 @@ export function WorkflowsScene(props: WorkflowsSceneProps = {}): JSX.Element {: []),]- // Suppression list is hidden until enforcement rolls out — until then the tab would show- // entries that don't yet block sends, which would be confusing.- const suppressionListEnabled = !!featureFlags[FEATURE_FLAGS.WORKFLOWS_SUPPRESSION_LIST]-const tabs: LemonTab<WorkflowsSceneTab>[] = [{label: 'Workflows',@@ -244,21 +233,17 @@ export function WorkflowsScene(props: WorkflowsSceneProps = {}): JSX.Element {content: <OptOutScene />,link: urls.workflows('opt-outs'),},- ...(suppressionListEnabled- ? [- {- label: (- <span className="inline-flex items-center gap-1.5">- Suppression list- <LemonTag type="completion">Beta</LemonTag>- </span>- ),- key: 'suppression' as const,- content: <SuppressionScene />,- link: urls.workflows('suppression'),- },- ]- : []),+ {+ label: (+ <span className="inline-flex items-center gap-1.5">+ Suppression list+ <LemonTag type="completion">Beta</LemonTag>+ </span>+ ),+ key: 'suppression',+ content: <SuppressionScene />,+ link: urls.workflows('suppression'),+ },...(emailReputationEnabled? [{