You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature flag called events could be emitted again for the same flag response after flags were reloaded or updated. This adds noise to $feature_flag_called analytics while still needing to report when a flag's returned value actually changes.
Changes
Track feature flag called dedupe state by flag key and returned response in @posthog/core.
Stop clearing core feature flag called dedupe state on flag reload/update; clear it on shutdown instead.
Clear Node.js feature flag called dedupe state on shutdown.
Update core v1/v4 feature flag tests and add a Node.js shutdown regression test.
Release info Sub-libraries affected
Libraries affected
All of them
posthog-js (web)
posthog-js-lite (web lite)
posthog-node
posthog-react-native
@posthog/react-native-plugin
@posthog/react
@posthog/ai
@posthog/convex
@posthog/next
@posthog/nextjs-config
@posthog/nuxt
@posthog/rollup-plugin
@posthog/webpack-plugin
@posthog/types
@posthog/browser-common
Checklist
Tests for new code
Accounted for the impact of any changes across different platforms
Accounted for backwards compatibility of any changes (no breaking changes!)
Took care not to unnecessarily increase the bundle size
If releasing new changes
Ran pnpm changeset to generate a changeset file
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
A Pi implementation agent prepared the PR from the existing dedicated worktree at the maintainer's request. The change keeps $feature_flag_called deduplication tied to each returned flag value and includes targeted regression tests for core and Node.js behavior.
packages/core/src/__tests__/posthog.featureflags.spec.ts, line 1761-1784 (link)
Test name understates what the test actually verifies
The name should capture $feature_flag_called again after updateFlags changes a value only describes the first scenario (false fires a new event), but the final three lines (1780–1783) assert the opposite: changing back to true does NOT fire an event because true is already in the dedup set. This creates a misleading contract: future readers may infer that every value-change fires an event, which is not true. Consider splitting this into two clearly named tests — one for "fires when value changes to new value" and one for "does not fire when value cycles back to a previously-seen value".
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Addressed Greptile feedback in 55761ec: split the feature flag called dedupe coverage into two clearly named tests—one for firing when a new value is seen and one for not firing when cycling back to a previously seen value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Feature flag called events could be emitted again for the same flag response after flags were reloaded or updated. This adds noise to
$feature_flag_calledanalytics while still needing to report when a flag's returned value actually changes.Changes
@posthog/core.Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
A Pi implementation agent prepared the PR from the existing dedicated worktree at the maintainer's request. The change keeps
$feature_flag_calleddeduplication tied to each returned flag value and includes targeted regression tests for core and Node.js behavior.