Skip to content

fix(onboarding): record the exposure for the variant we actually show - #8282

Closed
talissoncosta wants to merge 1 commit into
mainfrom
fix/onboarding-exposure-on-applied-variant
Closed

fix(onboarding): record the exposure for the variant we actually show#8282
talissoncosta wants to merge 1 commit into
mainfrom
fix/onboarding-exposure-on-applied-variant

Conversation

@talissoncosta

Copy link
Copy Markdown
Contributor
  • 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

Draft, and it touches @khvn26's #8242, so worth a look before it goes anywhere.

  • getExperimentFlag records an exposure when it reads the flag, but the read is raced against a 2s timeout, so a user who lost the race, came back without a targeting key, or whose localStorage write failed was logged as exposed to single_page and then shown the legacy page. They sit in the test arm as non-converters and drag its rate down. The flag is now read off SDK state, and trackExposureEvent fires in App.js for the variant we actually route to. No identifier means nothing was assigned, so no exposure.

Open question: whether a user who times out should count as a control exposure or as nobody. This treats them as nobody, on the grounds they were never assigned.

How did you test this code?

  • 7 unit tests, including that the read records nothing and that a downgraded decision is recorded as control
  • test:unit (396) and lint clean, no typecheck errors in the touched files
  • Manually: register a fresh account and confirm one $flag_exposure with the routed variant

getExperimentFlag records an exposure when it reads the flag, and the
caller races that read against a 2s timeout. So a user whose decision
lost the race, or came back without a targeting key, or whose storage
write failed, was logged as exposed to single_page and then shown the
legacy page. Those users sit in the test arm as non-converters and drag
its conversion rate down.

Read the flag off the SDK state instead, and record the exposure in
App.js once we know which variant we are routing to. No identifier means
nothing was assigned, so no exposure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview Aug 13, 2026 12:08pm
flagsmith-frontend-staging Ready Ready Preview Aug 13, 2026 12:08pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Aug 13, 2026 12:08pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2140836c-9afc-4a3b-b8e1-75063e57e303

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant