From 5ed6c0cc08257495254083065933b4b270fe83c1 Mon Sep 17 00:00:00 2001 From: Michael Beemer Date: Fri, 8 Dec 2023 13:02:20 -0500 Subject: [PATCH] define how context can be managed for named provider using static context paradigm (#221) Signed-off-by: Michael Beemer --- specification.json | 25 +++++++++++++++-- .../sections/03-evaluation-context.md | 28 +++++++++++++++++-- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/specification.json b/specification.json index 86c76e66..ef8cda11 100644 --- a/specification.json +++ b/specification.json @@ -519,6 +519,20 @@ "content": "The Client and invocation MUST NOT have a method for supplying `evaluation context`.", "RFC 2119 keyword": "MUST NOT", "children": [] + }, + { + "id": "Conditional Requirement 3.2.2.3", + "machine_id": "conditional_requirement_3_2_2_3", + "content": "The API MUST have a method for setting `evaluation context` for a provider bound to a named client.", + "RFC 2119 keyword": "MUST", + "children": [] + }, + { + "id": "Conditional Requirement 3.2.2.4", + "machine_id": "conditional_requirement_3_2_2_4", + "content": "The API MUST have a a mechanism to manage `evaluation context` for an associated name.", + "RFC 2119 keyword": "MUST", + "children": [] } ] }, @@ -536,11 +550,18 @@ "RFC 2119 keyword": null, "children": [ { - "id": "Requirement 3.2.4.1", - "machine_id": "requirement_3_2_4_1", + "id": "Conditional Requirement 3.2.4.1", + "machine_id": "conditional_requirement_3_2_4_1", "content": "When the global `evaluation context` is set, the `on context changed` handler MUST run.", "RFC 2119 keyword": "MUST", "children": [] + }, + { + "id": "Conditional Requirement 3.2.4.2", + "machine_id": "conditional_requirement_3_2_4_2", + "content": "When the `evaluation context` for a specific provider is set, the `on context changed` handler MUST only run on the associated provider.", + "RFC 2119 keyword": "MUST", + "children": [] } ] }, diff --git a/specification/sections/03-evaluation-context.md b/specification/sections/03-evaluation-context.md index 3bee9503..919e0da4 100644 --- a/specification/sections/03-evaluation-context.md +++ b/specification/sections/03-evaluation-context.md @@ -75,7 +75,23 @@ API (global) `evaluation context` can be used to supply data to flag evaluation, > The Client and invocation **MUST NOT** have a method for supplying `evaluation context`. -In the static-context paradigm, context is global. The client and invocation cannot supply evaluation context. +In the static-context paradigm, context is global. The client and invocation cannot supply evaluation context. + +##### Conditional Requirement 3.2.2.3 + +> The API **MUST** have a method for setting `evaluation context` for a provider bound to a named client. + +In the static-context paradigm, provider specific context can be set using the associated name. +The global context is used if there is no matching provider specific context. + +See [setting a provider](./01-flag-evaluation.md#setting-a-provider) for details. + +##### Conditional Requirement 3.2.2.4 + +> The API **MUST** have a a mechanism to manage `evaluation context` for an associated name. + +In the static-context paradigm, it must be possible to create and remove provider-specific context. +See [setting a provider](./01-flag-evaluation.md#setting-a-provider) for details. #### Requirement 3.2.3 @@ -102,8 +118,14 @@ flowchart LR see: [static-context paradigm](../glossary.md#static-context-paradigm) -##### Requirement 3.2.4.1 +##### Conditional Requirement 3.2.4.1 > When the global `evaluation context` is set, the `on context changed` handler **MUST** run. -The SDK implementation must run the `on context changed` handler on the registered provider whenever the global `evaluation context` is mutated. \ No newline at end of file +The SDK implementation must run the `on context changed` handler on all registered provider that use the global `evaluation context` whenever it is mutated. + +##### Conditional Requirement 3.2.4.2 + +> When the `evaluation context` for a specific provider is set, the `on context changed` handler **MUST** only run on the associated provider. + +The SDK implementation must run the `on context changed` handler only on the provider that is scoped to the mutated `evaluation context`. \ No newline at end of file