Skip to content

Commit 4e920f7

Browse files
roncohenclaude
andcommitted
Merge main into docs/standalone-v2-node-guide
Brings in the SDK v2 CLI type generator (#817). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 parents b43bf7d + fb3b1a2 commit 4e920f7

146 files changed

Lines changed: 8277 additions & 10204 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@reflag/node-sdk": patch
3+
---
4+
5+
Keep secret flags out of browser data returned by `getFlagsForBootstrap()`, including bound clients. Server-side reads still work, including public flags that depend on secret flags. Remove dependency names from error details sent to the browser.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
"@reflag/browser-sdk": major
3+
"@reflag/react-sdk": major
4+
"@reflag/vue-sdk": major
5+
---
6+
7+
Adopt protocol-v2, adding support for multivariate and JSON flags in Browser, React and Vue.
8+
9+
- Browser `getFlag()` and React `useFlag()` return direct values instead of flag wrappers. Vue `useFlag()` returns a ref to the direct value. Replace `.isEnabled` and `.config` access with direct values, using `.value` for Vue refs in script.
10+
- Reads without a default return Booleans, using `false` when unavailable. Pass a positional default to read strings, numbers, arrays, or objects, with TypeScript inferring the return type. Missing values or values of a different top-level type use the default. Pass `null` to accept any JSON value, including null. Nested payload schemas are not validated at runtime.
11+
- React and Vue's optional `Flags` registration checks non-null defaults against each flag's value type, including React Suspense reads. Named-interface and readonly defaults are supported across Browser, React and Vue without losing their inferred value types.
12+
- React `useFlag()` never suspends. Replace `useFlag(key, { suspense: true })` with `useFlagSuspense(key)` to wait for initialization. Use `useIsLoading()` for loading state; existing provider and `useOptInFlags` Suspense options continue to control opt-in loading only.
13+
- Flag reads automatically record checks. Replace flag-level `.track()` and `.requestFeedback()` calls with the client's separate methods or the framework's tracking and feedback hooks/composables.
14+
- Browser `getFlags()` returns a record of direct values; unavailable flags may be `undefined`. Use `getFlagResults()` for diagnostic access without recording checks.
15+
- Bootstrap data must come from Node SDK v2 and be consumed by matching v2 SDKs. Legacy v1 payloads are incompatible. Replace the Browser client's `bootstrappedFlags` option with `bootstrappedState` and pass the complete bootstrap payload.
16+
- Overrides accept direct JSON values: `undefined` clears an override, while `null` is a value. Saved v1 caches and overrides are not reused.
17+
- Bootstrapped clients load opt-in metadata when requested, without replacing server-provided flag values. Successful opt-in changes update both membership and flag values.
18+
19+
The OpenFeature Browser provider continues to use Browser SDK v1. Legacy remote configuration is not automatically converted into multivariate flag values.

‎.changeset/cli-multi-org.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@reflag/cli": patch
3+
---
4+
5+
Fix app discovery for users who belong to multiple organizations. `reflag apps list` shows each app's organization, `reflag init` lets you choose an organization, and existing configs resolve their `appId` without requiring an `orgId`. Use `orgId` or `--org-id` to restrict the CLI to one organization. API keys remain scoped to their app.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@reflag/node-sdk": patch
3+
"@reflag/react-sdk": patch
4+
"@reflag/vue-sdk": patch
5+
"@reflag/react-native-sdk": patch
6+
---
7+
8+
Replace workspace-only dependency ranges with registry-compatible versions so the published SDKs can be installed outside the monorepo. Keep local workspace linking and the existing v1 OpenFeature dependencies unchanged.

‎.changeset/openfeature-node-esm.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@reflag/openfeature-node-provider": patch
3+
---
4+
5+
Allow ES modules to import the Node.js OpenFeature provider through its existing CommonJS build. CommonJS imports and TypeScript declarations are unchanged.

‎.changeset/pre.json‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"mode": "exit",
3+
"tag": "next",
4+
"initialVersions": {
5+
"@reflag/browser-sdk": "2.0.0-next.0",
6+
"@reflag/cli": "1.0.4",
7+
"@reflag/flag-evaluation": "2.0.0",
8+
"@reflag/management-sdk": "0.1.0",
9+
"customer-admin-panel": "0.0.1",
10+
"@reflag/node-sdk": "2.0.0-next.0",
11+
"@reflag/openfeature-browser-provider": "1.3.17",
12+
"nextjs-openfeature-example": "0.2.0",
13+
"@reflag/openfeature-node-provider": "1.2.8",
14+
"@reflag/react-native-sdk": "2.0.0-next.0",
15+
"reflag-react-native-sdk-bare-rn": "0.0.0",
16+
"reflag-react-sdk-expo": "0.0.0",
17+
"@reflag/react-sdk": "2.0.0-next.0",
18+
"nextjs-bootstrap-demo": "0.2.0",
19+
"nextjs-flag-demo": "0.2.0",
20+
"@reflag/rest-api-sdk": "0.0.6",
21+
"@reflag/tsconfig": "0.0.2",
22+
"@reflag/vue-sdk": "2.0.0-next.0"
23+
},
24+
"changesets": [
25+
"bootstrap-public-flags-only",
26+
"browser-framework-collection-values",
27+
"fix-published-workspace-dependencies",
28+
"node-sdk-collection-values",
29+
"react-native-collection-values",
30+
"registered-defaults-cli-v2",
31+
"tidy-dependency-scanning"
32+
]
33+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
"@reflag/react-native-sdk": major
3+
---
4+
5+
Adopt protocol-v2, adding support for multivariate and JSON flags in React Native.
6+
7+
- `useFlag()` returns direct values instead of flag wrappers. Reads without a default return Booleans, using `false` when unavailable. Replace `.isEnabled` and `.config` access with direct values.
8+
- Pass a positional default to read strings, numbers, arrays, or objects, with TypeScript inferring the return type. Missing values or values of a different top-level type use the default. Pass `null` to accept any JSON value, including null. Nested payload schemas are not validated at runtime.
9+
- `useFlag()` never suspends. Replace `useFlag(key, { suspense: true })` with `useFlagSuspense(key)` to wait for initialization, and use `useIsLoading()` for loading state.
10+
- Flag reads automatically record checks. Replace flag-level tracking and feedback methods with `useTrack()` and `useSendFeedback()`, using your own Native feedback UI.
11+
- Optional flag typing uses React's `Flags` registration in `@reflag/react-sdk`. Non-null defaults are checked against each registered flag's value type, and named-interface and readonly defaults are supported. Regenerate legacy wrapper-shaped declarations before upgrading.
12+
- Bootstrap data must come from Node SDK v2. Pass the complete payload to `ReflagBootstrappedProvider`; legacy v1 payloads are incompatible.
13+
- AsyncStorage persistence, native live updates and custom storage/SSE adapters remain supported. Live updates are enabled by default; the web toolbar and automatic feedback UI are disabled by default.
14+
- Offline fallbacks accept direct JSON value maps. Arrays of enabled Boolean flag keys remain supported.
15+
- Requires React 17 or later, compatible with your React Native runtime, and matching v2 React/Browser SDKs.
16+
17+
Legacy wrapper and remote-config types are removed. Legacy remote configuration is not automatically converted into multivariate flag values.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@reflag/cli": major
3+
---
4+
5+
Move the CLI to the v2 management flag API and generate direct-value declarations from current production-environment multivariate variants instead of legacy config wrappers. Add Vue generation, JSON-safe empty-shape inference and property escaping, and update generated coding-agent instructions for the v2 APIs. The CLI update requires compatible management endpoints and SDK v2; SDK v1 applications must retain the CLI 1.x generator.

‎.github/workflows/package-ci.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,20 @@ jobs:
2929
- name: Restore package.json
3030
# This step is necessary because the previous step may have updated package.json
3131
run: git checkout -- package.json packages/*/package.json
32+
- name: Check release channel safeguards
33+
run: yarn test:release
3234
- name: Install Playwright Browsers
3335
run: yarn playwright install --with-deps
3436
working-directory: ./packages/browser-sdk
3537
- id: build
3638
name: Build the project
3739
run: yarn build
40+
- name: Check generated CLI declarations
41+
run: node packages/cli/test/generated-types.mjs
3842
- name: Build docs
3943
run: yarn docs
44+
- name: Test documentation publication boundaries
45+
run: yarn test:docs-publishing
4046
- id: test
4147
name: Test the project
4248
run: yarn test:ci
@@ -47,6 +53,10 @@ jobs:
4753
done
4854
- name: Report test results
4955
uses: dorny/test-reporter@v1.6.0
56+
# Reporting only. Failing tests already fail the "Test the project"
57+
# step; a reporter API error (seen on merge queue commits) shouldn't
58+
# fail the required "Build & Test" job.
59+
continue-on-error: true
5060
with:
5161
name: Build & Test Report
5262
path: ./packages/*/junit.xml

‎.github/workflows/publish.yml‎

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Release packages
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
@@ -9,6 +10,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
910

1011
jobs:
1112
release:
13+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
1214
runs-on: ubuntu-latest
1315
permissions:
1416
contents: write
@@ -30,6 +32,9 @@ jobs:
3032
scope: "@reflag"
3133
- name: Install dependencies
3234
run: yarn install --immutable
35+
- name: Determine release channel
36+
id: release-channel
37+
run: node scripts/release-channel.mjs >> "$GITHUB_OUTPUT"
3338
- name: Create release PR or publish packages
3439
id: changesets
3540
uses: changesets/action@v1
@@ -40,26 +45,41 @@ jobs:
4045
commit: Version Packages
4146
env:
4247
GITHUB_TOKEN: ${{ secrets.CHANGESETS_BOT_TOKEN }}
43-
- name: Build docs
44-
if: steps.changesets.outputs.published == 'true'
45-
run: yarn docs
48+
- name: Select released SDK documentation
49+
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false'
50+
id: docs
51+
env:
52+
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
53+
run: node scripts/docs-release-plan.mjs "$RUNNER_TEMP/sdk-docs-plan.json"
4654
- name: Checkout docs with SSH
47-
if: steps.changesets.outputs.published == 'true'
48-
uses: actions/checkout@v3
55+
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs.outputs.has_docs == 'true'
56+
uses: actions/checkout@v4
4957
with:
5058
repository: reflagcom/docs
5159
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
5260
path: reflag-docs
53-
- name: Copy generated docs to docs repo
54-
if: steps.changesets.outputs.published == 'true'
55-
run: |
56-
rm -rf reflag-docs/sdk
57-
cp -R dist/docs reflag-docs/sdk
61+
- name: Hold docs sync until the public v1/v2 content cutover
62+
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs.outputs.has_docs == 'true'
63+
id: docs-site
64+
run: node reflag-docs/.github/scripts/sdk-docs.mjs ready --destination reflag-docs | tee -a "$GITHUB_OUTPUT"
65+
- name: Build docs
66+
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs-site.outputs.ready == 'true'
67+
run: yarn docs
68+
- name: Sync only released packages and majors
69+
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs-site.outputs.ready == 'true'
70+
run: node reflag-docs/.github/scripts/sdk-docs.mjs release --source . --destination reflag-docs --plan "$RUNNER_TEMP/sdk-docs-plan.json"
71+
- name: Check generated documentation
72+
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs-site.outputs.ready == 'true'
73+
working-directory: reflag-docs
74+
run: node .github/scripts/check-sdk-docs.mjs
5875
- name: Commit and push changes
59-
if: steps.changesets.outputs.published == 'true'
76+
if: steps.changesets.outputs.published == 'true' && steps.release-channel.outputs.prerelease == 'false' && steps.docs-site.outputs.ready == 'true'
77+
working-directory: reflag-docs
6078
run: |
61-
cd reflag-docs
6279
git config user.name "github-actions[bot]"
6380
git config user.email "github-actions[bot]@reflag.com"
64-
git add sdk
65-
git commit -m "Update documentation" && git push || echo "No docs changes to commit"
81+
git add supported-languages legacy api sdk .generated/sdk-docs
82+
if ! git diff --cached --quiet; then
83+
git commit -m "Update released SDK documentation"
84+
git push
85+
fi

0 commit comments

Comments
 (0)