westyx-nexus-openfeature crate bridges Nexus to the OpenFeature Rust SDK. The provider wraps an existing client: it opens no second connection and keeps no second cache, so every resolution is an in-memory read rather than a network call.
Installation
Usage
Resolution mapping
A missing key resolves to
FlagNotFound, and a value of the wrong shape to TypeMismatch. In both cases the OpenFeature SDK returns the caller’s default.
Three details of the value mapping:
- Integers keep their precision. A config value of
9007199254740993arrives as ani64, not a rounded float. - A whole number is an integer however it is written. JSON has one number type, so
5.0resolves as5. A fractional value is aTypeMismatchrather than a truncation. - A composite carrying a JSON null is a
TypeMismatch. The OpenFeature value model has no null, so such a value cannot be represented faithfully - and dropping the null would shorten an array and shift every position after it. Read those throughprovider.client().get_config(..), which returns the rawserde_json::Value.
variant - the lowercase string form of the value. A composite carries none.
Per-user targeting
A boolean evaluation whose context carries a targeting key is resolved through the Nexus A/B Testing add-on, so rollout percentages and cohort rules apply:CACHED. Concurrent evaluations for the same user coalesce into a single call.
An evaluation with no targeting key never reaches the network. Config resolutions are never targeted either: A/B evaluation is a flag concept.
Reason codes
Evaluation never throws, and a failed request is never reported as an error resolution. The specification requires an abnormal execution to return the default value, so signalling an error would hand you
false for a flag that is genuinely on because one request failed. The snapshot value with STALE is honest: real, but not freshly targeted.
When the add-on is not active the provider stops calling for five minutes. That window lapses on its own and is cleared by any success, so a project that buys the add-on starts getting targeted results within it with nothing to restart.
Attributes are strings
The service compares attribute values witheq, neq and in, so string equality is the whole of what a cohort rule can express. A context field of any other type is dropped and logged at debug level, never converted: stringifying a large number or a nested structure produces a value no cohort rule can match. Numeric and boolean targeting would need typed operators in the cohort matcher.
Tuning
Each is validated when the provider is built, and a zero value is rejected naming the option.
Provider status
status() reports Ready: the wrapped client performs its initial sync during create, so a provider that exists can serve.
