Uh oh!
There was an error while loading. Please reload this page.
feat: add client-level evaluation context setter - #586
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces client-level evaluation context management by adding set_evaluation_context and get_evaluation_context methods to the OpenFeatureClient class. It also includes comprehensive tests to verify context merging behavior across API, client, and invocation levels for both synchronous and asynchronous calls. The feedback suggests updating the context setter to handle potential None values by defaulting to an empty EvaluationContext, ensuring type consistency.
| def set_evaluation_context(self, context: EvaluationContext) -> None: | ||
| self.context = context |
There was a problem hiding this comment.
To maintain consistency with the class constructor and ensure that self.context always holds a valid EvaluationContext instance (as expected by the type hint in get_evaluation_context), the setter should handle None by defaulting to an empty context. This prevents potential type errors if None is passed at runtime.
| defset_evaluation_context(self, context: EvaluationContext) ->None: | |
| self.context=context | |
| defset_evaluation_context(self, context: EvaluationContext) ->None: | |
| self.context=contextorEvaluationContext() |
gruebel
commented
Apr 11, 2026
please check this comment #565 (comment) for a previous PR targeting the same issue |
…atureClient Allow setting evaluation context at the client level, following the OpenFeature spec for context merging: API-level context is merged with client-level context, then with invocation-level context, where later levels take precedence over earlier ones. Closesopen-feature#500 Signed-off-by: buildingisfun23 <buildingisfun23@users.noreply.github.com>
f094b3a to
202e548CompareSigned-off-by: buildingisfun23 <buildingisfun23@users.noreply.github.com>
Summary
set_evaluation_context()andget_evaluation_context()methods toOpenFeatureClientFixes#500