Skip to content

feat: skip exposure event for disabled flags in getExperimentFlag#403

Merged
Zaimwa9 merged 1 commit into
feat/event-processorfrom
feat/skip-exposure-for-disabled-flags
Jun 25, 2026
Merged

feat: skip exposure event for disabled flags in getExperimentFlag#403
Zaimwa9 merged 1 commit into
feat/event-processorfrom
feat/skip-exposure-for-disabled-flags

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Jun 24, 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

getExperimentFlag no longer fires a $flag_exposure event when the resolved flag is disabled, keeping experimentation data clean. The flag is still returned unchanged — only the exposure event is skipped.

How did you test this code?

Added a unit test in test/events.test.ts (disabled off_value fixture): asserts the flag is returned and no event is flushed. Full suite green.

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner June 24, 2026 12:05
@Zaimwa9 Zaimwa9 requested review from kyle-ssg and removed request for a team June 24, 2026 12:05

@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 modifies getExperimentFlag to skip tracking exposure events when the flag is disabled, ensuring cleaner experimentation data. It also adds a corresponding unit test and updates the documentation. The feedback suggests simplifying the condition in flagsmith-core.ts by using optional chaining (flag?.enabled) to make the code more concise and idiomatic.

Comment thread flagsmith-core.ts Outdated
@Zaimwa9 Zaimwa9 removed the request for review from kyle-ssg June 24, 2026 12:08
@Zaimwa9 Zaimwa9 requested a review from gagantrivedi June 24, 2026 12:08
@Zaimwa9 Zaimwa9 force-pushed the feat/skip-exposure-for-disabled-flags branch from 2721d6d to f27dbb0 Compare June 25, 2026 11:59
getExperimentFlag no longer fires a $flag_exposure event when the
resolved flag is disabled, even if it has a variant, keeping
experimentation data clean. The flag is still returned to the caller.
@Zaimwa9 Zaimwa9 force-pushed the feat/skip-exposure-for-disabled-flags branch from f27dbb0 to 7780eb1 Compare June 25, 2026 12:04
@Zaimwa9

Zaimwa9 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist review

@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 getExperimentFlag method in flagsmith-core.ts to skip recording exposure events and return the flag if the flag is disabled. It also adds a corresponding test case and test data to verify this behavior. There are no review comments to address, and I have no additional feedback to provide.

@Zaimwa9 Zaimwa9 merged commit c95ad9b into feat/event-processor Jun 25, 2026
1 check passed
@Zaimwa9 Zaimwa9 deleted the feat/skip-exposure-for-disabled-flags branch June 25, 2026 15:10
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