feat: add variant to every flag result#56
Merged
Conversation
gagantrivedi
added a commit
to Flagsmith/flagsmith-engine
that referenced
this pull request
Jun 8, 2026
When an identity falls into the control bucket of a multivariate feature (the leftover allocation that resolves to the feature's default value), report `variant: "control"` so experimentation can attribute control exposure. The control is not a multivariate option, so the key is synthesised by the engine. Pins the shared engine-test-data corpus at the matching change (Flagsmith/engine-test-data#56) until it is released as a tag.
Every flag result now carries a `variant` field, mirroring OpenFeature's ResolutionDetails.variant (always present, nullable): - `"control"` when an identity falls in a multivariate feature's control bucket (the leftover allocation resolving to the default value), - the variant's key when a named multivariate variant is selected, - `null` otherwise (standard features, or evaluation without an identity). Updates the expected results across the corpus accordingly.
8bf513b to
0d61c39
Compare
gagantrivedi
added a commit
to Flagsmith/flagsmith-engine
that referenced
this pull request
Jun 8, 2026
Every flag result now carries a `variant` field, mirroring OpenFeature's `ResolutionDetails.variant` (always present, nullable): - the variant's key when a named multivariate variant is selected, - `"control"` when an identity falls in the control bucket (the leftover allocation that resolves to the feature's default value); the control is not a multivariate option, so the engine synthesises this key, - `null` otherwise (standard features, unkeyed variants, or evaluation without an identity, where nothing is bucketed). Selection logic, hashing and ordering are unchanged. Pins the shared engine-test-data corpus at the matching change (Flagsmith/engine-test-data#56) until it is released as a tag.
4 tasks
Zaimwa9
approved these changes
Jun 8, 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.
Changes
Part of the multivariate variant key work (Flagsmith/flagsmith-engine#314, Flagsmith/flagsmith#7726).
Engines now always populate a
variantfield on each flag result, mirroring OpenFeature'sResolutionDetails.variant(always present, nullable). This regenerates the expected results across the corpus so every flag carries it:"control"when an identity falls in a multivariate feature's control bucket (the leftover allocation that resolves to the default value) — 43 cases,nullotherwise (standard features, unkeyed variants, or evaluation without an identity) — the remaining cases."mv_feature": { "enabled": true, "name": "mv_feature", "reason": "DEFAULT", - "value": "foo" + "value": "foo", + "variant": "control" }, "basic_flag": { "enabled": false, "name": "basic_flag", "reason": "DEFAULT", - "value": "" + "value": "", + "variant": null },Selection logic, weights and ordering are unchanged — this only adds the
variantattribution. 520 result flags across the corpus (43"control", the restnull).