Repository navigation
feat: adopt v2 flag values in Browser, React, Vue and React Native SDKs - #791
Conversation
…browser-framework-sdk-v2
…browser-framework-sdk-v2
Keep published evaluator 2.0.0 and main's dependency updates, port ETag revalidation and initialization diagnostics to complete collections, preserve application-owned shutdown, and address the three Node migration review regressions. Keep OpenFeature and the v1 bootstrap demo isolated on published Node 1.8.3.
Preserve Browser/React/Vue v2 transport, direct values and bootstrap APIs while carrying forward main's initialization diagnostics, readable opt-in error responses, security updates and test cleanup. Keep legacy framework consumers on published v1 and validate the combined Node-to-Browser bootstrap contract.
|
Reconciled with current Node v2 and main in merge commit
Separate stacked memoization/guide PRs, CLI work, packed release acceptance and server/snapshot/publication gates remain separate. |
There was a problem hiding this comment.
Risk: high
Assessed 91 changed files in 5 complete diff batches. All suggestions batches preceded independent correctness sessions.
Batch 1: Reviewed this batch’s Browser SDK protocol-v2 migration, value reads, bootstrap validation, caching, overrides, opt-in handling, and release safeguards, including surrounding code, callers, tests, and resolved discussions. No actionable P1 or P2 regression was substantiated. Review was limited to immutable repository snapshots; tests were not run.
Batch 2: No actionable P1/P2 bugs substantiated in this test-focused batch after inspecting related transport validation, caching, initialization, and feedback code. Review was read-only; tests were not run. Risk reflects the broader PR’s SDK public-contract and protocol migration.
Batch 3: Reviewed this batch’s React Native v2 integration, release/type tests, example changes, and related React/Browser implementation and build configuration. No actionable P1/P2 regression was substantiated in the supplied changed lines. Review was read-only; tests were not run. The broader v2 public API and bootstrap compatibility changes carry high integration risk.
Batch 4: Reviewed the supplied React SDK changes and related Browser SDK implementations. Found one object-valued hook regression affecting React effects. Review was read-only; no tests were executed. Risk is high because the original PR changes public SDK contracts, bootstrap compatibility, and the evaluation protocol across frameworks.
Batch 5: Reviewed this batch’s Vue composable, bootstrap loading, public type, release-channel, and dependency changes, including surrounding providers and browser-client behavior. No actionable P1/P2 regression was substantiated. Review was limited to immutable repository snapshots; tests were not run. Overall risk remains high because the PR changes core flag-value and bootstrap contracts across SDKs and prerelease distribution.
Optional refactor suggestions are labeled separately from correctness findings.
Advisory AI review; no code was changed and no tests were executed.
|
Resolved the new main conflict in ca1a1ee, a normal merge of main e81c3fa into the existing feature branch (no rebase or force push). The only conflict was the Fresh validation: root and standalone Cloudflare immutable installs; all 8 release safeguard tests; evaluator/Node/Browser/React/Vue/Native builds; Browser/React/Vue compiler programs and 311 runtime tests (269 + 27 + 15); scoped formatting, whitespace checks, and normal commit hooks pass. The earlier 1,007-test/full E2E checkpoint remains historical; it was not rerun in full for this dependency-only reconciliation. Fresh remote CI must complete. |
|
Addressed both remaining unresolved suggestions in cab0697:
Validation: Native build, all five Native compiler programs (including both apps), 15 Native tests, React compiler programs, 27 React tests, canonical docs generation with warnings treated as errors, three docs-transform tests, zero-warning scoped lint, formatting, whitespace checks, and normal commit hooks pass. GitHub rejected inline thread replies because of existing pending draft reviews, so this linked comment records the fixes without modifying those drafts. Both addressed threads are being resolved. No feedback was declined; fresh remote CI is separate. |
|
Addressed both new review threads in b93b204:
Validation: 332 runtime tests (275 Browser, 27 React, 15 Vue, 15 Native), all four SDK builds, their standard type-test programs (including both Native apps), docs regeneration, three docs-transform tests, scoped zero-warning lint, formatting, whitespace checks, and normal commit hooks passed. Supplemental compiler checks: Browser source/tests also passed with ES2020 (the untouched bigint fixture does not compile under the base config target), and React source/tests passed with a dedicated bundler-resolution config. An ad hoc check of the unspecialized React base config includes separately configured demos and encounters existing Next.js alias/type/config errors; those unrelated configurations were not changed. The full workspace suite and E2E suite were not rerun for this fix. No comments were declined. This linked comment records the fixes without modifying the existing pending review drafts; both addressed threads are being resolved. |
Stack and review boundary
main; evaluator feat: add protocol-v2 multivariate flag evaluation #744 is already merged and evaluator 2.0.0 is published.acd46cdreconciles this branch with mainf9b1ecf, preserving the framework changes without rebasing or force-pushing. Node implementation files match main; the v2 React bootstrap demo deliberately retains workspace Node v2. The redundant inherited Node typing Changeset is removed because main's major Changeset already includes that change.521cf4b; registered-default/declaration work:1729e9e; public-doc configuration:9f3a0ae. Native v2 follow-up:a12dc2c.Summary
/flags/evaluatedwith atomic validation and context/version guards. Metadata-only refresh preserves bootstrap values/provenance; mutations confirm versioned evaluation and membership in one refresh.useFlagare non-suspending direct-value reads;useFlagSuspenseexplicitly waits. Vue returns refs. Tracking, feedback, loading and opt-in remain separate hooks/composables.React Native migration
2.0.0-next.0, and a major Changeset. This PR'snextprerelease configuration plans 2.0.0-next.1, not stable 2.0.0. Its modern JSX build requires React 17+ and the React version supported by the application’s Native runtime.useFlagSuspense; remove legacy wrapper/remote-config types. Native shares React's optionalFlagsregistry, including React-format declarations, rather than maintaining a second evaluator or type registry.test:ci; Native runtime tests now participate in workspace CI.Registered-default contracts
Named-interface/readonly defaults work. Registered keys constrain non-null defaults, including required/nested properties, arrays and literal unions; Suspense follows the same contract. Explicit default generics cannot bypass registered schemas. Boolean/undefined and arbitrary-JSON null semantics remain. This is not nested runtime schema validation. Built Vue refs retain public
vueimports, and TypeDoc validation stays enabled.Correctness follow-up (
fdacaf0)useFlaganduseFlagSuspensestable by JSON content between relevant changes, with per-hook ownership and commit-only caching. Every render still performs the read for check tracking. React Native inherits the shared fix. Eight new React regressions cover effect-driven state updates, inline defaults, updates, client/key changes, checks and ownership.Approved cleanup (
bb9b948,158f36b)selected()fixture as(value: FlagValue, variantKey = "true"): RawFlag, removing four repeated assertions and five redundant value overrides without changing fixture data.maybeFetchFlags()return a non-optional snapshot and require it inapplyFetchedFlagsResult(). Remove only unreachable absence handling; raw-fetch failures remain optional and guarded, bootstrap/cache snapshot versions remain optional, and all freshness checks are preserved.clearOptInMetadata()for exactly the metadata map, context marker and snapshot version, replacing the three existing reset blocks in place. The stale-version guard, same-context retention and request/loading bookkeeping are unchanged. Inlining all three calls exactly reproduces the previous source.Fresh verification
158f36bsource verification: all 1,007 workspace runtime tests and 48 Browser E2E cases across Chromium/Firefox/WebKit pass. Builds pass for 10 SDK/provider/CLI/Express projects; both Next.js example typechecks, Native compiler contracts and app typechecks, focused strict typing of the changed runtime fixtures, docs and three docs-transform tests pass. Management regeneration and Next.js production-app builds are excluded from that bounded build run. Ten new regressions failed before the fixes; the unchanged original tests passed.e16293aversioned-tree verification ran the actual version command to generate 2.0.0-next.1, then passed all 993 then-existing workspace tests and 48 Browser E2E cases. That is distinct from the latest source-level run.158f36b. Thee16293alifecycle dry run also passed them before versioning, after next versioning, during explicit prerelease exit and after stable versioning. Two ignored/private-workspace regressions failed without the Changesets backport and passed with it; both real next and stable-transition immutable installations passed.e16293atarballs for Node, Browser, React, Vue and React Native 2.0.0-next.1 contain runtimes/declarations and rewritten workspace dependencies. A clean npm consumer installs those five local tarballs plus registry supporting dependencies, resolves one matching Browser/React dependency graph, and passes Node-to-Browser bootstrap, React SSR, Vue export checks and strict public-consumer typing across all five SDKs. Native runtime/device execution is not claimed. This does not replace the final matched CLI/packed-toolchain canary.yarn buildwas not run locally because Java is absent; generated Management sources remain inherited unchanged from Node/main.Next prerelease configuration
Commit
e16293aenters Changesets' repository-wide prerelease mode with tagnext. The existing automated version/publish workflow handles the SDK dependency graph; this does not depend on the separate Node-only manual workflow in #802.The verified first release plan is:
next.1follows the existingnext.0development manifests. Packed React/Vue dependencies point to^2.0.0-next.1Browser, and Native points to^2.0.0-next.1React. Node retains published evaluator 2.0.0; OpenFeature Browser remains pinned to published Browser v1. The existing SDKs all have stable npm releases, and these prereleases usenextrather than advancing their stablelatesttags.The workflow skips all four stable-doc publication steps for prereleases and fails closed on malformed/unexpected prerelease state. Stable-doc publication resumes only on the normal stable channel; this is not the separate release-aware docs-routing redesign. The docs checkout action is updated to supported v4.
A small locked Yarn backport of Changesets #2092 prevents prerelease exit from spuriously bumping ignored/private or unversioned workspaces. Without it,
@reflag/tsconfigincorrectly becomes 0.0.3 and the stable-transition install fails. The real next → explicit exit → stable versioning/installation dry run now passes while that private package stays 0.0.2.Not active on main until this PR is merged. The existing stable version PR #796 must be regenerated with this configuration before it is merged; do not merge its old stable Node 2.0.0 plan. No npm publication, main merge or dist-tag change was performed.
Remaining release boundaries
Compatible server values/opt-in metadata/check ingestion, server-first deployment, approved saved snapshots and deployed acceptance remain required. Genuine matched-rule integration, CLI 2 review/mandatory generated-consumer CI and final versioned/packed-toolchain canary are separate work. Coordinate evaluator memoization publication/adoption separately.
Native now participates in this v2 migration; reconcile public-doc version routing that still assumes independent Native v1 before cutover. Source Native documentation is updated here. OpenFeature multivariate adoption remains separate. No device/emulator smoke, package publication, deployment, main merge, persistent service restart or shared-data mutation was performed.