Repository navigation
fix(flags): read an empty variant as disabled on every platform - #711
Merged
turnipdabeets merged 3 commits intoNov 9, 2026
Merged
Conversation
Contributor
posthog-flutter Compliance ReportDate: 2026-11-08T17:36:15.298181+00:00 ✅ All Tests Passed!232/232 tests passed Capture_V1 Tests✅ 105/105 tests passed View Details
Capture_Ai_V1 Tests✅ 110/110 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
turnipdabeets
marked this pull request as ready for review
November 6, 2026 20:16
This was referenced Nov 6, 2026
Merged
…_flags Desktop core change; iOS, macOS and Android pick it up from the native SDKs. $feature/<key> still carries the raw "" value, matching posthog-js.
marandaneto
approved these changes
Nov 9, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
💡 Motivation and Context
A flag whose variant is the empty string
""read as disabled from some APIs and enabled from others. posthog-ios #1001 made iOSisFeatureEnabledreturnfalsefor it (review thread), Android already did, butgetFeatureFlagResult().enabledstayedtrueon both. posthog-js (browser) is already consistent. The iOS and Android 4.0 PRs make nativeenabledfalse; this PR fixes the Dart core used on Windows and Linux and rewrites the 6.0 docs.isFeatureEnabled()withdefaultValuereads nativegetFeatureFlagResult().enabled(posthog_flutter_io.dart), so it follows the native PRs.PostHogFeatureFlagsLoadedalready drops""on every platform (feature_flags_loaded.dart).isFeatureEnabled()returnedtrueandgetFeatureFlagResult().enabledwastrue; both now read""as disabled.getFeatureFlag()still returns"", and$feature_flag_calledstill reports$feature_flag_response: "".The changeset and
MIGRATION.mdnow say empty variants read as disabled fromisFeatureEnabled()(with or withoutdefaultValue),getFeatureFlagResult().enabledandonFeatureFlagslisteners on iOS, macOS, Android, Windows and Linux, as on web.Blast radius is small: since PostHog/posthog#118803 (2026-10-16) PostHog rejects new
""variant keys, so only flags created earlier through the API, MCP or Terraform can hit this.Depends on the native 4.0 changes:
$active_feature_flagsnow leaves a""flag out on desktop events too (iOS, macOS and Android get this from the native PRs), while$feature/<key>still carries the raw"", as in posthog-js (browser).💚 How did you test it?
test/core/feature_flags_test.dart(isFeatureEnabled,getFeatureFlagResultenabled/variant,featureFlagsLoaded().flags). It fails on the pre-fix core (Expected: false, Actual: true) and passes with the fix.flutter test test/core/feature_flags_test.dart test/posthog_flutter_desktop_test.dart test/posthog_flutter_io_test.dart test/feature_flags_listeners_test.dart: 352 passed.dart formatandflutter analyzeclean.$active_feature_flags"lists only enabled flags" with a""variant flag: fails on the pre-fix core (Actual: [on-flag, variant-flag, empty-variant-flag]), passes with the fix. Fullflutter test: 1558 passed;flutter analyzeshows only an existing info intest/posthog_observer_test.dart.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file (edited the existing 6.0 changeset)🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Claude Code made the change across iOS, Android, Flutter and sdk-specs at Anna's direction. Checking the desktop Dart core turned up the same split there, so it's fixed here too.
🤖 Generated with Claude Code