Skip to content

fix: skip exposure events when no identifier resolves#407

Merged
Zaimwa9 merged 1 commit into
mainfrom
fix/track-exposure-identifier-guard
Jul 23, 2026
Merged

fix: skip exposure events when no identifier resolves#407
Zaimwa9 merged 1 commit into
mainfrom
fix/track-exposure-identifier-guard

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Jul 22, 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

trackExposureEvent emitted $flag_exposure events with identifier: null when no identity was set; exposures without an assignment unit can't be attributed to a cohort. It now skips with a log when no identifier resolves, mirroring getExperimentFlag. Explicit opts.identifier still records; trackEvent is unchanged. No docs/ changes — the API is @experimental @internal; JSDoc updated.

How did you test this code?

Test-first: a failing test reproducing the identifier: null exposure, then the guard, plus pin-down tests for explicit opts.identifier and anonymous trackEvent. Full suite green (118 tests) via npm test.

trackExposureEvent emitted exposures with identifier: null for anonymous
users; exposures without an assignment unit are unanalyzable. Now skips
with a log, mirroring getExperimentFlag. Explicit opts.identifier still
records an exposure; trackEvent is unaffected.
@Zaimwa9
Zaimwa9 requested a review from a team as a code owner July 22, 2026 15:20
@Zaimwa9
Zaimwa9 requested review from talissoncosta and removed request for a team July 22, 2026 15:20

@talissoncosta talissoncosta 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.

Looks good!

@Zaimwa9
Zaimwa9 merged commit 9c4533c into main Jul 23, 2026
2 checks passed
@Zaimwa9
Zaimwa9 deleted the fix/track-exposure-identifier-guard branch July 23, 2026 07:54
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.

2 participants