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 evaluation details to finally hook stage #335

Merged

Conversation

askpt
Copy link
Member

@askpt askpt commented Dec 20, 2024

Add evaluation details to the finally hook stage

This pull request includes several changes to improve the handling of flag evaluation details and error handling in the OpenFeature library. The most important changes include modifying hook methods to accept FlagEvaluationDetails as a parameter, updating the EvaluateFlagAsync method to handle provider errors more gracefully, and adjusting the corresponding unit tests to reflect these changes.

Related Issues

Fixes #328

Notes

Improvements to Hook Methods:

Enhancements to Flag Evaluation:

  • src/OpenFeature/OpenFeatureClient.cs: Updated the EvaluateFlagAsync method to initialize FlagEvaluationDetails in case of provider errors and ensure the FinallyAsync hook is always called with the correct evaluation details. [1] [2] [3]

@askpt askpt linked an issue Dec 20, 2024 that may be closed by this pull request
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (main@8527b03). Learn more about missing BASE report.
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/OpenFeature/OpenFeatureClient.cs 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #335   +/-   ##
=======================================
  Coverage        ?   85.13%           
=======================================
  Files           ?       36           
  Lines           ?     1480           
  Branches        ?      151           
=======================================
  Hits            ?     1260           
  Misses          ?      188           
  Partials        ?       32           

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

@askpt askpt marked this pull request as ready for review December 20, 2024 13:41
@askpt askpt requested a review from a team as a code owner December 20, 2024 13:41
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.

Could you please add a test to ensure that the evaluation details included in the final stage match what's returned to the user? Here's how requirement 4.3.8 was tested in JS.

https://github.com/open-feature/js-sdk/pull/1087/files#diff-5eb44a4c1dd2a0d07e4b54e1eab5d69c60cc983aad849aeae08567fb85af2b3f

Thank!

Signed-off-by: André Silva <[email protected]>
@askpt
Copy link
Member Author

askpt commented Dec 20, 2024

Could you please add a test to ensure that the evaluation details included in the final stage match what's returned to the user? Here's how requirement 4.3.8 was tested in JS.

https://github.com/open-feature/js-sdk/pull/1087/files#diff-5eb44a4c1dd2a0d07e4b54e1eab5d69c60cc983aad849aeae08567fb85af2b3f

Thank!

@beeme1mr I added the specification test with: 25af4ba

I hope it is what you were expecting.

Signed-off-by: André Silva <[email protected]>
@toddbaert
Copy link
Member

Will merge/release this next week unless I hear objections. We'll have to do some manual release notes as well when we do, as we did with JS: https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.4.0

See also, same change in Java: open-feature/java-sdk#1262

@beeme1mr beeme1mr merged commit 2ef9955 into main Jan 6, 2025
13 checks passed
@beeme1mr beeme1mr deleted the askpt/328-add-evaluation-details-to-finally-hook-stage branch January 6, 2025 20:48
kylejuliandev pushed a commit to kylejuliandev/dotnet-sdk that referenced this pull request Jan 9, 2025
toddbaert added a commit that referenced this pull request Jan 31, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.3.0](v2.2.0...v2.3.0)
(2025-01-31)


### ⚠ BREAKING CHANGES

#### Hook Changes

The signature of the `finally` hook stage has been changed. The
signature now includes the `evaluation details`, as per the [OpenFeature
specification](https://openfeature.dev/specification/sections/hooks#requirement-438).
Note that since hooks are still `experimental,` this does not constitute
a change requiring a new major version. To migrate, update any hook that
implements the `finally` stage to accept `evaluation details` as the
second argument.

* Add evaluation details to finally hook stage
([#335](#335))
([2ef9955](2ef9955))

#### .NET 6

Removed support for .NET 6.

* add dotnet 9 support, rm dotnet 6
([#317](#317))
([2774b0d](2774b0d))

### 🐛 Bug Fixes

* Adding Async Lifetime method to fix flaky unit tests
([#333](#333))
([e14ab39](e14ab39))
* Fix issue with DI documentation
([#350](#350))
([728ae47](728ae47))


### ✨ New Features

* add dotnet 9 support, rm dotnet 6
([#317](#317))
([2774b0d](2774b0d))
* Add evaluation details to finally hook stage
([#335](#335))
([2ef9955](2ef9955))
* Implement Default Logging Hook
([#308](#308))
([7013e95](7013e95))
* Implement transaction context
([#312](#312))
([1b5a0a9](1b5a0a9))


### 🧹 Chore

* **deps:** update actions/upload-artifact action to v4.5.0
([#332](#332))
([fd68cb0](fd68cb0))
* **deps:** update codecov/codecov-action action to v5
([#316](#316))
([6c4cd02](6c4cd02))
* **deps:** update codecov/codecov-action action to v5.1.2
([#334](#334))
([b9ebddf](b9ebddf))
* **deps:** update codecov/codecov-action action to v5.3.1
([#355](#355))
([1e8ebc4](1e8ebc4))
* **deps:** update dependency coverlet.collector to 6.0.3
([#336](#336))
([8527b03](8527b03))
* **deps:** update dependency coverlet.msbuild to 6.0.3
([#337](#337))
([26fd235](26fd235))
* **deps:** update dependency dotnet-sdk to v9.0.101
([#339](#339))
([dd26ad6](dd26ad6))
* **deps:** update dependency fluentassertions to 7.1.0
([#346](#346))
([dd1c8e4](dd1c8e4))
* **deps:** update dependency microsoft.net.test.sdk to 17.12.0
([#322](#322))
([6f5b049](6f5b049))


### 📚 Documentation

* disable space in link text lint rule
([#329](#329))
([583b2a9](583b2a9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Signed-off-by: Todd Baert <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Todd Baert <[email protected]>
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.

Add evaluation details to finally hook stage
4 participants