feat: hook execution lifecycle - #136
Open
NeaguGeorgiana23 wants to merge 2 commits into
Open
Conversation
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR
ClientAPIaccording to Section 4 of the OpenFeature specification.HookSupportto encapsulate hook aggregation and stage execution helpers:CollectHooks: Aggregates hooks across API, Client, Invocation, and Provider tiers in FIFO precedence order while filtering outnullptrentries.CreateHookDataMap: CreatesHookDatainstances per unique hook to persist stage data across an evaluation.ExecuteBeforeHooks: Executesbeforehooks in forward order (APIExecuteAfterHooks: Executesafterhooks in reverse order (ProviderExecuteErrorHooks: Executeserrorhooks in reverse order upon abnormal execution (in before, resolution, or after stages), catching and suppressing exceptions per Requirement 4.4.4.ExecuteFinallyHooks: Unconditionally executesfinallyhooks in reverse order, catching and suppressing exceptions per Requirement 4.4.3.const T* GetAs(const std::string& key) constoverload toHookDatafor const-safe access to stored hook state.ClientAPI::EvaluateFlagevaluate flags cleanly viaHookSupport.test/client_api_test.cppandtest/hook_data_test.cppcovering hook execution order, hint propagation, type filtering, exception handling, and provider lifecycle status routing (kNotReady,kFatal,kError,kStale).Related Issues
Fixes #135
Notes
beforehooks from least specific to most specific (APIafter/error/finallyin reverse order.errororfinallyhooks are safely caught and swallowed to guarantee evaluation completes.