Skip to content

Feat: Add support for provider hooks#38

Merged
beeme1mr merged 1 commit into
mainfrom
feat/provider-hooks
Aug 10, 2022
Merged

Feat: Add support for provider hooks#38
beeme1mr merged 1 commit into
mainfrom
feat/provider-hooks

Conversation

@benjiro

@benjiro benjiro commented Aug 6, 2022

Copy link
Copy Markdown
Member

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

codecov-commenter commented Aug 6, 2022

Copy link
Copy Markdown

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
@benjiro
benjiro requested review from beeme1mr and toddbaert August 7, 2022 07:09
- [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>
@benjiro
benjiro force-pushed the feat/provider-hooks branch from deaaaaa to 8cb5f6b Compare August 9, 2022 12:25
Comment thread src/OpenFeature.SDK/OpenFeature.cs
.Concat(OpenFeature.Instance.GetHooks())
.Concat(this._hooks)
.Concat(options?.Hooks ?? Enumerable.Empty<Hook>())
.Concat(this._featureProvider.GetProviderHooks())

@toddbaert toddbaert Aug 9, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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

@toddbaert toddbaert left a comment

Copy link
Copy Markdown
Member

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

benjiro commented Aug 10, 2022

Copy link
Copy Markdown
Member Author

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

@toddbaert

Copy link
Copy Markdown
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 type: 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

type: breaking-change Changes in exposed interfaces or behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants