fix: ⚠️ correct execution order for the same level hooks #458
fix: ⚠️ correct execution order for the same level hooks #458
Conversation
Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
Summary of ChangesHello @erka, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical issue concerning the execution order of hooks within the OpenFeature client. It standardizes the collection of various hook types and enforces the correct execution sequence, particularly for 'After', 'Error', and 'Finally' hooks, which now run in reverse order of their registration. This change ensures that the hook system behaves predictably and aligns with the intended design, improving the overall reliability of feature flag evaluations. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses an issue with the execution order of hooks. The changes ensure that after, error, and finally hooks are executed in the reverse order of before hooks, which aligns with the OpenFeature specification. The implementation has been simplified by consolidating hook collections into a single slice and iterating over it in reverse where necessary. The tests have been updated accordingly to validate the corrected behavior. The changes are well-implemented and improve the correctness and maintainability of the hook execution logic.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #458 +/- ##
==========================================
+ Coverage 83.12% 83.21% +0.08%
==========================================
Files 27 27
Lines 2098 2097 -1
==========================================
+ Hits 1744 1745 +1
+ Misses 305 304 -1
+ Partials 49 48 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There may be users relying on the current execution order, even though it doesn't align with the spec. Technically this is a breaking change and we'll want to call that out in the release notes. |
Co-authored-by: Sahid Velji <sahidvelji@gmail.com> Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
|
@sahidvelji agreed. It's obviously not "breaking" in a compilation sense, but it is in a behavioral sense. I would learn toward calling out in our release notes but not doing a breaking change version. Reviewing now. |
|
Yep... Looks good to me. Thanks @erka Do you guys agree we can avoid a major version change here? Behavior would change (no compilation issues) but, in my opinion, it changes in an logical way, and it's certainly more consistent with our spec now.... on the other hand:https://m.xkcd.com/1172/ I'm inclined to just mention it in our notes in a very visible way. |
|
I think it's just a bug fix. Someone could be affected but it's better now than later. |
TODO: mention this PR in CHANGELOG.
This PR
Related Issues
closes #456