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:
saravanakumardb1 2026-03-02 23:56:42 -08:00
parent e4681fbbb2
commit ecb9f67c99

View File

@ -79,8 +79,9 @@ export function evaluateTarget(
// Percentage rollout (FNV-1a hash for deterministic bucketing)
if (target.percentageRollout !== undefined && target.percentageRollout < 100) {
// Hash userId + broadcast seed for consistent assignment
const hash = fnv1a32(`${context.userId}:${target.percentageRollout}`);
// Use userId only as seed for consistent bucketing
// This ensures when rollout % increases, same users stay included
const hash = fnv1a32(context.userId);
const bucket = hash % 100;
if (bucket >= target.percentageRollout) {
return false;