Skip to content

feat: add variant to every flag result#56

Merged
gagantrivedi merged 1 commit into
mainfrom
feat/multivariate-control-variant
Jun 8, 2026
Merged

feat: add variant to every flag result#56
gagantrivedi merged 1 commit into
mainfrom
feat/multivariate-control-variant

Conversation

@gagantrivedi

@gagantrivedi gagantrivedi commented Jun 8, 2026

Copy link
Copy Markdown
Member

Changes

Part of the multivariate variant key work (Flagsmith/flagsmith-engine#314, Flagsmith/flagsmith#7726).

Engines now always populate a variant field on each flag result, mirroring OpenFeature's ResolutionDetails.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,
  • the variant's key when a named multivariate variant is selected (none in this corpus yet — no variants carry keys),
  • null otherwise (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 variant attribution. 520 result flags across the corpus (43 "control", the rest null).

@gagantrivedi gagantrivedi requested a review from a team as a code owner June 8, 2026 09:29
@gagantrivedi gagantrivedi requested review from emyller and removed request for a team June 8, 2026 09:29
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.
@gagantrivedi gagantrivedi requested review from Zaimwa9 and removed request for emyller June 8, 2026 09:35
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.
@gagantrivedi gagantrivedi force-pushed the feat/multivariate-control-variant branch from 8bf513b to 0d61c39 Compare June 8, 2026 10:10
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.
@gagantrivedi gagantrivedi changed the title feat: attribute the multivariate control bucket to the "control" variant feat: add variant to every flag result Jun 8, 2026
@gagantrivedi gagantrivedi merged commit f59ed3b into main Jun 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants