-
Notifications
You must be signed in to change notification settings - Fork 22
fix: Address issue with FeatureClient not being resolved when no Provider added #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Address issue when adding context to the feature builder without providing any provider or default feature client. Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
|
Blocked by #606 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #607 +/- ##
=======================================
Coverage 89.84% 89.85%
=======================================
Files 77 77
Lines 3162 3163 +1
Branches 364 364
=======================================
+ Hits 2841 2842 +1
Misses 251 251
Partials 70 70 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this 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 effectively resolves a runtime error that occurred when trying to resolve IFeatureClient via dependency injection without any feature providers configured. The fix involves two key changes: ensuring OpenFeatureOptions is always registered in the service collection, and using FirstOrDefault() instead of First() to safely handle cases with no provider names. A new test case has also been added to validate this fix. The changes are correct and well-implemented. I have one minor suggestion to improve code clarity.
src/OpenFeature.Hosting/OpenFeatureServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
askpt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I wonder what is the impact of that change.
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
This PR
This PR fixes an issue when configuring OpenFeature without a Provider. The singleton approach provided by
Api.Instancecan handle this scenario, so the Dependency Injection approach should be able to. Take the following:When you run this and try to send a request to
GET /welcomeyou will get an error trying to resolve IFeatureClient. This only manifests at runtime.Related Issues
Fixes #544
Notes
Follow-up Tasks
How to test