@clubedge/evaluation-engine). It has zero dependencies on NestJS, Redis, or databases — it’s a pure function over flag configuration data and an evaluation context.
Evaluation pipeline
A flag is resolved in strict order. The first matching step determines the result:Key ordering details
- Rules are evaluated in ascending
priorityorder. Lower numbers are evaluated first. The first matching rule wins — remaining rules are not evaluated. - Rollout is only checked after all targeting rules have been evaluated and none matched.
- Archived check is the first short-circuit — even an archived flag with matching rules returns
false. - Disabled check is the second short-circuit — if
isEnabledisfalsefor the environment, no further evaluation occurs.
Evaluation reasons
Deterministic rollout
Rollouts use FNV-1a hashing to assign subjects to buckets deterministically:Context attributes
The evaluation context is the set of attributes used for targeting rules and rollout bucketing:
A condition’s
attribute field references one of these keys by name (e.g. "country", "userId", or any custom attribute key). Standard attributes (userId, tenantId, email, country) are resolved directly; anything else is resolved from customAttributes.
Supported operators
Targeting rule conditions support these comparison operators:Only the six operators above are supported. String operators like
ends_with, starts_with, contains, etc. are not available. Use multiple prioritized flat rules with == / != to achieve more complex targeting.Targeting rule evaluation logic
Rules with multiple conditions combine via the rule’slogic field:
and— every condition must match for the rule to fireor— at least one condition must match
country == "US" AND plan == "premium" — one rule, logic: "and", two conditions.country == "US" OR plan == "premium" — one rule, logic: "or", two conditions.Batch evaluation
The Evaluation API supports batch evaluation of up to 100 flags in a single request. Results are returned in the same order as theevaluations array — match by index, not by flagKey alone.
Server-side path (POST /sdk/v1/evaluate/batch) — each item is evaluated with its own context, hitting the same cache + engine pipeline as single evaluation.
SDK path — the SDK does not support batch evaluation directly. It fetches all configs via GET /sdk/v1/config and evaluates each flag once at fetch time (see SDK configuration).
