Skip to content

fix: align NoOpProvider reason and ProviderInitializationError default error code with spec#271

Open
cristiangmarta wants to merge 1 commit intoopen-feature:mainfrom
cristiangmarta:fix/spec-compliance-reason-and-error-code
Open

fix: align NoOpProvider reason and ProviderInitializationError default error code with spec#271
cristiangmarta wants to merge 1 commit intoopen-feature:mainfrom
cristiangmarta:fix/spec-compliance-reason-and-error-code

Conversation

@cristiangmarta
Copy link
Copy Markdown

Summary

  • NoOpProvider reason: was returning "No-op" as the evaluation reason. Per spec Requirement 2.2.5, providers SHOULD use "DEFAULT" when returning the default/fallback value — changed to Provider::Reason::DEFAULT.
  • ProviderInitializationError default: was defaulting to PROVIDER_FATAL error code. Per the spec, PROVIDER_FATAL is reserved for irrecoverable failures that permanently prevent flag evaluation. GENERAL is the appropriate default for bare instantiation where no specific error code is known.

@cristiangmarta cristiangmarta requested a review from a team as a code owner April 17, 2026 05:09
Copilot AI review requested due to automatic review settings April 17, 2026 05:09
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the default error code for ProviderInitializationError from PROVIDER_FATAL to GENERAL and updates the NoOpProvider to use Reason::DEFAULT. Corresponding tests have been updated to reflect these changes. Feedback was provided regarding a test in logging_hook_spec.rb that has become less effective because it now relies on the default error code; it is recommended to use a non-default error code to properly verify that the hook extracts the code from the exception.

Comment thread spec/open_feature/sdk/hooks/logging_hook_spec.rb Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns the Ruby SDK’s default evaluation reason and provider initialization error-code defaults with the OpenFeature specification, improving spec compliance and consistency of logged/error metadata.

Changes:

  • Update NoOpProvider to return Provider::Reason::DEFAULT instead of a custom "No-op" reason string.
  • Change ProviderInitializationError default error_code from PROVIDER_FATAL to GENERAL.
  • Update specs expecting the default error code and logged error-code fields accordingly.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
spec/open_feature/sdk/provider_initialization_error_spec.rb Updates expectations to match GENERAL as the default error code.
spec/open_feature/sdk/hooks/logging_hook_spec.rb Updates logged error_code expectation from PROVIDER_FATAL to GENERAL.
lib/open_feature/sdk/provider_initialization_error.rb Changes initializer default error_code to Provider::ErrorCode::GENERAL and updates doc comment.
lib/open_feature/sdk/provider/no_op_provider.rb Changes NoOpProvider fallback evaluation reason to Reason::DEFAULT.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread spec/open_feature/sdk/hooks/logging_hook_spec.rb
Comment thread lib/open_feature/sdk/provider/no_op_provider.rb
…t error code with spec

Signed-off-by: Cristian Marta <cristian@caffe-lento.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants