Percentage Feature Flag Changes a User Result Between Requests
Level 2 · node · Reliability · Non-deterministic gradual rollout assignment
Scenario
A feature flag service gradually enables a new feature for rolloutPercent of users. The same user must receive the same variant across repeated requests so UI and API behavior do not flip during a session. The current implementation uses a process-level random value on every evaluation, so one user can receive different results from request to request.
Requirements
- The same flag and userId must always return the same result across repeated evaluations - A rolloutPercent of 0 disables the feature for every user - A rolloutPercent of 100 enables the feature for every user - Different flag keys must calculate buckets independently - Evaluation must not depend on external state or network access
Acceptance criteria
- Repeated evaluation for the same user is stable
- A 0% rollout always returns false
- A 100% rollout always returns true
- The flag key participates in the bucket input
- Evaluation is deterministic and local