You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 467dc54
Browse filesBrowse the repository at this point in the historyBrowse files
feat: Record exposures under local evaluation (#318)
Since Flagsmith/flagsmith#8532, the environment document carries
`metadata.experiment` on feature states. The SDK dropped it when
building engine models, so under local evaluation `flag.experiment` was
always undefined and `getExperimentFlag` never recorded an exposure.
### Changes
- `FeatureStateModel` keeps `metadata.experiment`; the mapper adds it to
the engine context's feature metadata for environment and segment
feature states. Identity overrides carry none, as on the API.
- `Flags.fromEvaluationResult` sets `experiment`, and also `variant`,
which local evaluation dropped until now, so local exposures carry the
variant key.
- Locally evaluated environment flags carry no experiment, matching the
API, which only sends it for identity flags.
### Tests
`getExperimentFlag` under local evaluation: an enrolled identity records
one exposure with its variant and experiment ID; an identity outside the
rollout, one with an identity override, and a feature with no experiment
record none. Environment flags carry no experiment.
Also checked against a local Flagsmith with the events pipeline: local
and remote evaluation give the same value, variant and experiment, and
one exposure reached the warehouse.
### Not included
Bumping `engine-test-data` to v3.13.0, which adds the experiment cases:
it also adds two numeric trait cases (Flagsmith/engine-test-data#63) the
engine already fails, to be fixed separately.
0 commit comments