Skip to content
Gates

Rollouts and bucketing

A rule can carry a percentage from 0 to 100. When its conditions match, the device decides membership locally and deterministically; nothing is random at runtime.

The bucket

bucket = fnv1a32(`${flagKey}:${seed}:${identity}`) % 10000
  • seed is the rule’s rollout seed. It is minted once when the rule is created and never rotated.
  • identity is user:<user.id> when a user is identified, otherwise inst:<installationId>.
  • A rollout of p percent admits buckets below p × 100: 25% admits bucket < 2500.

FNV-1a is small, dependency-free and stable across JavaScript engines, so the same identity lands in the same cohort on the phone, on the server and in a test.

What this guarantees

  • Raising a percentage only adds people. Someone in at 25% has a bucket below 2500, which is also below 5000.
  • A signed-in person is in or out on every one of their devices, because the identity is their user.id.
  • A rule with no percentage, or 100%, matches outright (rule_match). Below that the reason is rollout_match or rollout_miss.
  • A miss returns the flag’s default and does not fall through to the next rule.

Order of evaluation

Flag exists → enabled → first rule whose conditions all match (rules in priority order) → that rule’s percentage → the flag’s default. See explain() for the reasons each step produces.

The spec’s rollout presets are 0, 5, 10, 25, 50, 75 and 100 percent. There is no scheduler that advances a rollout on its own.