Gradual rollout evaluation for feature flags.
A rollout definition decides whether a specific entity (user, tenant, session…) gets the feature. Three strategies are supported:
%{type: :percentage, value: 25}— the entity falls into the first 25% of a deterministic hash bucket. Same entity → same answer across restarts.%{type: :user_list, users: ["lorenzo"]}— explicit allow-list.%{type: :attribute, key: "tenant", values: ["acme"]}— the context attributekeymust be one ofvalues.
Legacy integer rollouts (rollout: 25) are treated as a percentage.
Context
The evaluation context is a map with string keys, typically the request context of the caller:
%{"user" => "user_42", "tenant" => "acme", "session" => "s-1"}Determinism
Percentage bucketing uses :erlang.phash2/2 with a 100-bucket range,
keyed by {flag_name, entity} so the same entity always lands in the
same bucket, independent of process restarts or VM restarts.
Summary
Functions
Evaluates a flag against a context map.
Functions
@spec evaluate(Botica.Flags.Flag.t(), map()) :: boolean()
Evaluates a flag against a context map.
Returns true when the flag is enabled: true AND the rollout passes
for the context entity, false otherwise. A flag without rollout is
binary: true iff enabled.