Skip to main content
The 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 9007199254740993 arrives as an i64, not a rounded float.
  • A whole number is an integer however it is written. JSON has one number type, so 5.0 resolves as 5. A fractional value is a TypeMismatch rather 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 through provider.client().get_config(..), which returns the raw serde_json::Value.
Every scalar resolution carries a 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:
One request covers every flag in the snapshot, and the results are memoised per targeting key, so a request handler reading eight flags for one user makes one round trip - the later reads report 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 with eq, 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.

Minimum Rust version

Rust 1.88, the same floor as the core SDK.