Skip to content

fix: return minimal JSON-safe bootstrap snapshots - #857

Open
roncohen wants to merge 1 commit into
mainfrom
fix/minimal-bootstrap-snapshot
Open

roncohen wants to merge 1 commit into
mainfrom
fix/minimal-bootstrap-snapshot

Conversation

@roncohen

@roncohen roncohen commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Why

Bootstrap snapshots copy evaluation details the client does not use. They can also contain undefined properties, which Next.js rejects when the snapshot is returned directly from getServerSideProps.

What changed

  • Return only the flag values and metadata needed to restore client state, record checks, and refresh flags. Omit the repeated flag key, matched rule ID, allocation indices, rule destinations, and undefined properties.
  • Keep variant and source version IDs for identifying the selected value, and keep rule match results, evaluation errors, and opt-in metadata when available. Rule IDs remain in rule results because released v2 clients require them to validate snapshots.
  • Leave the full evaluator and raw result APIs unchanged. The wire format remains compatible with existing v2 readers. TypeScript users who pass a snapshot directly from an updated Node SDK to an older client SDK may need to update the client SDK to accept an omitted flag value.

Verification

  • Built the Node, Browser, React, Vue, and React Native SDKs and ran their test suites.
  • Tested that the smaller snapshot retains selected variant and ordered rule-match metadata in browser checks, preserves null, and leaks no private flags or dependency origins.
  • Passed a snapshot from the built Node SDK directly through the Next.js Pages Router props validator and loaded the same snapshot with the Browser SDK.

@roncohen
roncohen marked this pull request as ready for review December 1, 2026 14:39

@reflag-review reflag-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: medium

no actionable findings

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant