Skip to content

Commit 5964658

Browse files
committed
fix: additional clarity, events fixes
* Adds additional clarity regarding provider/client name mapping, as well as intent. * Requires that READY events only run immediately for clients when the provider is already ready. * Replaces client-name for provider-name in events-details.
1 parent 77e0b9c commit 5964658

File tree

3 files changed

+31
-18
lines changed

3 files changed

+31
-18
lines changed

specification.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
{
3232
"id": "Requirement 1.1.3",
3333
"machine_id": "requirement_1_1_3",
34-
"content": "The `API` MUST provide a function to bind a given `provider` to one or more client `name`s. If the client-name already has a bound provider, it is overwritten with the new mapping.",
34+
"content": "The `API` MUST provide a function to bind a given `provider` to a client `name`. If the client-name already has a bound provider, it is overwritten with the new mapping.",
3535
"RFC 2119 keyword": "MUST",
3636
"children": []
3737
},
@@ -675,7 +675,7 @@
675675
{
676676
"id": "Requirement 5.2.3",
677677
"machine_id": "requirement_5_2_3",
678-
"content": "The `event details` MUST contain the `client name` associated with the event.",
678+
"content": "The `event details` MUST contain the `provider name` associated with the event.",
679679
"RFC 2119 keyword": "MUST",
680680
"children": []
681681
},
@@ -724,7 +724,7 @@
724724
{
725725
"id": "Requirement 5.3.3",
726726
"machine_id": "requirement_5_3_3",
727-
"content": "`PROVIDER_READY` handlers attached after the provider is already in a ready state MUST run immediately.",
727+
"content": "Client `PROVIDER_READY` handlers attached after the provider is in a ready state MUST run immediately.",
728728
"RFC 2119 keyword": "MUST",
729729
"children": []
730730
}

specification/sections/01-flag-evaluation.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ It's important that multiple instances of the `API` not be active, so that state
3131
OpenFeature.setProvider(new MyProvider());
3232
```
3333

34-
This provider is used if there is not a more specific client name binding. (see later requirements).
34+
This provider is used if a client is not bound to a specific provider through its name.
3535

36-
See [provider](./02-providers.md) for details.
36+
See [provider](./02-providers.md), [creating clients](#creating-clients).
3737

3838
#### Requirement 1.1.2.2
3939

@@ -56,12 +56,16 @@ see: [shutdown](./02-providers.md#25-shutdown), [setting a provider](#setting-a-
5656

5757
#### Requirement 1.1.3
5858

59-
> The `API` **MUST** provide a function to bind a given `provider` to one or more client `name`s. If the client-name already has a bound provider, it is overwritten with the new mapping.
59+
> The `API` **MUST** provide a function to bind a given `provider` to a client `name`. If the client-name already has a bound provider, it is overwritten with the new mapping.
6060
6161
```java
6262
OpenFeature.setProvider("client-name", new MyProvider());
6363
```
6464

65+
Named clients can be associated with a particular provider by supplying a matching name when the provider is set.
66+
67+
See [creating clients](#creating-clients).
68+
6569
#### Requirement 1.1.4
6670

6771
> The `API` **MUST** provide a function to add `hooks` which accepts one or more API-conformant `hooks`, and appends them to the collection of any previously added hooks. When new hooks are added, previously added hooks are not removed.
@@ -84,20 +88,23 @@ OpenFeature.getProviderMetadata();
8488

8589
See [provider](./02-providers.md) for details.
8690

91+
### Creating clients
92+
8793
#### Requirement 1.1.6
8894

8995
> The `API` **MUST** provide a function for creating a `client` which accepts the following options:
9096
>
9197
> - name (optional): A logical string identifier for the client.
9298
93-
```typescript
99+
```java
94100
// example client creation and retrieval
95-
OpenFeature.getClient({
96-
name: "my-openfeature-client",
97-
});
101+
OpenFeature.getClient(name: "my-named-client");
98102
```
99103

100-
The name is a logical identifier for the client.
104+
The name is a logical identifier for the client which may be associated with a particular provider.
105+
If a client name is not bound to a particular provider, the client is associated with the default provider.
106+
107+
See [setting a provider](#setting-a-provider) for details.
101108

102109
#### Requirement 1.1.7
103110

specification/sections/05-events.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Events Extensions
2+
title: Events
33
description: Specification defining event semantics
44
toc_max_heading_level: 4
55
---
@@ -80,10 +80,12 @@ see: [provider events](#51-provider-events), [`provider event types`](../types.m
8080

8181
#### Requirement 5.2.3
8282

83-
> The `event details` **MUST** contain the `client name` associated with the event.
83+
> The `event details` **MUST** contain the `provider name` associated with the event.
8484
85-
The `client name` indicates the client/provider pair with which the event is associated.
86-
This is especially relevant for event handlers which are attached to the `API`, not a particular client.
85+
The `provider name` indicates the provider from which the event originated.
86+
This is especially relevant for global event handlers used for general monitoring, such as alerting on provider errors.
87+
88+
See [setting a provider](./01-flag-evaluation.md#setting-a-provider), [creating clients](./01-flag-evaluation.md#creating-clients).
8789

8890
#### Requirement 5.2.4
8991

@@ -99,7 +101,7 @@ see: [`event details`](../types.md#event-details)
99101

100102
> Event handlers **MUST** persist across `provider` changes.
101103
102-
If a provider is changed, existing event handlers will still fire.
104+
If the underlying provider is changed, existing client and API event handlers will still fire.
103105
This means that the order of provider configuration and event handler addition is independent.
104106

105107
#### Requirement 5.2.7
@@ -134,6 +136,10 @@ See [provider initialization](./02-providers.md#24-initialization) and [setting
134136

135137
#### Requirement 5.3.3
136138

137-
> `PROVIDER_READY` handlers attached after the provider is already in a ready state **MUST** run immediately.
139+
> Client `PROVIDER_READY` handlers attached after the provider is in a ready state **MUST** run immediately.
138140
139-
See [provider initialization](./02-providers.md#24-initialization) and [setting a provider](./01-flag-evaluation.md#setting-a-provider).
141+
_Application authors_ may attach readiness handlers to be confident that system is ready to evaluate flags.
142+
If such handlers are attached after the provider underlying the client has already been initialized, they should run immediately.
143+
API (global) handlers have no such requirement, as they are potentially bound to multiple providers and are used primarily for diagnostic purposes.
144+
145+
See [provider initialization](./02-providers.md#24-initialization), [setting a provider](./01-flag-evaluation.md#setting-a-provider).

0 commit comments

Comments
 (0)