feat(debug): Make data reliable when debuging - #316
Open
jrosendahl-opt wants to merge 1 commit into
Open
Conversation
…nd bypasses bot detection Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When you are debuging a page the sampling and a/b infrastructure get in the way. This change makes it so when you are in debug mode you are also in the production group and there is no analytics sampling.
shouldSample()now returnstrueimmediately whenoptableDebugis set, regardless of the configuredsamplingRateoptableDebugforces the production/treatment group, same asoptableControlGroup=0— explicitoptableControlGroup=1still takes prioritySkipTargetingForBots()returnsfalseimmediately whenoptableDebugis set, so targeting always runs even in bot-like environments (e.g. headless browsers during development)Activated via
?optableDebugURL param orsessionStorage.setItem("optableDebug", "1")in the browser console, using the existing flags system.Test plan
optableDebugin sessionStorage causesshouldSample()to returntrueeven withsamplingRate: 0optableDebugforces production group assignment even when random bucket would land in controloptableControlGroup=1overridesoptableDebug(explicit control override still works)SkipTargetingForBots()returnsfalsewhenoptableDebugis setnpx jest)🤖 Generated with Claude Code