Skip to content

feat: only track exposure when experiment feature is enabled#226

Merged
gagantrivedi merged 1 commit into
mainfrom
feat/track-exposure-only-when-enabled
Jun 24, 2026
Merged

feat: only track exposure when experiment feature is enabled#226
gagantrivedi merged 1 commit into
mainfrom
feat/track-exposure-only-when-enabled

Conversation

@gagantrivedi

@gagantrivedi gagantrivedi commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary

get_experiment_flag now skips the exposure event when the resolved flag is disabled

Changes

  • get_experiment_flag guard changed from isinstance(flag, Flag) to isinstance(flag, Flag) and flag.enabled.
  • Docstring updated to document the disabled-feature skip.
  • Added test_get_experiment_flag_skips_exposure_for_disabled_feature covering a disabled flag (with a variant set, to prove the enabled check is what gates tracking).

Testing

  • poetry run pytest tests/test_flagsmith.py -k experiment_flag — 6 passed.

get_experiment_flag now skips the exposure event when the resolved flag
is disabled, in addition to the existing DefaultFlag skip, to keep
experimentation data clean.
@gagantrivedi gagantrivedi requested a review from a team as a code owner June 24, 2026 07:45
@gagantrivedi gagantrivedi requested review from khvn26 and removed request for a team June 24, 2026 07:45

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the get_experiment_flag method in flagsmith/flagsmith.py to skip tracking exposure events when the resolved feature flag is disabled. A corresponding unit test has been added to verify this behavior. There are no review comments, and I have no additional feedback to provide.

@gagantrivedi gagantrivedi requested a review from Zaimwa9 June 24, 2026 07:46
@gagantrivedi gagantrivedi removed the request for review from khvn26 June 24, 2026 07:46

@Zaimwa9 Zaimwa9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@gagantrivedi gagantrivedi merged commit 30112aa into main Jun 24, 2026
7 checks passed
@gagantrivedi gagantrivedi deleted the feat/track-exposure-only-when-enabled branch June 24, 2026 08:59
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