feat(flags): add $feature_flag_has_experiment to $feature_flag_called events#261
Merged
Conversation
Contributor
posthog-dotnet Compliance ReportDate: 2026-07-15 23:25:47 UTC ✅ All Tests Passed!17/17 tests passed Feature_Flags Tests✅ 17/17 tests passed View Details
|
haacked
marked this pull request as ready for review
July 15, 2026 18:29
Contributor
|
Reviews (1): Last reviewed commit: "Add $feature_flag_has_experiment to $fea..." | Re-trigger Greptile |
turnipdabeets
approved these changes
Jul 15, 2026
turnipdabeets
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Both send paths covered (flags metadata + local evaluation), null-safe defaults to false on older deployments, and the test matrix covers true/false/absent for both sources.
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 a cross-SDK effort to shrink
$feature_flag_calledevents. This first phase adds a$feature_flag_has_experimentboolean property to every$feature_flag_calledevent, reflecting the server'shas_experimentsignal:metadata.has_experimentin the/flags?v=2response andhas_experimenton/api/feature_flag/local_evaluationflag definitions. When the server does not report the field (older deployments, bootstrapped flags), the property is omitted, so it is tri-state:true,false, or absent (unknown).This lets ingestion distinguish experiment-linked flag events (which need the full property set for exposure analysis) from the rest, and lets us measure the split before a later phase strips the expensive properties (
$feature/<key>,$feature_flag_payload, per-event system metadata) from non-experiment flag events. This PR intentionally minimizes nothing: no properties are removed, no config options are added, and dedupe behavior is unchanged.Changes
FeatureFlagMetadata.HasExperiment(has_experiment) on the/flagsDTO and the same property onLocalFeatureFlagfor/local_evaluation; both factories thread it onto the sharedFeatureFlagrecord (included in record equality).BuildFeatureFlagCalledProperties, which now always sets$feature_flag_has_experiment; synthetic missing/error flags reportfalse. Legacy v3 responses and missing metadata safely default tofalse.PublicAPI.Unshipped.txtupdated (RS0016); minor changeset.💚 How did you test it?
dotnet build PostHog.sln: 0 errors, 0 warnings.dotnet test: 1,012 passed (UnitTests 944 + AspNetCore 49 + PostHog.AI 19), 0 failures. Two new theories cover true / false / absent from flags metadata and local evaluation, and 20 exact-JSON expectations were updated.bin/fmtclean.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file