Skip to content
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

Feat: Add support for provider hooks #38

Merged
merged 1 commit into from
Aug 10, 2022
Merged

Feat: Add support for provider hooks #38

merged 1 commit into from
Aug 10, 2022

Conversation

benjiro
Copy link
Member

@benjiro benjiro commented Aug 6, 2022

Implement provider hook spec open-feature/spec#119

  • [Breaking] Remove IFeatureProvider interface in favor of FeatureProvider abstract class
    so default implementations can exist
  • Make sure Provider hooks are called in the correct order
  • Use strick mocking mode so sequence is validated correctly
  • Update test cases for provider hooks support

@codecov-commenter
Copy link

codecov-commenter commented Aug 6, 2022

Codecov Report

Merging #38 (deaaaaa) into main (5937bb9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #38   +/-   ##
=======================================
  Coverage   99.33%   99.34%           
=======================================
  Files          15       16    +1     
  Lines         303      305    +2     
  Branches       24       25    +1     
=======================================
+ Hits          301      303    +2     
  Partials        2        2           
Impacted Files Coverage Δ
src/OpenFeature/Model/ResolutionDetails.cs 100.00% <ø> (ø)
src/OpenFeature/NoOpProvider.cs 100.00% <ø> (ø)
src/OpenFeature/FeatureProvider.cs 100.00% <100.00%> (ø)
src/OpenFeature/OpenFeature.cs 100.00% <100.00%> (ø)
src/OpenFeature/OpenFeatureClient.cs 99.19% <100.00%> (+<0.01%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@benjiro benjiro force-pushed the feat/provider-hooks branch 2 times, most recently from 2065df8 to deaaaaa Compare August 7, 2022 07:05
- [Breaking] Remove IFeatureProvider interface infavor of FeatureProvider abstract class
so default implementations can exist
- Make sure Provider hooks are called in the correct order
- Use strick mocking mode so sequence is validated correctly
- Update test cases for provider hooks support

Signed-off-by: Benjamin Evenson <2031163+benjiro@users.noreply.github.com>
@@ -209,6 +209,7 @@ public FeatureClient(IFeatureProvider featureProvider, string name, string versi
.Concat(OpenFeature.Instance.GetHooks())
.Concat(this._hooks)
.Concat(options?.Hooks ?? Enumerable.Empty<Hook>())
.Concat(this._featureProvider.GetProviderHooks())
Copy link
Member

@toddbaert toddbaert Aug 9, 2022

Choose a reason for hiding this comment

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

I think the merging works as expected here (basically, hooks win... see: https://github.com/open-feature/spec/blob/main/specification/sections/04-hooks.md#requirement-434)

But I don't see a test that specifically asserts this behavior (let me know if I'm wrong). If I'm correct, and it's alright with you @benjiro , I will write this test myself just to make sure I can get this project setup fully locally (I've pulled it but never run the tests suite).

EDIT:

Actually, it seems you do have a test for 4.3.4, but it needs to be updated... which I'd still like to do if you don't mind.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea go ahead and update the test case. Let me know if you have any issues I've only tested the project via command line, Rider and VS. if you're using vscode you might need to fix up the git ignores or do some initial setup. If you run into any troubles ping me on slack happy to help

Copy link
Member

Choose a reason for hiding this comment

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

I'm going to branch of this branch to make this change, feel free to merge or not.

@toddbaert toddbaert self-requested a review August 9, 2022 15:25
Copy link
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

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

LGTM, let me know about comments on the merge behavior change.

@benjiro
Copy link
Member Author

benjiro commented Aug 10, 2022

@toddbaert fine with you tackling the test, did you want to merge this PR or add the test to it?

@toddbaert
Copy link
Member

@toddbaert fine with you tackling the test, did you want to merge this PR or add the test to it?

Go ahead and merge, I'll do it in a separate PR. Will start on that today.

@beeme1mr beeme1mr merged commit 3ee2673 into main Aug 10, 2022
@beeme1mr beeme1mr deleted the feat/provider-hooks branch August 10, 2022 20:04
@benjiro benjiro added the breaking-change Changes in exposed interfaces or behaviour label Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Changes in exposed interfaces or behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants