Skip to content

Read the overrides also from the cookie flag-overrides - #655

Open
dferber90 wants to merge 1 commit into
v5-runtimefrom
flag-overrides-cookie
Open

dferber90 wants to merge 1 commit into
v5-runtimefrom
flag-overrides-cookie

Conversation

@dferber90

@dferber90 dferber90 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #654 (v5-runtime). Before this PR, the SDK read the overrides only from vercel-flag-overrides. Now it also reads flag-overrides, the cookie of the standard. These are the rules of north-star (SPEC "Overrides", and OVERRIDES_COOKIES in overrides/reader.ts):

  • The SDK reads flag-overrides first, then vercel-flag-overrides (the cookie of v4).
  • If both are set, flag-overrides wins. A cookie contains one token, so the overrides of the two cookies are never merged.
  • An empty cookie is skipped.

Changes

  • lib/overrides.ts: the new OVERRIDES_COOKIES and findOverridesToken(cookies).
  • runtime.ts: readOverrides of the request scope uses findOverridesToken.
  • The JSDoc of flag and of signOverrides names both cookies.
  • flag.test.ts: the cookie mock returned an error for every cookie except vercel-flag-overrides. Now it returns undefined for a missing cookie, as the cookies of Next.js do.

Tests

  • flags: 325 tests pass.
  • New unit tests for findOverridesToken.
  • New request-level tests: a flag reads flag-overrides, and when both cookies are set, only flag-overrides applies (no merge).

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
flags-playground Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
flags-sdk-dev Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
flags-sdk-flagsmith Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
flags-sdk-growthbook Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
flags-sdk-launchdarkly Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
flags-sdk-openfeature Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
flags-sdk-posthog Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
flags-sdk-reflag Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
flags-sdk-snippets Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
flags-sdk-statsig Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
flags-sdk-sveltekit-snippets Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
shirt-shop Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC
shirt-shop-api Ready Ready Preview, v0 Nov 27, 2026 11:05am UTC

flag-overrides is the cookie of the standard. The SDK still reads
vercel-flag-overrides, the cookie of v4. If both are set, flag-overrides
wins, and the overrides of the two cookies are not merged.

Co-Authored-By: Claude <noreply@anthropic.com>

This branch was successfully deployed

14 active deployments
Preview – flags-sdk-dev — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-sdk-posthog — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-sdk-flagsmith — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-sdk-vercel — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-sdk-reflag — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-sdk-launchdarkly — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-sdk-statsig — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-sdk-growthbook — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-sdk-snippets — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-sdk-openfeature — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-playground — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – flags-sdk-sveltekit-snippets — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – shirt-shop — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
Preview – shirt-shop-api — 6cd50c43 Deployed Nov 27, 2026 by vercel[bot]
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