fix(broadcasts): Fix percentage rollout bucketing logic
- Use userId only as seed instead of userId + percentage - Prevents users from being re-bucketed when rollout % increases - Ensures deterministic assignment for phased rollouts
This commit is contained in:
parent
e4681fbbb2
commit
ecb9f67c99
@ -79,8 +79,9 @@ export function evaluateTarget(
|
|||||||
|
|
||||||
// Percentage rollout (FNV-1a hash for deterministic bucketing)
|
// Percentage rollout (FNV-1a hash for deterministic bucketing)
|
||||||
if (target.percentageRollout !== undefined && target.percentageRollout < 100) {
|
if (target.percentageRollout !== undefined && target.percentageRollout < 100) {
|
||||||
// Hash userId + broadcast seed for consistent assignment
|
// Use userId only as seed for consistent bucketing
|
||||||
const hash = fnv1a32(`${context.userId}:${target.percentageRollout}`);
|
// This ensures when rollout % increases, same users stay included
|
||||||
|
const hash = fnv1a32(context.userId);
|
||||||
const bucket = hash % 100;
|
const bucket = hash % 100;
|
||||||
if (bucket >= target.percentageRollout) {
|
if (bucket >= target.percentageRollout) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user