feat(flags): minimize $feature_flag_called events for non-experiment flags in the compliance adapter#482
Draft
haacked wants to merge 1 commit into
Draft
feat(flags): minimize $feature_flag_called events for non-experiment flags in the compliance adapter#482haacked wants to merge 1 commit into
haacked wants to merge 1 commit into
Conversation
When the /flags?v=2 response carries top-level minimalFlagCalledEvents == true and the evaluated flag reports has_experiment == false, the compliance adapter sends only the cross-SDK minimal allowlist on $feature_flag_called (dropping the $feature/<key> enumeration). Any missing signal, including legacy response shapes and unreported has_experiment, falls back to the full event. Generated-By: PostHog Code Task-Id: ffe402fd-d75c-4043-8e5d-d2fe513cac6f
Contributor
posthog-flutter Compliance ReportDate: 2026-07-16 20:26:50 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
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
The Flutter SDK never captures
$feature_flag_calledin Dart: on iOS and Android the native posthog-ios / posthog-android SDKs capture it over the method channel, and on web it delegates to posthog-js. Flutter apps will therefore get minimal events via the native SDK releases, and this repo's production code needs no change.This PR implements the minimal-event contract in
sdk_compliance_adapter— the only capture path this repo owns, and the same place the$feature_flag_has_experimentsupport landed in #475 — so the cross-SDK compliance harness can validate the behavior:$feature_flag_calledevent iff the v2/flagsresponse carries top-levelminimalFlagCalledEvents == trueand the evaluated flag'shas_experiment == false.has_experimentunreported) → full event, exactly as today.$feature_flag,$feature_flag_response,$feature_flag_has_experiment,$lib, and$lib_version, and drops the$feature/<key>enumeration.distinct_id/tokenremain as transport fields of the adapter's batch protocol.The motivation is trimming non-experiment
$feature_flag_calledevents down to a strict allowlist of useful properties. The gate is server-controlled, so nothing changes for any team until it is enabled. Experiment-linked flags always keep the full envelope since experiment exposure analysis reads it.Part of a cross-SDK rollout; reference implementation and fuller context: PostHog/posthog-python#748
💚 How did you test it?
flutter testinsdk_compliance_adapter(unit test files): 11/11 passed, including 5 new tests — gated + no experiment → exactly the allowlist key set; gated + experiment → full; ungated → full; gated + unreportedhas_experiment→ full; the gate tracks the latest flags response.flutter testinposthog_flutter: 193/193 passed (unchanged).dart analyze .: no issues.dart format --set-exit-if-changed sdk_compliance_adapter: clean.No CHANGELOG entry, matching adapter-only precedent (#475).
📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset fileCreated with PostHog Code