feat: Hook support for client class - #127
Conversation
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <115723925+NeaguGeorgiana23@users.noreply.github.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
…pdate_global_api
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
|
Warning Review limit reached
Next review available in: 44 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds ChangesEvaluation and client hook APIs
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ClientAPI
participant EvaluateFlag
participant FeatureProvider
ClientAPI->>EvaluateFlag: pass EvaluationContext and EvaluationOptions
EvaluateFlag->>FeatureProvider: evaluate typed flag
FeatureProvider-->>ClientAPI: return typed evaluation result
sequenceDiagram
participant Application
participant OpenFeatureAPI
participant HookStorage
Application->>OpenFeatureAPI: AddHook or AddHooks
OpenFeatureAPI->>HookStorage: store valid hooks under lock
Application->>OpenFeatureAPI: GetHooks
OpenFeatureAPI-->>Application: return hook snapshot
Application->>OpenFeatureAPI: Shutdown
OpenFeatureAPI->>HookStorage: clear registered hooks
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
openfeature/openfeature.h (1)
40-62: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftPreserve compatibility for existing
OpenFeatureimplementations.The previous interface used default arguments on the domain overloads. The new pure virtual overloads for
GetProvider,GetProviderMetadata, andGetProviderStatusmake existing subclasses abstract after recompilation. They also change the vtable layout for existing binaries.Keep the domain overloads as the virtual extension points. Implement the no-argument overloads as non-virtual forwarding helpers, or document this as a major-version ABI and source-compatibility break.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@openfeature/openfeature.h` around lines 40 - 62, Preserve source and binary compatibility in the OpenFeature interface by making the no-argument GetProvider, GetProviderMetadata, and GetProviderStatus overloads non-virtual forwarding helpers, while retaining the domain overloads as the virtual extension points. Ensure each helper delegates to the corresponding default-domain behavior without requiring existing OpenFeature subclasses to implement new pure virtual methods.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@openfeature/client_api.h`:
- Around line 9-14: Update openfeature/client_api.h to include the standard
<shared_mutex> header directly, alongside the existing standard-library
includes, so its std::shared_mutex declaration does not rely on transitive
inclusion.
---
Outside diff comments:
In `@openfeature/openfeature.h`:
- Around line 40-62: Preserve source and binary compatibility in the OpenFeature
interface by making the no-argument GetProvider, GetProviderMetadata, and
GetProviderStatus overloads non-virtual forwarding helpers, while retaining the
domain overloads as the virtual extension points. Ensure each helper delegates
to the corresponding default-domain behavior without requiring existing
OpenFeature subclasses to implement new pure virtual methods.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 248816f4-a3f8-4c5f-8ec1-0b65d94bcc19
📒 Files selected for processing (14)
openfeature/BUILDopenfeature/client.hopenfeature/client_api.cppopenfeature/client_api.hopenfeature/features.hopenfeature/flag_evaluation_details.hopenfeature/hook.hopenfeature/openfeature.hopenfeature/openfeature_api.cppopenfeature/openfeature_api.htest/BUILDtest/client_api_test.cpptest/hook_test.cpptest/openfeature_api_test.cpp
0b6c84b to
3e28c56
Compare
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
This PR
AddHook,AddHooks,GetHooks) on theClientinterface andClientAPIclass specified in OpenFeature Specification Requirement 1.2.1.ClientAPIusingstd::shared_mutexfor reader-writer concurrency.nullptrentries are filtered out when registering hooks and registration order is preserved.client,client_api, andclient_api_testtargets.test/client_api_test.cppcovering initial state, single/multiple hook registration, order preservation, and null filtering.Related Issues
Fixes #126
Notes
Follow-up Tasks
before,after,error,finally) insideClientAPI::EvaluateFlag.EvaluationOptions(for invocation-level hooks and hints).Get*Details).