Skip to content

Commit 186741e

Browse files
authored
Consolidate evaluation context merge order in the spec (#132)
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
1 parent 3da57e4 commit 186741e

4 files changed

Lines changed: 21 additions & 8 deletions

File tree

specification.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@
301301
{
302302
"id": "Requirement 3.2.2",
303303
"machine_id": "requirement_3_2_2",
304-
"content": "Evaluation context MUST be merged in the order: API (global) - client - invocation, with duplicate values being overwritten.",
304+
"content": "Evaluation context MUST be merged in the order: API (global; lowest precedence) - client - invocation - before hooks (highest precedence), with duplicate values being overwritten.",
305305
"RFC 2119 keyword": "MUST",
306306
"children": []
307307
},
@@ -393,7 +393,7 @@
393393
{
394394
"id": "Requirement 4.3.4",
395395
"machine_id": "requirement_4_3_4",
396-
"content": "When `before` hooks have finished executing, any resulting `evaluation context` MUST be merged with the existing `evaluation context` in the following order: before-hook (highest precedence), invocation, client, api (lowest precedence).",
396+
"content": "When `before` hooks have finished executing, any resulting `evaluation context` MUST be merged with the existing `evaluation context`.",
397397
"RFC 2119 keyword": "MUST",
398398
"children": []
399399
},

specification/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: intro
3-
title: Intro
4-
description: An intro to the OpenFeature specification.
3+
title: Introduction
4+
description: An introduction to the OpenFeature specification.
55
sidebar_position: 0
66
---
77

specification/sections/03-evaluation-context.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ see: [structure](../types.md#structure), [datetime](../types.md#datetime)
4040

4141
> The evaluation context fields **MUST** have an unique key.
4242
43-
The key uniquely identifies a field in the `evaluation context` and it should be unique accross all types to avoid any collision when marshelling the `evaluation context` by the provider.
43+
The key uniquely identifies a field in the `evaluation context` and it should be unique across all types to avoid any collision when marshalling the `evaluation context` by the provider.
4444

4545
### Merging Context
4646

@@ -52,6 +52,17 @@ API (global) `evaluation context` can be used to supply static data to flag eval
5252

5353
#### Requirement 3.2.2
5454

55-
> Evaluation context **MUST** be merged in the order: API (global) -> client -> invocation, with duplicate values being overwritten.
55+
> Evaluation context **MUST** be merged in the order: API (global; lowest precedence) -> client -> invocation -> before hooks (highest precedence), with duplicate values being overwritten.
5656
57-
Any fields defined in the client `evaluation context` will overwrite duplicate fields defined globally, and fields defined in the invocation `evaluation context` will overwrite duplicate fields defined in the globally or on the client.
57+
Any fields defined in the client `evaluation context` will overwrite duplicate fields defined globally, and fields defined in the invocation `evaluation context` will overwrite duplicate fields defined globally or on the client. Any resulting `evaluation context` from a [before hook](./04-hooks.md#requirement-434) will overwrite duplicate fields defined globally, on the client, or in the invocation.
58+
59+
```mermaid
60+
flowchart LR
61+
global("API (global)")
62+
client("Client")
63+
invocation("Invocation")
64+
hook("Before Hooks")
65+
global --> client
66+
client --> invocation
67+
invocation --> hook
68+
```

specification/sections/04-hooks.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ EvaluationContext | void before(HookContext, HookHints);
8787
8888
#### Requirement 4.3.4
8989

90-
> When `before` hooks have finished executing, any resulting `evaluation context` **MUST** be merged with the existing `evaluation context` in the following order: before-hook (highest precedence), invocation, client, api (lowest precedence).
90+
> When `before` hooks have finished executing, any resulting `evaluation context` **MUST** be merged with the existing `evaluation context`.
91+
92+
Evaluation context merge order is defined in [Requirement 3.2.2](./03-evaluation-context.md#requirement-322).
9193

9294
#### Requirement 4.3.5
9395

0 commit comments

Comments
 (0)