Skip to content

Conversation

@leoromanovsky
Copy link
Contributor

@leoromanovsky leoromanovsky commented Oct 30, 2025

This implements the OpenFeature specification requirement for setProviderAndWait, providing a blocking method to register providers and wait for initialization.

Changes:

  • Add ProviderInitializationError exception class with provider and original_error context
  • Implement set_provider_and_wait method in Configuration class with timeout support
  • Add delegation in API class to expose set_provider_and_wait method
  • Provide SDK-level access through method_missing delegation
  • Add comprehensive test coverage for all scenarios including timeouts, failures, and concurrency
  • Update README.md with usage examples and documentation

The method ensures provider readiness before returning and handles initialization failures gracefully with detailed error information.

This PR

  • adds this new feature

Related Issues

Solves OpenFeature Specification Requirement 1.1.2.4:

https://openfeature.dev/specification/sections/flag-evaluation/#requirement-1124

Requirement 1.1.2.4: The API SHOULD provide functions 
to set a provider and wait for the initialize function to 
complete or abnormally terminate.

Notes

Follow-up Tasks

How to test

This implements the OpenFeature specification requirement for setProviderAndWait,
providing a blocking method to register providers and wait for initialization.

Changes:
- Add ProviderInitializationError exception class with provider and original_error context
- Implement set_provider_and_wait method in Configuration class with timeout support
- Add delegation in API class to expose set_provider_and_wait method
- Provide SDK-level access through method_missing delegation
- Add comprehensive test coverage for all scenarios including timeouts, failures, and concurrency
- Update README.md with usage examples and documentation

The method ensures provider readiness before returning and handles initialization
failures gracefully with detailed error information.

Signed-off-by: Leo Romanovsky <[email protected]>
@leoromanovsky leoromanovsky marked this pull request as ready for review October 30, 2025 16:27
@leoromanovsky leoromanovsky requested a review from a team as a code owner October 30, 2025 16:27
@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.61%. Comparing base (2f1e327) to head (7f171e2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #200      +/-   ##
==========================================
+ Coverage   99.57%   99.61%   +0.04%     
==========================================
  Files          16       17       +1     
  Lines         233      259      +26     
==========================================
+ Hits          232      258      +26     
  Misses          1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

There's a decent amount of thrash in this PR due to some style change " vs '. I'm not a Ruby expect but it does appear that the change matches the Ruby style guide. If that's the preferred approach, would you mind making that change in a sperate PR?

Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

It seems @josecolella agrees that we should move the refactor to a separate PR. Update my review so the change doesn't accidently get merged.

- Convert single quotes to double quotes per project style guide
- Remove explicit StandardError class from rescue clauses
- Align string literal formatting with CI expectations

Signed-off-by: Leo Romanovsky <[email protected]>
@leoromanovsky
Copy link
Contributor Author

There's a decent amount of thrash in this PR due to some style change " vs '. I'm not a Ruby expect but it does appear that the change matches the Ruby style guide. If that's the preferred approach, would you mind making that change in a sperate PR?

Sorry about the lint (quotation changes); my local ruby environment had some differences from CI. I got them synchronized now and the diff is just focused on functionality. Thanks for the reviews!

Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

This looks good from an OpenFeature perspective aside from the missing error code. @josecolella do you have any other concerns?

@beeme1mr beeme1mr requested a review from maxveldink October 31, 2025 14:38
@josecolella
Copy link
Collaborator

This looks good from an OpenFeature perspective aside from the missing error code. @josecolella do you have any other concerns?

Looks fine to me

josecolella
josecolella previously approved these changes Oct 31, 2025
Per reviewer feedback, add OpenFeature error code support to the
ProviderInitializationError exception class:

- Add error_code attribute with PROVIDER_FATAL default per OpenFeature spec
- Support custom error codes via constructor parameter
- Update all tests to verify error_code is properly set
- Update documentation to show error_code usage in exception handling

Addresses PR feedback from @beeme1mr regarding OpenFeature specification
requirement for provider initialization error codes.

Signed-off-by: Leo Romanovsky <[email protected]>
@beeme1mr beeme1mr merged commit d92eabc into open-feature:main Oct 31, 2025
12 checks passed
This was referenced Oct 31, 2025
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.

3 participants