Skip to main content

Evaluation and privacy

Define a typed config

defineConfig validates at runtime while preserving literal TypeScript types. Use validateConfig for a list of issues and parseConfig when invalid input should throw.

Evaluate with an explicit fallback

Evaluation details include the value, variation, reason, source, config version, timestamp, matched rule and segments, prerequisite results, and stable errors. Missing flags, invalid context, type mismatches, cycles, and evaluation failures return the caller’s fallback.

Deterministic rollouts

Weights use integer units out of 100,000. Assignment is stable for a flag, variation allocation, and targeting key. Allocations may total less than 100,000; unallocated buckets continue to fallthrough. Progressive rollouts interpolate between two explicit allocations at an explicit instant.

Inspect before you change

explainEvaluation returns ordered eligibility, assignment, evaluation, and exposure-candidate stages at a caller-supplied time. dependencyPaths, impactPaths, testSegmentMembership, and simulateProposedConfig reuse the same evaluator so previews do not drift from runtime behavior. The exposure-candidate stage is advisory. Inspection does not emit telemetry or prove that the user encountered a feature.

Project configuration to clients

Flags and segments are server-only unless explicitly marked client-visible. Client projection rejects a visible flag with a server-only prerequisite or segment. sanitizeContext always keeps targetingKey and copies only approved attributes. Client-side evaluation reveals delivered rules and comparison values. Keep sensitive rules on the server, use remote evaluation, or produce an evaluated client snapshot instead.