Skip to content

Conversation

@guillermot
Copy link
Collaborator

@guillermot guillermot commented Oct 13, 2025

Summary

Enhance local launcher logic with user threshold check. This commit implements a 50/50 traffic split mechanism for the Rokt Local Launcher feature by adding a user threshold check.

Changes Made

Enhanced Local Launcher Logic (src/Rokt-Kit.js):

  • Added _isUserAboveLocalLauncherThreshold() function that implements a 50% threshold check using Math.random() > 0.5
  • Modified isPartnerInLocalLauncherTestGroup() to include the threshold check alongside the existing isLocalLauncherEnabled configuration
  • Users are now randomly assigned to either local or remote launcher based on the threshold

Comprehensive Test Coverage (test/src/tests.js):

  • Added test case for users below threshold (random = 0) → should create remote launcher
  • Added test case for users above threshold (random = 1) → should create local launcher
  • Added Math.random mock setup to ensure deterministic test behavior

Impact:

Enables gradual rollout of the local launcher feature with 50/50 traffic split
Maintains backward compatibility with existing configuration
Provides robust test coverage for the new threshold logic

Testing Plan

{explain how this has been tested, and what additional testing should be done}

@guillermot guillermot self-assigned this Oct 13, 2025
@guillermot guillermot requested a review from rmi22186 October 13, 2025 15:11
@guillermot guillermot changed the base branch from main to development October 13, 2025 15:13
@guillermot guillermot closed this Oct 13, 2025
@guillermot guillermot deleted the feat/SDKE-361-50-50-traffic-split branch October 13, 2025 15:16
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