Repository navigation
Conversation
Implement the OpenFeature eventing spec (section 5): API- and client-level event handlers, SDK-tracked provider status, and an EventEmitter handle providers use to signal state changes. Providers receive an EventEmitter via the new FeatureProvider::attach_emitter method (called right before initialize). The SDK owns the terminal PROVIDER_READY/PROVIDER_ERROR event derived from the initialization outcome, so events emitted during initialize are ignored and readiness handlers fire exactly once. Handlers registered after a provider is already in the associated state run immediately (5.3.3), panicking handlers are isolated (5.2.5), and events from a superseded provider are dropped via activity tokens. Signed-off-by: Jose Bovet Derpich <jose.bovet@gmail.com>
Signed-off-by: Jose Bovet Derpich <jose.bovet@gmail.com>
Signed-off-by: Jose Bovet Derpich <jose.bovet@gmail.com>
jbovet
force-pushed
the
feat-event-support
branch
from
November 20, 2026 02:05
74bee72 to
6b4c0a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR
Adds provider eventing support to the Rust SDK specification.
What's included
OpenFeature::add_handler, run for events from any provider) and the client level (Client::add_handler, run only for the provider bound to that client's domain). Each returns anEventHandlerIdfor removal viaremove_handler.PROVIDER_READY,PROVIDER_ERROR,PROVIDER_STALE,PROVIDER_CONFIGURATION_CHANGED, with anEventDetailspayload (provider name, message, error code, changed flags, metadata).OpenFeature::provider_status,OpenFeature::named_provider_status, andClient::provider_status. Status is derived from initialization outcome and emitted events.EventEmitterhandle, passed to providers via the newFeatureProvider::attach_emittermethod (called right beforeinitialize), which providers use to signal state changes to the SDK.Breaking changes
set_provider/set_named_providernow returnResult<(), EvaluationError>. The provider stays registered even if initialization fails, so the error can be discarded with.ok().FeatureProvider::initializenow returnsResult<(), EvaluationError>(previously()).attach_emitteris added with a default (no-op) body, so existing providers don't need to implement it.status()is deprecated — the SDK derives status from events and no longer calls it.EvaluationErrorCodegains aProviderFatalvariant.ProviderStatusgains aFatalvariant andSTALEis renamed toStale; it now derivesClone, Copy, Hash.Testing
src/api/event_registry.rscovering handler registration/removal, persistence across provider changes, immediate replay, panic isolation, status transitions,PROVIDER_FATALescalation, superseded-provider handling.initialize/set_providersignatures.examples/events.rsdemonstrating an event-emitting provider.cargo fmt --check,cargo clippy -- -D warnings, and the full test suite pass locally.Docs
Closes open-feature#93