Repository navigation
feat!: remove defaultValue from getFeatureFlag - #917
Merged
turnipdabeets merged 3 commits intoNov 2, 2026
Merged
turnipdabeets merged 3 commits into
turnipdabeets merged 3 commits into
Conversation
The canonical client signature has no default and iOS, Flutter and RN have none. A fallback was also reported as the flag value in $feature_flag_called. A disabled SDK now returns null; isFeatureEnabled keeps its defaultValue.
This was referenced Oct 30, 2026
… HEAD # Conflicts: # .changeset/android-v4-major.md
marandaneto
approved these changes
Nov 2, 2026
marandaneto
left a comment
Member
There was a problem hiding this comment.
The code looks good; no qualifying findings. Verdict: correct.
8 of 19 tasks
turnipdabeets
added a commit
to PostHog/posthog-kmp
that referenced
this pull request
Nov 4, 2026
posthog-android 4.0 removed the defaultValue parameter from getFeatureFlag (PostHog/posthog-android#917), so the native call now receives two arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Part of the 4.0 stack on #871. Removes
defaultValuefrom the clientgetFeatureFlag:Migration:
getFeatureFlag(key, default)becomesgetFeatureFlag(key) ?: default.Why:
$feature_flag_responsein$feature_flag_called, so it could be reported as the flag's value.What upgraders should watch for:
defaultValuenullgetFeatureFlag("key", "fallback")getFeatureFlag("key", true)truenow meanssendFeatureFlagEventisFeatureEnabled("missing", true)reportedtruein$feature_flag_calledtrue, but reports an empty responseThe last row is a side effect:
isFeatureEnabledgoes throughgetFeatureFlag. ItsdefaultValueparameter and return value don't change, as the spec requires. It's the same reporting problem, so I didn't add code to preserve it.Not changed:
getFeatureFlagStateless,posthog-server, andPostHogRemoteConfig.getFeatureFlag, which keeps its owndefaultValue.In-repo callers: no production code passed a default. Only
isFeatureEnabledand the staticPostHog.getFeatureFlagforwarded it. The Flutter and KMP Android code doesn't pass one either.💚 How did you test it?
./gradlew :posthog:test :posthog-android:testReleaseUnitTest :posthog-server:test :posthog-server-openfeature:test :posthog-android-surveys-compose:testDebugUnitTest apiCheck spotlessCheckwith the samples compiled: everything passed except oneposthog-androidtest in that run,PostHogReplayIntegrationTest > bitmap allocation failure feeds the discard counter. It then passed 3 reruns of its class and 3 full reruns of the module, and it doesn't touch flags, so it looks flaky. I didn't find the cause.null, a default isn't reported from either API, afalseflag beats the default, and a disabled SDK returnsnull/ the default.?: defaultValue, ignoring the flag value). Each one failed the expected tests.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Claude Code (Claude Opus 5.5) made the change, updated callers and the API dump, and ran the tests. A dry-run merge with #881 is clean. No device or manual testing.
🤖 Generated with Claude Code