Skip to content

feat: experiment metadata on flags, exposure gated on inExperiment - #420

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

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

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

  • IFlagsmithFeature.experiment?: { id, name, inExperiment }, lifted from metadata.experiment. undefined on older servers.
  • getExperimentFlag and useExperiment fire the exposure only when inExperiment is true, instead of guessing from variant. Flag data is still returned otherwise.
  • Exposure events carry metadata.experiment_id for attribution.
  • useFlags propagates experiment through the React bindings.

Release after Core (Flagsmith/flagsmith#8532) and Edge (Flagsmith/edge-api#719) are live: against older servers no flag carries experiment, so no exposure is recorded.

How did you test this code?

Jest: new test/experiment.test.ts plus extended React event, variant and type tests, 131 tests passing.
tsc clean.
Manual QA against staging once Core and Edge are deployed.

@Zaimwa9
Zaimwa9 force-pushed the feat/experiment-metadata branch 2 times, most recently from e8b9dae to b82e510 Compare September 16, 2026 08:09
@Zaimwa9
Zaimwa9 force-pushed the feat/experiment-metadata branch from b82e510 to 95253d5 Compare September 16, 2026 08:12
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