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.

chore(flags): test mode 2 flag calls reach events without the fork (#127892)

Phil Haackac888f432887
diff --git a/nodejs/tests/ingestion/flag-evaluations-e2e.test.ts b/nodejs/tests/ingestion/flag-evaluations-e2e.test.ts
index e673f346d6ff..1215b9448039 100644
--- a/nodejs/tests/ingestion/flag-evaluations-e2e.test.ts
+++ b/nodejs/tests/ingestion/flag-evaluations-e2e.test.ts
@@ -171,6 +171,35 @@ describe('Flag evaluations shadow-routing E2E', () => {
}
)
+ // Some lanes run without the fork. An operator can also turn the fork off on any lane.
+ // Only the fork step removes a call from events, so a lane without it must still store the call there.
+ testWithTeamIngester(
+ 'FLAG_EVALUATIONS_ONLY team on a lane without the fork: the call lands in events',
+ {
+ teamOverrides: { flag_evaluations_mode: FlagEvaluationsMode.FlagEvaluationsOnly },
+ pluginServerConfig: {
+ INGESTION_FLAG_EVALUATIONS_MODE: 'disabled',
+ INGESTION_OUTPUT_REALTIME_ONLY_EVENTS_TOPIC: KAFKA_REALTIME_ONLY_EVENTS_JSON,
+ },
+ },
+ async ({ ingester, team, kafkaProducer, token }) => {
+ const event = new EventBuilder(team)
+ .withEvent('$feature_flag_called')
+ .withProperties({ $feature_flag: 'my-flag', $feature_flag_response: true })
+ .build()
+
+ await ingester.handleKafkaBatch(createKafkaMessages([event], token))
+ await waitForKafkaMessages(kafkaProducer)
+
+ const events = await waitForExpect(async () => {
+ const rows = await fetchEvents(clickhouse, team.id)
+ expect(rows).toHaveLength(1)
+ return rows
+ }, 30_000)
+ expect(events[0]).toMatchObject({ uuid: event.uuid, event: '$feature_flag_called' })
+ }
+ )
+
it('ships disabled by default', () => {
// The only thing the round trip above would add for the disabled case:
// that nothing flipped the fleet default. createFlagEvaluationsService