-
Notifications
You must be signed in to change notification settings - Fork 50
feat: add hook data support #1620
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
base: main
Are you sure you want to change the base?
feat: add hook data support #1620
Conversation
Summary of ChangesHello @alexandraoberaigner, 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 reintroduces and refines the support for 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.
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 re-introduces hook data support, which is a great addition for allowing hooks to maintain state across execution stages. The implementation is solid, with good test coverage for the new functionality. I've identified a few areas for improvement, mainly concerning code clarity, consistency, and a potential thread-safety issue in the HookData
implementation. My detailed comments and suggestions are provided below.
src/test/java/dev/openfeature/sdk/benchmark/AllocationBenchmark.java
Outdated
Show resolved
Hide resolved
9d41b69
to
0761dd1
Compare
0761dd1
to
84124f8
Compare
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
84124f8
to
269dfe4
Compare
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
a4f18c3
to
3b113c1
Compare
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
Signed-off-by: Guido Breitenhuber <guido.breitenhuber@dynatrace.com>
Signed-off-by: Guido Breitenhuber <guido.breitenhuber@dynatrace.com>
Signed-off-by: Guido Breitenhuber <guido.breitenhuber@dynatrace.com>
Signed-off-by: Guido Breitenhuber <guido.breitenhuber@dynatrace.com>
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.
I do like the object based approach, but i have a hard time supporting the changes how hooksupport/hookexecutor is created for each execution. We are bound now for testing, and have no easy way to replace this implementation with a different one.
…tic factory method to ctor Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
011a6e4
to
21d8b12
Compare
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
21d8b12
to
4ab14bf
Compare
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1620 +/- ##
============================================
+ Coverage 92.06% 93.20% +1.14%
- Complexity 488 521 +33
============================================
Files 46 51 +5
Lines 1184 1265 +81
Branches 105 112 +7
============================================
+ Hits 1090 1179 +89
+ Misses 62 50 -12
- Partials 32 36 +4
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:
|
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
ab2a549
to
8a9738f
Compare
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.
Do we have plans for e2e tests?
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
…ludeFromGeneratedCoverageReport, replace delomboked functions with lombok annotations Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
as discussed: will be a follow up task to add a gherkin test |
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
405c776
to
7fe0675
Compare
/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 re-introduces hook data support, which was previously reverted. The changes are quite extensive, refactoring the hook execution logic to be more structured and to support per-hook data stores for the duration of a flag evaluation. A key aspect of this PR is maintaining binary compatibility by deprecating old constructors and methods in HookContext
rather than removing them.
My review focuses on improving code clarity, robustness, and removing redundancy. I've suggested simplifying the lazy initialization in DefaultHookData
to make it thread-safe and easier to read. I've also pointed out a complex Optional
handling in HookSupport
that could be made more straightforward, and some redundant null checks in OpenFeatureClient
. Overall, the changes are well-structured and achieve the goal of adding hook data support while being mindful of backward compatibility.
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
22d183b
to
0e897f2
Compare
|
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.
lgtm, however, I would love to see a test that does a full flag evaluation using HookData
for (int i = 0; i < hookSupportData.hooks.size(); i++) { | ||
Pair<Hook, HookContext> hookContextPair = hookSupportData.hooks.get(i); | ||
HookContext curHookContext = sharedContext.hookContextFor(null, new DefaultHookData()); | ||
Pair<Hook, HookContext> updatedPair = Pair.of(hookContextPair.getKey(), curHookContext); |
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.
Can we use a setter here on the Pair to avoid to create Pairs twice for each Hook?
This PR
this re-adds hook data support avoiding breaking changes in the binary (we introduced with v1.18.0)
Related Issues
#1472
###Notes
With v1.18.1 we reverted the hook data feature: