You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/flagship/concepts.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ sidebar:
5
5
order: 3
6
6
---
7
7
8
-
Flagship organizes feature flags into apps. You define flags with variations and targeting rules, then evaluate them at the edge with low latency.
8
+
Flagship organizes feature flags into apps. You define flags with variations and targeting rules, then evaluate them at the edge.
9
9
10
10
## How it works
11
11
@@ -83,7 +83,7 @@ Each rule contains:
83
83
- An optional **percentage rollout** that splits traffic across variations.
84
84
- A **variation** to serve when the rule matches.
85
85
86
-
Conditions within a rule can be grouped with `AND`/`OR` operators and nested up to six levels deep.
86
+
Conditions within a rule can be grouped with `AND`/`OR` operators.
87
87
88
88
Refer to [Targeting rules](/flagship/targeting/) and [Operators](/flagship/targeting/operators/) for the full list of operators and configuration options.
89
89
@@ -110,4 +110,4 @@ When you change a flag in the dashboard, the change propagates globally within s
110
110
111
111
During the brief propagation window, some regions may still serve the previous flag value. After propagation completes, all subsequent evaluations return the updated value.
112
112
113
-
This model is optimized for low-latency evaluation at the edge. You do not need to redeploy your Worker or restart your application to pick up flag changes.
113
+
You do not need to redeploy your Worker or restart your application to pick up flag changes.
Copy file name to clipboardExpand all lines: src/content/docs/flagship/sdk/client-provider.mdx
+26-11Lines changed: 26 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,17 +5,27 @@ sidebar:
5
5
order: 2
6
6
---
7
7
8
-
The `FlagshipClientProvider` implements the OpenFeature web provider interface for browser applications. It pre-fetches all flag values on initialization and resolves evaluations synchronously from an in-memory cache.
8
+
The `FlagshipClientProvider` implements the OpenFeature web provider interface for browser applications. It pre-fetches a declared set of flag values on initialization and resolves evaluations synchronously from an in-memory cache.
9
9
10
10
This makes the provider suitable for client-side rendering where synchronous access to flag values is required.
11
11
12
12
:::caution[Important]
13
13
The client provider requires an API token to fetch flag values. This token is not scoped to a single app, so anyone with the token can **evaluate flags** across all apps in your account. App-scoped tokens are coming soon. Until then, use the client provider with caution in public-facing applications.
14
14
:::
15
15
16
+
## prefetchFlags
17
+
18
+
`prefetchFlags` is a required array of flag keys that the provider fetches during initialization and on every context change. Only flags listed in this array are available for synchronous evaluation — any flag key not included returns a `FLAG_NOT_FOUND` error at resolution time.
19
+
20
+
**Fetch behavior:**
21
+
22
+
-**On initialization** — all flags in `prefetchFlags` are fetched in parallel and stored in an in-memory cache. The provider transitions to `READY` once all fetches complete (individual failures are non-fatal).
23
+
-**On context change** — the cache is invalidated and all flags are re-fetched for the new context. This is required by the [static context paradigm](https://openfeature.dev/specification/glossary/#static-context-paradigm) used by the OpenFeature web SDK, where context is set globally and providers are expected to re-evaluate when it changes.
24
+
-**At resolution time** — evaluations are served synchronously from the cache. No network request is made during `getBooleanValue`, `getStringValue`, etc.
25
+
16
26
## Setup
17
27
18
-
The following example initializes the provider and evaluates a flag in a browser application.
28
+
The following example initializes the provider with a set of pre-fetched flags and evaluates them in a browser application.
|`appId`|`string`| Yes | The Flagship app ID from the Cloudflare dashboard. |
66
+
|`accountId`|`string`| Yes | Your Cloudflare account ID. |
67
+
|`authToken`|`string`| Yes | A Cloudflare [API token](/fundamentals/api/get-started/create-token/) with Flagship read permissions. |
68
+
|`prefetchFlags`|`string[]`| Yes | Flag keys to fetch on initialization and on every context change. Flags not in this list return `FLAG_NOT_FOUND` at evaluation time. |
54
69
55
70
## When to use the client provider
56
71
57
72
Use the client provider in browser applications, single-page apps, or any client-side JavaScript environment.
58
73
59
-
Evaluations are synchronous, so they do not block rendering. Flag values are fetched once during initialization. To refresh flag values, re-initialize the provider.
74
+
Evaluations are synchronous, so they do not block rendering. Flag values are fetched once during initialization and re-fetched whenever the evaluation context changes. To force a refresh, update the context via `OpenFeature.setContext(...)`.
Copy file name to clipboardExpand all lines: src/content/docs/flagship/targeting/index.mdx
+24-7Lines changed: 24 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,15 +31,32 @@ Each condition compares an attribute from the evaluation context against a value
31
31
32
32
## Logical grouping
33
33
34
-
Conditions within a rule can be grouped using `AND`/`OR`logical operators. Groups can be nested up to six levels deep for complex targeting logic.
34
+
Conditions within a rule are combined with `AND` and `OR` operators. The grouping follows a simple rule: **`OR` starts a new group, `AND` stays in the current group**. Equivalently, `AND` binds tighter than `OR`.
35
35
36
-
For example, to target enterprise users in the US or Canada:
36
+
You can think of the condition list as being split at every `OR` boundary. Each segment between `OR`s forms its own group, and all `AND`s inside that segment belong to the same group. The rule matches when any one group matches entirely.
37
37
38
-
-`AND`:
39
-
-`plan equals "enterprise"`
40
-
-`OR`:
41
-
-`country equals "US"`
42
-
-`country equals "CA"`
38
+
For example:
39
+
40
+
```
41
+
IF country IN ["US", "CA"]
42
+
AND plan equals "enterprise"
43
+
OR email ends_with "cloudflare.com"
44
+
OR beta_tester equals true
45
+
AND user_age_days > 30
46
+
```
47
+
48
+
This evaluates as:
49
+
50
+
```
51
+
(country IN ["US", "CA"] AND plan equals "enterprise")
52
+
OR (email ends_with "cloudflare.com")
53
+
OR (beta_tester equals true AND user_age_days > 30)
54
+
```
55
+
56
+
The rule matches users who are either:
57
+
- in the US or Canada **and** on the enterprise plan, or
58
+
- using a `cloudflare.com` email address, or
59
+
- a beta tester **and** have been a user for more than 30 days.
Copy file name to clipboardExpand all lines: src/content/docs/flagship/targeting/percentage-rollouts.mdx
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,12 @@ Flagship uses consistent hashing on a configurable attribute to assign users to
17
17
18
18
By default, the bucketing attribute is `targetingKey`. You can configure which attribute to use for bucketing when you set up the rollout in the dashboard.
19
19
20
+
:::caution[Random assignment without targetingKey]
21
+
If `targetingKey` is not present in the evaluation context and no alternative bucketing attribute is configured, Flagship cannot produce a stable hash. In this case the rollout bucket is assigned randomly on each evaluation, meaning the same user may receive different flag values across requests.
22
+
23
+
Always provide a stable `targetingKey` (or configure a consistent bucketing attribute) to guarantee sticky bucketing.
24
+
:::
25
+
20
26
## Example
21
27
22
28
Consider a flag `new-checkout` with the following rules:
0 commit comments