Skip to content

feat: Flag.experiment and exposure gated on in_experiment - #249

Draft
Zaimwa9 wants to merge 1 commit into
mainfrom
feat/experiment-metadata
Draft

Zaimwa9 wants to merge 1 commit into
mainfrom
feat/experiment-metadata

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Changes

Core now sends metadata.experiment { id, name, in_experiment } on /identities flags while the feature's experiment is running (Flagsmith/flagsmith#8532).

  • Flag.experiment: Optional[ExperimentMetadata], a frozen dataclass populated in Flag.from_api_flag. None on older servers and in local evaluation.
  • get_experiment_flag fires the exposure only when experiment.in_experiment is true, instead of guessing from variant.
  • Exposure events carry experiment_id for attribution.

How did you test this code?

pytest: 128 passing, new cases in tests/test_models.py and tests/test_flagsmith.py.
pre-commit clean.
Manual QA against staging once Core and Edge are deployed.

@Zaimwa9
Zaimwa9 force-pushed the feat/experiment-metadata branch from 47926aa to 4c8e1e2 Compare September 15, 2026 17:11
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.

1 participant