: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
feat(flags): enable feature-flag-called dedup on turbo and team2 lanes (#66194)
Phil Haackf8fe28077c73
diff --git a/nodejs/src/ingestion/config.ts b/nodejs/src/ingestion/config.tsindex 0dd75371a606..de99fdcd8238 100644--- a/nodejs/src/ingestion/config.ts+++ b/nodejs/src/ingestion/config.ts@@ -78,7 +78,16 @@ export type KafkaConsumerBaseConfig = Pick<export type PersonBatchWritingDbWriteMode = 'NO_ASSERT' | 'ASSERT_VERSION'export type PersonBatchWritingMode = 'BATCH' | 'SHADOW' | 'NONE'-export type IngestionLane = 'main' | 'overflow' | 'turbo' | 'historical' | 'async'+/**+ * Real-time lanes process live events and share `main`'s processing-time SLO.+ * Delayed lanes process backfilled or async events on their own timeline. The+ * distinction is load-bearing for processing-time logic like dedup, so the lane+ * type is derived from these two sets to keep the categorization in one place.+ */+export const REALTIME_INGESTION_LANES = ['main', 'overflow', 'turbo', 'team2'] as const+export const DELAYED_INGESTION_LANES = ['historical', 'async'] as const++export type IngestionLane = (typeof REALTIME_INGESTION_LANES)[number] | (typeof DELAYED_INGESTION_LANES)[number]export type IngestionConsumerConfig = {INGESTION_LANE: IngestionLane | nulldiff --git a/nodejs/src/ingestion/utils/feature-flag-called-dedup/feature-flag-called-dedup-service.test.ts b/nodejs/src/ingestion/utils/feature-flag-called-dedup/feature-flag-called-dedup-service.test.tsindex 1954da560e47..184bf8dceb97 100644--- a/nodejs/src/ingestion/utils/feature-flag-called-dedup/feature-flag-called-dedup-service.test.ts+++ b/nodejs/src/ingestion/utils/feature-flag-called-dedup/feature-flag-called-dedup-service.test.ts@@ -117,6 +117,8 @@ describe('RedisFeatureFlagCalledDedupService', () => {it.each<[IngestionLane | null, boolean]>([['main', true],['overflow', true],+ ['turbo', true],+ ['team2', true],[null, true],['historical', false],['async', false],diff --git a/nodejs/src/ingestion/utils/feature-flag-called-dedup/feature-flag-called-dedup-service.ts b/nodejs/src/ingestion/utils/feature-flag-called-dedup/feature-flag-called-dedup-service.tsindex 7ab2ae26c56e..be43683672e3 100644--- a/nodejs/src/ingestion/utils/feature-flag-called-dedup/feature-flag-called-dedup-service.ts+++ b/nodejs/src/ingestion/utils/feature-flag-called-dedup/feature-flag-called-dedup-service.ts@@ -4,7 +4,7 @@ import { Redis } from 'ioredis'import { timeoutGuard } from '~/common/utils/db/utils'import { parseTeamsList } from '~/common/utils/env-utils'import { logger } from '~/common/utils/logger'-import { IngestionConsumerConfig, IngestionLane } from '~/ingestion/config'+import { IngestionConsumerConfig, IngestionLane, REALTIME_INGESTION_LANES } from '~/ingestion/config'import { RedisPool } from '~/types'import { featureFlagCalledDedupRedisLatency, featureFlagCalledDedupRedisOpsTotal } from './metrics'@@ -150,8 +150,14 @@ export type FeatureFlagCalledDedupEnvConfig = Pick<| 'INGESTION_FEATURE_FLAG_CALLED_DEDUP_TTL_SECONDS'>-/** Lanes that may dedup. `null` covers local dev, where no lane is set. */-const DEDUP_ALLOWED_LANES: readonly (IngestionLane | null)[] = ['main', 'overflow', null]+/**+ * Lanes that may dedup: the real-time lanes plus `null` for local dev, where+ * no lane is set. Derived from REALTIME_INGESTION_LANES so a new real-time+ * lane is covered automatically; delayed lanes are excluded by construction.+ * See `createFeatureFlagCalledDedupService` for why delayed lanes must never+ * dedup.+ */+const DEDUP_ALLOWED_LANES: readonly (IngestionLane | null)[] = [...REALTIME_INGESTION_LANES, null]/*** Builds the dedup service from ingestion config, or undefined when the dedup@@ -160,7 +166,9 @@ const DEDUP_ALLOWED_LANES: readonly (IngestionLane | null)[] = ['main', 'overflo* The dedup window is processing-time, not event-time, so lanes that process* delayed events (historical, async) must never dedup: a backfilled event is* not a duplicate of the live event that claimed its tuple an hour ago. The- * lane gate holds even if the dedup env vars leak into a shared config.+ * real-time lanes in DEDUP_ALLOWED_LANES all share that processing-time+ * window, so they may dedup. The lane gate holds even if the dedup env vars+ * leak into a shared config.*/export function createFeatureFlagCalledDedupService(redisPool: RedisPool,