feat(flags): support mixed targeting in local evaluation#192
Open
patricio-posthog wants to merge 2 commits intomainfrom
Open
feat(flags): support mixed targeting in local evaluation#192patricio-posthog wants to merge 2 commits intomainfrom
patricio-posthog wants to merge 2 commits intomainfrom
Conversation
Contributor
posthog-go Compliance ReportDate: 2026-04-28 16:14:11 UTC
|
| Test | Status | Duration |
|---|---|---|
| Format Validation.Event Has Required Fields | ✅ | 609ms |
| Format Validation.Event Has Uuid | ✅ | 607ms |
| Format Validation.Event Has Lib Properties | ✅ | 607ms |
| Format Validation.Distinct Id Is String | ✅ | 607ms |
| Format Validation.Token Is Present | ✅ | 608ms |
| Format Validation.Custom Properties Preserved | ✅ | 607ms |
| Format Validation.Event Has Timestamp | ✅ | 606ms |
| Retry Behavior.Retries On 503 | ✅ | 5612ms |
| Retry Behavior.Does Not Retry On 400 | ✅ | 2610ms |
| Retry Behavior.Does Not Retry On 401 | ✅ | 2610ms |
| Retry Behavior.Respects Retry After Header | ✅ | 5613ms |
| Retry Behavior.Implements Backoff | ✅ | 15622ms |
| Retry Behavior.Retries On 500 | ✅ | 5612ms |
| Retry Behavior.Retries On 502 | ✅ | 5613ms |
| Retry Behavior.Retries On 504 | ✅ | 5613ms |
| Retry Behavior.Max Retries Respected | ✅ | 15613ms |
| Deduplication.Generates Unique Uuids | ✅ | 617ms |
| Deduplication.Preserves Uuid On Retry | ✅ | 5612ms |
| Deduplication.Preserves Uuid And Timestamp On Retry | ✅ | 10619ms |
| Deduplication.Preserves Uuid And Timestamp On Batch Retry | ✅ | 5614ms |
| Deduplication.No Duplicate Events In Batch | ✅ | 611ms |
| Deduplication.Different Events Have Different Uuids | ✅ | 620ms |
| Compression.Sends Gzip When Enabled | ✅ | 607ms |
| Batch Format.Uses Proper Batch Structure | ✅ | 607ms |
| Batch Format.Flush With No Events Sends Nothing | ✅ | 605ms |
| Batch Format.Multiple Events Batched Together | ✅ | 611ms |
| Error Handling.Does Not Retry On 403 | ✅ | 2609ms |
| Error Handling.Does Not Retry On 413 | ✅ | 2610ms |
| Error Handling.Retries On 408 | ✅ | 5613ms |
Feature_Flags Tests
View Details
| Test | Status | Duration |
|---|---|---|
| Request Payload.Request With Person Properties Device Id | ❌ | 7ms |
Failures
request_payload.request_with_person_properties_device_id
Field 'distinct_id' not found in /flags request body at path 'person_properties.distinct_id'. Available keys: ['$device_id']
turnipdabeets
approved these changes
Apr 30, 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
Feature flags with "mixed targeting" (the
feature-flag-mixed-targetingbeta) allow different condition sets within a single flag to target different aggregation levels — some targeting users/persons, others targeting groups.The SDK only reads
aggregation_group_type_indexat the flag level. For mixed flags this isnull, so the SDK treats all conditions as person-targeted. Group conditions fail property matching and the SDK falls back to a server-side HTTP call.This breaks customers using flags in environments that cannot make HTTP calls (e.g., Temporal workflows).
💚 How did you test it?
Updated
matchFeatureFlagPropertiesto resolve aggregation per condition when a condition sets its ownaggregation_group_type_indexthat differs from the flag level. Each condition uses the correct properties and bucketing value for its aggregation type. Backwards compatible with existing pure person and pure group flags.Added
TestMixedTargetingLocalEvaluation(4 parameterized cases) andTestMixedTargetingRolloutBucketing. All existing feature-flag tests continue to pass.Ports posthog-python#523 to posthog-go.
📝 Checklist
If releasing new changes
releaselabel to the PRbump-patch,bump-minor, orbump-major