chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies - #7916

Merged
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant
Feb 25, 2026
Merged

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies#7916
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant

Conversation

@brkalow

@brkalowbrkalow commented Feb 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove the separate clerk.chips.browser.js build variant from rspack config, dev scripts, and bundlewatch
  • Add partitioned_cookies field to the Environment API response (EnvironmentJSON / EnvironmentResource), following the client_debug_mode pattern
  • Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime usePartitionedCookies getter that reads from Environment.getInstance().partitionedCookies
  • Thread the flag through all three cookie handlers: session, client UAT, and dev browser

Test plan

  • All existing cookie tests pass (session, clientUat, devBrowser)
  • New test cases verify partitioned cookie behavior when usePartitionedCookies returns true
  • Verify with a FAPI response that includes partitioned_cookies: true in the environment payload
  • Confirm cookies are set with SameSite=None; Secure; Partitioned in a cross-origin iframe context

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Removed the legacy CHIPS build variant, its build/config entries, dev script, and bundlewatch entry.
    • Removed build-time cookie flag from tool configs.
  • New Features

    • Added a runtime partitioned-cookies flag persisted in environment snapshots and configs.
    • Dev tooling exposes a refreshCookies action to reapply cookie state in development.
  • Tests

    • Updated and added tests to validate partitioned-cookie behavior driven by the new runtime flag.

brkalowand others added 4 commits February 24, 2026 10:35
The separate `clerk.chips.browser.js` bundle is no longer needed. This
removes the variant from the rspack build config, dev scripts, and
bundlewatch. The `__BUILD_VARIANT_CHIPS__` flag is temporarily hardcoded
to `false` and will be replaced with an environment flag in the next
commit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `partitioned_cookies` to `EnvironmentJSON` and
`EnvironmentResource`, following the same pattern as
`client_debug_mode`. The flag is read from the Clerk environment API
response and defaults to `false`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime
flag from the Clerk environment API response. Cookie handlers now
receive a usePartitionedCookies getter that reads
Environment.partitionedCookies, following the same pattern as
clientDebugMode.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Thread the usePartitionedCookies getter through createDevBrowser to
createDevBrowserCookie so that the dev browser cookie also sets
SameSite=None, Secure, and Partitioned when the environment flag is
enabled.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercelBot commented Feb 24, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentFeb 25, 2026 4:06am

Request Review

@changeset-bot

changeset-botBot commented Feb 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4d1a4a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
NameType
@clerk/clerk-jsPatch
@clerk/sharedPatch
@clerk/chrome-extensionPatch
@clerk/expoPatch
@clerk/agent-toolkitPatch
@clerk/astroPatch
@clerk/backendPatch
@clerk/expo-passkeysPatch
@clerk/expressPatch
@clerk/fastifyPatch
@clerk/localizationsPatch
@clerk/mswPatch
@clerk/nextjsPatch
@clerk/nuxtPatch
@clerk/react-routerPatch
@clerk/reactPatch
@clerk/tanstack-react-startPatch
@clerk/testingPatch
@clerk/uiPatch
@clerk/vuePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-newBot commented Feb 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7916

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7916

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7916

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7916

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7916

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7916

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7916

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7916

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7916

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7916

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7916

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7916

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7916

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7916

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7916

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7916

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7916

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7916

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7916

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7916

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7916

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7916

commit: 4d1a4a9

@coderabbitai

coderabbitaiBot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes remove the CHIPS build variant and its compile-time flag from bundlewatch, build, and test configs, and delete the related dev script. Runtime control for partitioned cookies is introduced: Environment gains a partitionedCookies flag (serialized as partitioned_cookies), new cookie option types and callbacks (usePartitionedCookies) are added, and dev/session cookie creation and devBrowser APIs are updated to accept and act on these runtime cookie options. Tests and coverage configs were updated accordingly.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and specifically summarizes the main changes: removing the CHIPS build variant and replacing it with a runtime environment flag for partitioned cookies.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@brkalowbrkalow changed the title Remove CHIPS build variant, use environment flag for partitioned cookieschore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookiesFeb 24, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/remove-chips-build-variant.md:
- Around line 2-3: The changes add new exported API surface (partitionedCookies
on EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies
plus cookieOptions parameters threading through cookie handlers on Environment
in `@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 73247c1 and 2e4d38c.

📒 Files selected for processing (1)
  • .changeset/remove-chips-build-variant.md

Comment on lines +2 to +3
"@clerk/clerk-js": patch
"@clerk/shared": patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider whether minor bump is warranted for new public API surface.

Both packages are bumped as patch, but the changes introduce new public API surface:

  • @clerk/shared adds partitionedCookies to the exported EnvironmentJSON / EnvironmentResource types.
  • @clerk/clerk-js adds a partitionedCookies property to Environment and new cookieOptions parameters threading through cookie handlers.

Under standard SemVer, additive changes to a public API should be a minor bump. If your project's SemVer policy treats all non-breaking additions as patch (e.g., because these are considered internal/implementation details), this is fine to keep as-is — but it's worth a conscious call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/remove-chips-build-variant.md around lines 2 - 3, The changes add
new exported API surface (partitionedCookies on
EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies plus
cookieOptions parameters threading through cookie handlers on Environment in
`@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…titioned attributes
Dev browser cookies are written at Step 0 before Environment is fetched,
so they initially use stale (non-partitioned) attributes. After Environment
resolves, refreshCookies() re-writes them with the correct attributes.
Also fixes non-partitioned cookie cleanup: when transitioning to partitioned,
the old non-partitioned cookies are now properly removed (plain remove without
partitioned attribute targets the non-partitioned version, since the browser
treats them as different cookies).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/clerk-js/src/core/auth/cookies/session.ts`:
- Around line 38-42: The remove() function only deletes cookies using the
current partitioned attributes, leaving non-partitioned __session cookies
behind; update remove() in session.ts to also explicitly remove the
non-partitioned variants by calling sessionCookie.remove(...) and
suffixedSessionCookie.remove(...) with both getCookieAttributes(options) and
getCookieAttributes({ ...options, partitioned: false }) (or otherwise obtain
both partitioned and non-partitioned attribute sets) so both cookie flavors are
deleted, and apply the same dual-attribute removal change to the analogous
remove logic in devBrowser.ts.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f4dd805 and ba2a15b.

📒 Files selected for processing (4)
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts
  • packages/clerk-js/src/core/auth/devBrowser.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/clerk-js/src/core/auth/devBrowser.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts

Comment on lines 38 to 42
const remove = () => {
const attributes = getCookieAttributes();
const attributes = getCookieAttributes(options);
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

remove() doesn't clean up non-partitioned cookie variants when transitioning to partitioned mode.

set() (lines 52-55) correctly removes the old non-partitioned cookies before writing partitioned ones, but remove() only deletes cookies matching the current (partitioned) attributes. Because the browser treats partitioned and non-partitioned cookies with the same name as distinct, a sign-out that hits remove() without a prior set() in the same page lifecycle will leave stale non-partitioned __session cookies behind. The same gap exists in devBrowser.ts.

Proposed fix
 const remove = () => {
const attributes = getCookieAttributes(options);
+ // When partitioned, also remove leftover non-partitioned variants+ // (browser treats them as separate cookies).+ if (attributes.partitioned) {+ sessionCookie.remove();+ suffixedSessionCookie.remove();+ }
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/session.ts` around lines 38 - 42, The
remove() function only deletes cookies using the current partitioned attributes,
leaving non-partitioned __session cookies behind; update remove() in session.ts
to also explicitly remove the non-partitioned variants by calling
sessionCookie.remove(...) and suffixedSessionCookie.remove(...) with both
getCookieAttributes(options) and getCookieAttributes({ ...options, partitioned:
false }) (or otherwise obtain both partitioned and non-partitioned attribute
sets) so both cookie flavors are deleted, and apply the same dual-attribute
removal change to the analogous remove logic in devBrowser.ts.

brkalowand others added 2 commits February 24, 2026 21:42
Collapse nested ternaries into single conditions since both branches
resolve to 'None', and condense non-partitioned cleanup comments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The remove() function only deleted cookies using the current partitioned
attributes, leaving the other variant behind. Now also removes
non-partitioned cookies when partitioned is enabled, matching the
existing pattern in set().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/clerk-js/src/core/auth/cookies/clientUat.ts (1)

62-67: ⚠️ Potential issue | 🟠 Major

Partitioned mode does not clear domain-scoped non-partitioned __client_uat cookies

set() only removes host-only variants before writing, but writes with domain. If partitioned mode is turned on, stale domain-scoped non-partitioned cookies can remain and conflict with auth-state reads.

Proposed fix
 // Removes any existing cookies without a domain specified to ensure the change doesn't break existing sessions.
suffixedClientUatCookie.remove();
clientUatCookie.remove();
++ // When partitioned is enabled, also remove previously written domain-scoped+ // non-partitioned variants (partitioned/non-partitioned are distinct cookies).+ if (partitioned && domain) {+ suffixedClientUatCookie.remove({ domain, sameSite, secure });+ clientUatCookie.remove({ domain, sameSite, secure });+ }
suffixedClientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
clientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts` around lines 62 - 67,
When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts`:
- Around line 62-67: When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba2a15b and 4d1a4a9.

📒 Files selected for processing (3)
  • packages/clerk-js/src/core/auth/cookies/clientUat.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts

@jacekradkojacekradko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet!

@brkalow
brkalow merged commit dc886a9 into mainFeb 25, 2026
41 checks passed
@brkalow
brkalow deleted the bryce/remove-chips-build-variant branch February 25, 2026 21:47
brkalow added a commit that referenced this pull request Feb 26, 2026
… partitioned cookies (#7916)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@brkalow@jacekradko
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies - #7916

Merged
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant
Feb 25, 2026
Merged

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies#7916
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant

Conversation

@brkalow

@brkalowbrkalow commented Feb 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove the separate clerk.chips.browser.js build variant from rspack config, dev scripts, and bundlewatch
  • Add partitioned_cookies field to the Environment API response (EnvironmentJSON / EnvironmentResource), following the client_debug_mode pattern
  • Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime usePartitionedCookies getter that reads from Environment.getInstance().partitionedCookies
  • Thread the flag through all three cookie handlers: session, client UAT, and dev browser

Test plan

  • All existing cookie tests pass (session, clientUat, devBrowser)
  • New test cases verify partitioned cookie behavior when usePartitionedCookies returns true
  • Verify with a FAPI response that includes partitioned_cookies: true in the environment payload
  • Confirm cookies are set with SameSite=None; Secure; Partitioned in a cross-origin iframe context

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Removed the legacy CHIPS build variant, its build/config entries, dev script, and bundlewatch entry.
    • Removed build-time cookie flag from tool configs.
  • New Features

    • Added a runtime partitioned-cookies flag persisted in environment snapshots and configs.
    • Dev tooling exposes a refreshCookies action to reapply cookie state in development.
  • Tests

    • Updated and added tests to validate partitioned-cookie behavior driven by the new runtime flag.

brkalowand others added 4 commits February 24, 2026 10:35
The separate `clerk.chips.browser.js` bundle is no longer needed. This
removes the variant from the rspack build config, dev scripts, and
bundlewatch. The `__BUILD_VARIANT_CHIPS__` flag is temporarily hardcoded
to `false` and will be replaced with an environment flag in the next
commit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `partitioned_cookies` to `EnvironmentJSON` and
`EnvironmentResource`, following the same pattern as
`client_debug_mode`. The flag is read from the Clerk environment API
response and defaults to `false`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime
flag from the Clerk environment API response. Cookie handlers now
receive a usePartitionedCookies getter that reads
Environment.partitionedCookies, following the same pattern as
clientDebugMode.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Thread the usePartitionedCookies getter through createDevBrowser to
createDevBrowserCookie so that the dev browser cookie also sets
SameSite=None, Secure, and Partitioned when the environment flag is
enabled.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercelBot commented Feb 24, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentFeb 25, 2026 4:06am

Request Review

@changeset-bot

changeset-botBot commented Feb 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4d1a4a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
NameType
@clerk/clerk-jsPatch
@clerk/sharedPatch
@clerk/chrome-extensionPatch
@clerk/expoPatch
@clerk/agent-toolkitPatch
@clerk/astroPatch
@clerk/backendPatch
@clerk/expo-passkeysPatch
@clerk/expressPatch
@clerk/fastifyPatch
@clerk/localizationsPatch
@clerk/mswPatch
@clerk/nextjsPatch
@clerk/nuxtPatch
@clerk/react-routerPatch
@clerk/reactPatch
@clerk/tanstack-react-startPatch
@clerk/testingPatch
@clerk/uiPatch
@clerk/vuePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-newBot commented Feb 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7916

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7916

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7916

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7916

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7916

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7916

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7916

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7916

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7916

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7916

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7916

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7916

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7916

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7916

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7916

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7916

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7916

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7916

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7916

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7916

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7916

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7916

commit: 4d1a4a9

@coderabbitai

coderabbitaiBot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes remove the CHIPS build variant and its compile-time flag from bundlewatch, build, and test configs, and delete the related dev script. Runtime control for partitioned cookies is introduced: Environment gains a partitionedCookies flag (serialized as partitioned_cookies), new cookie option types and callbacks (usePartitionedCookies) are added, and dev/session cookie creation and devBrowser APIs are updated to accept and act on these runtime cookie options. Tests and coverage configs were updated accordingly.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and specifically summarizes the main changes: removing the CHIPS build variant and replacing it with a runtime environment flag for partitioned cookies.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@brkalowbrkalow changed the title Remove CHIPS build variant, use environment flag for partitioned cookieschore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookiesFeb 24, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/remove-chips-build-variant.md:
- Around line 2-3: The changes add new exported API surface (partitionedCookies
on EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies
plus cookieOptions parameters threading through cookie handlers on Environment
in `@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 73247c1 and 2e4d38c.

📒 Files selected for processing (1)
  • .changeset/remove-chips-build-variant.md

Comment on lines +2 to +3
"@clerk/clerk-js": patch
"@clerk/shared": patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider whether minor bump is warranted for new public API surface.

Both packages are bumped as patch, but the changes introduce new public API surface:

  • @clerk/shared adds partitionedCookies to the exported EnvironmentJSON / EnvironmentResource types.
  • @clerk/clerk-js adds a partitionedCookies property to Environment and new cookieOptions parameters threading through cookie handlers.

Under standard SemVer, additive changes to a public API should be a minor bump. If your project's SemVer policy treats all non-breaking additions as patch (e.g., because these are considered internal/implementation details), this is fine to keep as-is — but it's worth a conscious call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/remove-chips-build-variant.md around lines 2 - 3, The changes add
new exported API surface (partitionedCookies on
EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies plus
cookieOptions parameters threading through cookie handlers on Environment in
`@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…titioned attributes
Dev browser cookies are written at Step 0 before Environment is fetched,
so they initially use stale (non-partitioned) attributes. After Environment
resolves, refreshCookies() re-writes them with the correct attributes.
Also fixes non-partitioned cookie cleanup: when transitioning to partitioned,
the old non-partitioned cookies are now properly removed (plain remove without
partitioned attribute targets the non-partitioned version, since the browser
treats them as different cookies).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/clerk-js/src/core/auth/cookies/session.ts`:
- Around line 38-42: The remove() function only deletes cookies using the
current partitioned attributes, leaving non-partitioned __session cookies
behind; update remove() in session.ts to also explicitly remove the
non-partitioned variants by calling sessionCookie.remove(...) and
suffixedSessionCookie.remove(...) with both getCookieAttributes(options) and
getCookieAttributes({ ...options, partitioned: false }) (or otherwise obtain
both partitioned and non-partitioned attribute sets) so both cookie flavors are
deleted, and apply the same dual-attribute removal change to the analogous
remove logic in devBrowser.ts.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f4dd805 and ba2a15b.

📒 Files selected for processing (4)
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts
  • packages/clerk-js/src/core/auth/devBrowser.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/clerk-js/src/core/auth/devBrowser.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts

Comment on lines 38 to 42
const remove = () => {
const attributes = getCookieAttributes();
const attributes = getCookieAttributes(options);
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

remove() doesn't clean up non-partitioned cookie variants when transitioning to partitioned mode.

set() (lines 52-55) correctly removes the old non-partitioned cookies before writing partitioned ones, but remove() only deletes cookies matching the current (partitioned) attributes. Because the browser treats partitioned and non-partitioned cookies with the same name as distinct, a sign-out that hits remove() without a prior set() in the same page lifecycle will leave stale non-partitioned __session cookies behind. The same gap exists in devBrowser.ts.

Proposed fix
 const remove = () => {
const attributes = getCookieAttributes(options);
+ // When partitioned, also remove leftover non-partitioned variants+ // (browser treats them as separate cookies).+ if (attributes.partitioned) {+ sessionCookie.remove();+ suffixedSessionCookie.remove();+ }
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/session.ts` around lines 38 - 42, The
remove() function only deletes cookies using the current partitioned attributes,
leaving non-partitioned __session cookies behind; update remove() in session.ts
to also explicitly remove the non-partitioned variants by calling
sessionCookie.remove(...) and suffixedSessionCookie.remove(...) with both
getCookieAttributes(options) and getCookieAttributes({ ...options, partitioned:
false }) (or otherwise obtain both partitioned and non-partitioned attribute
sets) so both cookie flavors are deleted, and apply the same dual-attribute
removal change to the analogous remove logic in devBrowser.ts.

brkalowand others added 2 commits February 24, 2026 21:42
Collapse nested ternaries into single conditions since both branches
resolve to 'None', and condense non-partitioned cleanup comments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The remove() function only deleted cookies using the current partitioned
attributes, leaving the other variant behind. Now also removes
non-partitioned cookies when partitioned is enabled, matching the
existing pattern in set().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/clerk-js/src/core/auth/cookies/clientUat.ts (1)

62-67: ⚠️ Potential issue | 🟠 Major

Partitioned mode does not clear domain-scoped non-partitioned __client_uat cookies

set() only removes host-only variants before writing, but writes with domain. If partitioned mode is turned on, stale domain-scoped non-partitioned cookies can remain and conflict with auth-state reads.

Proposed fix
 // Removes any existing cookies without a domain specified to ensure the change doesn't break existing sessions.
suffixedClientUatCookie.remove();
clientUatCookie.remove();
++ // When partitioned is enabled, also remove previously written domain-scoped+ // non-partitioned variants (partitioned/non-partitioned are distinct cookies).+ if (partitioned && domain) {+ suffixedClientUatCookie.remove({ domain, sameSite, secure });+ clientUatCookie.remove({ domain, sameSite, secure });+ }
suffixedClientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
clientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts` around lines 62 - 67,
When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts`:
- Around line 62-67: When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba2a15b and 4d1a4a9.

📒 Files selected for processing (3)
  • packages/clerk-js/src/core/auth/cookies/clientUat.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts

@jacekradkojacekradko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet!

@brkalow
brkalow merged commit dc886a9 into mainFeb 25, 2026
41 checks passed
@brkalow
brkalow deleted the bryce/remove-chips-build-variant branch February 25, 2026 21:47
brkalow added a commit that referenced this pull request Feb 26, 2026
… partitioned cookies (#7916)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@brkalow@jacekradko
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies - #7916

Merged
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant
Feb 25, 2026
Merged

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies#7916
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant

Conversation

@brkalow

@brkalowbrkalow commented Feb 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove the separate clerk.chips.browser.js build variant from rspack config, dev scripts, and bundlewatch
  • Add partitioned_cookies field to the Environment API response (EnvironmentJSON / EnvironmentResource), following the client_debug_mode pattern
  • Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime usePartitionedCookies getter that reads from Environment.getInstance().partitionedCookies
  • Thread the flag through all three cookie handlers: session, client UAT, and dev browser

Test plan

  • All existing cookie tests pass (session, clientUat, devBrowser)
  • New test cases verify partitioned cookie behavior when usePartitionedCookies returns true
  • Verify with a FAPI response that includes partitioned_cookies: true in the environment payload
  • Confirm cookies are set with SameSite=None; Secure; Partitioned in a cross-origin iframe context

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Removed the legacy CHIPS build variant, its build/config entries, dev script, and bundlewatch entry.
    • Removed build-time cookie flag from tool configs.
  • New Features

    • Added a runtime partitioned-cookies flag persisted in environment snapshots and configs.
    • Dev tooling exposes a refreshCookies action to reapply cookie state in development.
  • Tests

    • Updated and added tests to validate partitioned-cookie behavior driven by the new runtime flag.

brkalowand others added 4 commits February 24, 2026 10:35
The separate `clerk.chips.browser.js` bundle is no longer needed. This
removes the variant from the rspack build config, dev scripts, and
bundlewatch. The `__BUILD_VARIANT_CHIPS__` flag is temporarily hardcoded
to `false` and will be replaced with an environment flag in the next
commit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `partitioned_cookies` to `EnvironmentJSON` and
`EnvironmentResource`, following the same pattern as
`client_debug_mode`. The flag is read from the Clerk environment API
response and defaults to `false`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime
flag from the Clerk environment API response. Cookie handlers now
receive a usePartitionedCookies getter that reads
Environment.partitionedCookies, following the same pattern as
clientDebugMode.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Thread the usePartitionedCookies getter through createDevBrowser to
createDevBrowserCookie so that the dev browser cookie also sets
SameSite=None, Secure, and Partitioned when the environment flag is
enabled.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercelBot commented Feb 24, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentFeb 25, 2026 4:06am

Request Review

@changeset-bot

changeset-botBot commented Feb 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4d1a4a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
NameType
@clerk/clerk-jsPatch
@clerk/sharedPatch
@clerk/chrome-extensionPatch
@clerk/expoPatch
@clerk/agent-toolkitPatch
@clerk/astroPatch
@clerk/backendPatch
@clerk/expo-passkeysPatch
@clerk/expressPatch
@clerk/fastifyPatch
@clerk/localizationsPatch
@clerk/mswPatch
@clerk/nextjsPatch
@clerk/nuxtPatch
@clerk/react-routerPatch
@clerk/reactPatch
@clerk/tanstack-react-startPatch
@clerk/testingPatch
@clerk/uiPatch
@clerk/vuePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-newBot commented Feb 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7916

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7916

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7916

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7916

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7916

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7916

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7916

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7916

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7916

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7916

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7916

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7916

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7916

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7916

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7916

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7916

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7916

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7916

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7916

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7916

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7916

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7916

commit: 4d1a4a9

@coderabbitai

coderabbitaiBot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes remove the CHIPS build variant and its compile-time flag from bundlewatch, build, and test configs, and delete the related dev script. Runtime control for partitioned cookies is introduced: Environment gains a partitionedCookies flag (serialized as partitioned_cookies), new cookie option types and callbacks (usePartitionedCookies) are added, and dev/session cookie creation and devBrowser APIs are updated to accept and act on these runtime cookie options. Tests and coverage configs were updated accordingly.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and specifically summarizes the main changes: removing the CHIPS build variant and replacing it with a runtime environment flag for partitioned cookies.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@brkalowbrkalow changed the title Remove CHIPS build variant, use environment flag for partitioned cookieschore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookiesFeb 24, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/remove-chips-build-variant.md:
- Around line 2-3: The changes add new exported API surface (partitionedCookies
on EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies
plus cookieOptions parameters threading through cookie handlers on Environment
in `@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 73247c1 and 2e4d38c.

📒 Files selected for processing (1)
  • .changeset/remove-chips-build-variant.md

Comment on lines +2 to +3
"@clerk/clerk-js": patch
"@clerk/shared": patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider whether minor bump is warranted for new public API surface.

Both packages are bumped as patch, but the changes introduce new public API surface:

  • @clerk/shared adds partitionedCookies to the exported EnvironmentJSON / EnvironmentResource types.
  • @clerk/clerk-js adds a partitionedCookies property to Environment and new cookieOptions parameters threading through cookie handlers.

Under standard SemVer, additive changes to a public API should be a minor bump. If your project's SemVer policy treats all non-breaking additions as patch (e.g., because these are considered internal/implementation details), this is fine to keep as-is — but it's worth a conscious call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/remove-chips-build-variant.md around lines 2 - 3, The changes add
new exported API surface (partitionedCookies on
EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies plus
cookieOptions parameters threading through cookie handlers on Environment in
`@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…titioned attributes
Dev browser cookies are written at Step 0 before Environment is fetched,
so they initially use stale (non-partitioned) attributes. After Environment
resolves, refreshCookies() re-writes them with the correct attributes.
Also fixes non-partitioned cookie cleanup: when transitioning to partitioned,
the old non-partitioned cookies are now properly removed (plain remove without
partitioned attribute targets the non-partitioned version, since the browser
treats them as different cookies).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/clerk-js/src/core/auth/cookies/session.ts`:
- Around line 38-42: The remove() function only deletes cookies using the
current partitioned attributes, leaving non-partitioned __session cookies
behind; update remove() in session.ts to also explicitly remove the
non-partitioned variants by calling sessionCookie.remove(...) and
suffixedSessionCookie.remove(...) with both getCookieAttributes(options) and
getCookieAttributes({ ...options, partitioned: false }) (or otherwise obtain
both partitioned and non-partitioned attribute sets) so both cookie flavors are
deleted, and apply the same dual-attribute removal change to the analogous
remove logic in devBrowser.ts.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f4dd805 and ba2a15b.

📒 Files selected for processing (4)
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts
  • packages/clerk-js/src/core/auth/devBrowser.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/clerk-js/src/core/auth/devBrowser.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts

Comment on lines 38 to 42
const remove = () => {
const attributes = getCookieAttributes();
const attributes = getCookieAttributes(options);
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

remove() doesn't clean up non-partitioned cookie variants when transitioning to partitioned mode.

set() (lines 52-55) correctly removes the old non-partitioned cookies before writing partitioned ones, but remove() only deletes cookies matching the current (partitioned) attributes. Because the browser treats partitioned and non-partitioned cookies with the same name as distinct, a sign-out that hits remove() without a prior set() in the same page lifecycle will leave stale non-partitioned __session cookies behind. The same gap exists in devBrowser.ts.

Proposed fix
 const remove = () => {
const attributes = getCookieAttributes(options);
+ // When partitioned, also remove leftover non-partitioned variants+ // (browser treats them as separate cookies).+ if (attributes.partitioned) {+ sessionCookie.remove();+ suffixedSessionCookie.remove();+ }
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/session.ts` around lines 38 - 42, The
remove() function only deletes cookies using the current partitioned attributes,
leaving non-partitioned __session cookies behind; update remove() in session.ts
to also explicitly remove the non-partitioned variants by calling
sessionCookie.remove(...) and suffixedSessionCookie.remove(...) with both
getCookieAttributes(options) and getCookieAttributes({ ...options, partitioned:
false }) (or otherwise obtain both partitioned and non-partitioned attribute
sets) so both cookie flavors are deleted, and apply the same dual-attribute
removal change to the analogous remove logic in devBrowser.ts.

brkalowand others added 2 commits February 24, 2026 21:42
Collapse nested ternaries into single conditions since both branches
resolve to 'None', and condense non-partitioned cleanup comments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The remove() function only deleted cookies using the current partitioned
attributes, leaving the other variant behind. Now also removes
non-partitioned cookies when partitioned is enabled, matching the
existing pattern in set().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/clerk-js/src/core/auth/cookies/clientUat.ts (1)

62-67: ⚠️ Potential issue | 🟠 Major

Partitioned mode does not clear domain-scoped non-partitioned __client_uat cookies

set() only removes host-only variants before writing, but writes with domain. If partitioned mode is turned on, stale domain-scoped non-partitioned cookies can remain and conflict with auth-state reads.

Proposed fix
 // Removes any existing cookies without a domain specified to ensure the change doesn't break existing sessions.
suffixedClientUatCookie.remove();
clientUatCookie.remove();
++ // When partitioned is enabled, also remove previously written domain-scoped+ // non-partitioned variants (partitioned/non-partitioned are distinct cookies).+ if (partitioned && domain) {+ suffixedClientUatCookie.remove({ domain, sameSite, secure });+ clientUatCookie.remove({ domain, sameSite, secure });+ }
suffixedClientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
clientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts` around lines 62 - 67,
When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts`:
- Around line 62-67: When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba2a15b and 4d1a4a9.

📒 Files selected for processing (3)
  • packages/clerk-js/src/core/auth/cookies/clientUat.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts

@jacekradkojacekradko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet!

@brkalow
brkalow merged commit dc886a9 into mainFeb 25, 2026
41 checks passed
@brkalow
brkalow deleted the bryce/remove-chips-build-variant branch February 25, 2026 21:47
brkalow added a commit that referenced this pull request Feb 26, 2026
… partitioned cookies (#7916)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@brkalow@jacekradko
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies - #7916

Merged
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant
Feb 25, 2026
Merged

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies#7916
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant

Conversation

@brkalow

@brkalowbrkalow commented Feb 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove the separate clerk.chips.browser.js build variant from rspack config, dev scripts, and bundlewatch
  • Add partitioned_cookies field to the Environment API response (EnvironmentJSON / EnvironmentResource), following the client_debug_mode pattern
  • Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime usePartitionedCookies getter that reads from Environment.getInstance().partitionedCookies
  • Thread the flag through all three cookie handlers: session, client UAT, and dev browser

Test plan

  • All existing cookie tests pass (session, clientUat, devBrowser)
  • New test cases verify partitioned cookie behavior when usePartitionedCookies returns true
  • Verify with a FAPI response that includes partitioned_cookies: true in the environment payload
  • Confirm cookies are set with SameSite=None; Secure; Partitioned in a cross-origin iframe context

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Removed the legacy CHIPS build variant, its build/config entries, dev script, and bundlewatch entry.
    • Removed build-time cookie flag from tool configs.
  • New Features

    • Added a runtime partitioned-cookies flag persisted in environment snapshots and configs.
    • Dev tooling exposes a refreshCookies action to reapply cookie state in development.
  • Tests

    • Updated and added tests to validate partitioned-cookie behavior driven by the new runtime flag.

brkalowand others added 4 commits February 24, 2026 10:35
The separate `clerk.chips.browser.js` bundle is no longer needed. This
removes the variant from the rspack build config, dev scripts, and
bundlewatch. The `__BUILD_VARIANT_CHIPS__` flag is temporarily hardcoded
to `false` and will be replaced with an environment flag in the next
commit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `partitioned_cookies` to `EnvironmentJSON` and
`EnvironmentResource`, following the same pattern as
`client_debug_mode`. The flag is read from the Clerk environment API
response and defaults to `false`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime
flag from the Clerk environment API response. Cookie handlers now
receive a usePartitionedCookies getter that reads
Environment.partitionedCookies, following the same pattern as
clientDebugMode.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Thread the usePartitionedCookies getter through createDevBrowser to
createDevBrowserCookie so that the dev browser cookie also sets
SameSite=None, Secure, and Partitioned when the environment flag is
enabled.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercelBot commented Feb 24, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentFeb 25, 2026 4:06am

Request Review

@changeset-bot

changeset-botBot commented Feb 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4d1a4a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
NameType
@clerk/clerk-jsPatch
@clerk/sharedPatch
@clerk/chrome-extensionPatch
@clerk/expoPatch
@clerk/agent-toolkitPatch
@clerk/astroPatch
@clerk/backendPatch
@clerk/expo-passkeysPatch
@clerk/expressPatch
@clerk/fastifyPatch
@clerk/localizationsPatch
@clerk/mswPatch
@clerk/nextjsPatch
@clerk/nuxtPatch
@clerk/react-routerPatch
@clerk/reactPatch
@clerk/tanstack-react-startPatch
@clerk/testingPatch
@clerk/uiPatch
@clerk/vuePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-newBot commented Feb 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7916

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7916

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7916

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7916

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7916

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7916

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7916

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7916

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7916

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7916

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7916

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7916

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7916

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7916

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7916

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7916

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7916

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7916

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7916

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7916

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7916

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7916

commit: 4d1a4a9

@coderabbitai

coderabbitaiBot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes remove the CHIPS build variant and its compile-time flag from bundlewatch, build, and test configs, and delete the related dev script. Runtime control for partitioned cookies is introduced: Environment gains a partitionedCookies flag (serialized as partitioned_cookies), new cookie option types and callbacks (usePartitionedCookies) are added, and dev/session cookie creation and devBrowser APIs are updated to accept and act on these runtime cookie options. Tests and coverage configs were updated accordingly.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and specifically summarizes the main changes: removing the CHIPS build variant and replacing it with a runtime environment flag for partitioned cookies.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@brkalowbrkalow changed the title Remove CHIPS build variant, use environment flag for partitioned cookieschore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookiesFeb 24, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/remove-chips-build-variant.md:
- Around line 2-3: The changes add new exported API surface (partitionedCookies
on EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies
plus cookieOptions parameters threading through cookie handlers on Environment
in `@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 73247c1 and 2e4d38c.

📒 Files selected for processing (1)
  • .changeset/remove-chips-build-variant.md

Comment on lines +2 to +3
"@clerk/clerk-js": patch
"@clerk/shared": patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider whether minor bump is warranted for new public API surface.

Both packages are bumped as patch, but the changes introduce new public API surface:

  • @clerk/shared adds partitionedCookies to the exported EnvironmentJSON / EnvironmentResource types.
  • @clerk/clerk-js adds a partitionedCookies property to Environment and new cookieOptions parameters threading through cookie handlers.

Under standard SemVer, additive changes to a public API should be a minor bump. If your project's SemVer policy treats all non-breaking additions as patch (e.g., because these are considered internal/implementation details), this is fine to keep as-is — but it's worth a conscious call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/remove-chips-build-variant.md around lines 2 - 3, The changes add
new exported API surface (partitionedCookies on
EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies plus
cookieOptions parameters threading through cookie handlers on Environment in
`@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…titioned attributes
Dev browser cookies are written at Step 0 before Environment is fetched,
so they initially use stale (non-partitioned) attributes. After Environment
resolves, refreshCookies() re-writes them with the correct attributes.
Also fixes non-partitioned cookie cleanup: when transitioning to partitioned,
the old non-partitioned cookies are now properly removed (plain remove without
partitioned attribute targets the non-partitioned version, since the browser
treats them as different cookies).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/clerk-js/src/core/auth/cookies/session.ts`:
- Around line 38-42: The remove() function only deletes cookies using the
current partitioned attributes, leaving non-partitioned __session cookies
behind; update remove() in session.ts to also explicitly remove the
non-partitioned variants by calling sessionCookie.remove(...) and
suffixedSessionCookie.remove(...) with both getCookieAttributes(options) and
getCookieAttributes({ ...options, partitioned: false }) (or otherwise obtain
both partitioned and non-partitioned attribute sets) so both cookie flavors are
deleted, and apply the same dual-attribute removal change to the analogous
remove logic in devBrowser.ts.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f4dd805 and ba2a15b.

📒 Files selected for processing (4)
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts
  • packages/clerk-js/src/core/auth/devBrowser.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/clerk-js/src/core/auth/devBrowser.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts

Comment on lines 38 to 42
const remove = () => {
const attributes = getCookieAttributes();
const attributes = getCookieAttributes(options);
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

remove() doesn't clean up non-partitioned cookie variants when transitioning to partitioned mode.

set() (lines 52-55) correctly removes the old non-partitioned cookies before writing partitioned ones, but remove() only deletes cookies matching the current (partitioned) attributes. Because the browser treats partitioned and non-partitioned cookies with the same name as distinct, a sign-out that hits remove() without a prior set() in the same page lifecycle will leave stale non-partitioned __session cookies behind. The same gap exists in devBrowser.ts.

Proposed fix
 const remove = () => {
const attributes = getCookieAttributes(options);
+ // When partitioned, also remove leftover non-partitioned variants+ // (browser treats them as separate cookies).+ if (attributes.partitioned) {+ sessionCookie.remove();+ suffixedSessionCookie.remove();+ }
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/session.ts` around lines 38 - 42, The
remove() function only deletes cookies using the current partitioned attributes,
leaving non-partitioned __session cookies behind; update remove() in session.ts
to also explicitly remove the non-partitioned variants by calling
sessionCookie.remove(...) and suffixedSessionCookie.remove(...) with both
getCookieAttributes(options) and getCookieAttributes({ ...options, partitioned:
false }) (or otherwise obtain both partitioned and non-partitioned attribute
sets) so both cookie flavors are deleted, and apply the same dual-attribute
removal change to the analogous remove logic in devBrowser.ts.

brkalowand others added 2 commits February 24, 2026 21:42
Collapse nested ternaries into single conditions since both branches
resolve to 'None', and condense non-partitioned cleanup comments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The remove() function only deleted cookies using the current partitioned
attributes, leaving the other variant behind. Now also removes
non-partitioned cookies when partitioned is enabled, matching the
existing pattern in set().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/clerk-js/src/core/auth/cookies/clientUat.ts (1)

62-67: ⚠️ Potential issue | 🟠 Major

Partitioned mode does not clear domain-scoped non-partitioned __client_uat cookies

set() only removes host-only variants before writing, but writes with domain. If partitioned mode is turned on, stale domain-scoped non-partitioned cookies can remain and conflict with auth-state reads.

Proposed fix
 // Removes any existing cookies without a domain specified to ensure the change doesn't break existing sessions.
suffixedClientUatCookie.remove();
clientUatCookie.remove();
++ // When partitioned is enabled, also remove previously written domain-scoped+ // non-partitioned variants (partitioned/non-partitioned are distinct cookies).+ if (partitioned && domain) {+ suffixedClientUatCookie.remove({ domain, sameSite, secure });+ clientUatCookie.remove({ domain, sameSite, secure });+ }
suffixedClientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
clientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts` around lines 62 - 67,
When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts`:
- Around line 62-67: When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba2a15b and 4d1a4a9.

📒 Files selected for processing (3)
  • packages/clerk-js/src/core/auth/cookies/clientUat.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts

@jacekradkojacekradko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet!

@brkalow
brkalow merged commit dc886a9 into mainFeb 25, 2026
41 checks passed
@brkalow
brkalow deleted the bryce/remove-chips-build-variant branch February 25, 2026 21:47
brkalow added a commit that referenced this pull request Feb 26, 2026
… partitioned cookies (#7916)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@brkalow@jacekradko
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies - #7916

Merged
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant
Feb 25, 2026
Merged

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies#7916
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant

Conversation

@brkalow

@brkalowbrkalow commented Feb 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove the separate clerk.chips.browser.js build variant from rspack config, dev scripts, and bundlewatch
  • Add partitioned_cookies field to the Environment API response (EnvironmentJSON / EnvironmentResource), following the client_debug_mode pattern
  • Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime usePartitionedCookies getter that reads from Environment.getInstance().partitionedCookies
  • Thread the flag through all three cookie handlers: session, client UAT, and dev browser

Test plan

  • All existing cookie tests pass (session, clientUat, devBrowser)
  • New test cases verify partitioned cookie behavior when usePartitionedCookies returns true
  • Verify with a FAPI response that includes partitioned_cookies: true in the environment payload
  • Confirm cookies are set with SameSite=None; Secure; Partitioned in a cross-origin iframe context

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Removed the legacy CHIPS build variant, its build/config entries, dev script, and bundlewatch entry.
    • Removed build-time cookie flag from tool configs.
  • New Features

    • Added a runtime partitioned-cookies flag persisted in environment snapshots and configs.
    • Dev tooling exposes a refreshCookies action to reapply cookie state in development.
  • Tests

    • Updated and added tests to validate partitioned-cookie behavior driven by the new runtime flag.

brkalowand others added 4 commits February 24, 2026 10:35
The separate `clerk.chips.browser.js` bundle is no longer needed. This
removes the variant from the rspack build config, dev scripts, and
bundlewatch. The `__BUILD_VARIANT_CHIPS__` flag is temporarily hardcoded
to `false` and will be replaced with an environment flag in the next
commit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `partitioned_cookies` to `EnvironmentJSON` and
`EnvironmentResource`, following the same pattern as
`client_debug_mode`. The flag is read from the Clerk environment API
response and defaults to `false`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime
flag from the Clerk environment API response. Cookie handlers now
receive a usePartitionedCookies getter that reads
Environment.partitionedCookies, following the same pattern as
clientDebugMode.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Thread the usePartitionedCookies getter through createDevBrowser to
createDevBrowserCookie so that the dev browser cookie also sets
SameSite=None, Secure, and Partitioned when the environment flag is
enabled.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercelBot commented Feb 24, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentFeb 25, 2026 4:06am

Request Review

@changeset-bot

changeset-botBot commented Feb 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4d1a4a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
NameType
@clerk/clerk-jsPatch
@clerk/sharedPatch
@clerk/chrome-extensionPatch
@clerk/expoPatch
@clerk/agent-toolkitPatch
@clerk/astroPatch
@clerk/backendPatch
@clerk/expo-passkeysPatch
@clerk/expressPatch
@clerk/fastifyPatch
@clerk/localizationsPatch
@clerk/mswPatch
@clerk/nextjsPatch
@clerk/nuxtPatch
@clerk/react-routerPatch
@clerk/reactPatch
@clerk/tanstack-react-startPatch
@clerk/testingPatch
@clerk/uiPatch
@clerk/vuePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-newBot commented Feb 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7916

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7916

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7916

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7916

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7916

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7916

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7916

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7916

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7916

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7916

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7916

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7916

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7916

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7916

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7916

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7916

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7916

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7916

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7916

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7916

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7916

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7916

commit: 4d1a4a9

@coderabbitai

coderabbitaiBot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes remove the CHIPS build variant and its compile-time flag from bundlewatch, build, and test configs, and delete the related dev script. Runtime control for partitioned cookies is introduced: Environment gains a partitionedCookies flag (serialized as partitioned_cookies), new cookie option types and callbacks (usePartitionedCookies) are added, and dev/session cookie creation and devBrowser APIs are updated to accept and act on these runtime cookie options. Tests and coverage configs were updated accordingly.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and specifically summarizes the main changes: removing the CHIPS build variant and replacing it with a runtime environment flag for partitioned cookies.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@brkalowbrkalow changed the title Remove CHIPS build variant, use environment flag for partitioned cookieschore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookiesFeb 24, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/remove-chips-build-variant.md:
- Around line 2-3: The changes add new exported API surface (partitionedCookies
on EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies
plus cookieOptions parameters threading through cookie handlers on Environment
in `@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 73247c1 and 2e4d38c.

📒 Files selected for processing (1)
  • .changeset/remove-chips-build-variant.md

Comment on lines +2 to +3
"@clerk/clerk-js": patch
"@clerk/shared": patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider whether minor bump is warranted for new public API surface.

Both packages are bumped as patch, but the changes introduce new public API surface:

  • @clerk/shared adds partitionedCookies to the exported EnvironmentJSON / EnvironmentResource types.
  • @clerk/clerk-js adds a partitionedCookies property to Environment and new cookieOptions parameters threading through cookie handlers.

Under standard SemVer, additive changes to a public API should be a minor bump. If your project's SemVer policy treats all non-breaking additions as patch (e.g., because these are considered internal/implementation details), this is fine to keep as-is — but it's worth a conscious call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/remove-chips-build-variant.md around lines 2 - 3, The changes add
new exported API surface (partitionedCookies on
EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies plus
cookieOptions parameters threading through cookie handlers on Environment in
`@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…titioned attributes
Dev browser cookies are written at Step 0 before Environment is fetched,
so they initially use stale (non-partitioned) attributes. After Environment
resolves, refreshCookies() re-writes them with the correct attributes.
Also fixes non-partitioned cookie cleanup: when transitioning to partitioned,
the old non-partitioned cookies are now properly removed (plain remove without
partitioned attribute targets the non-partitioned version, since the browser
treats them as different cookies).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/clerk-js/src/core/auth/cookies/session.ts`:
- Around line 38-42: The remove() function only deletes cookies using the
current partitioned attributes, leaving non-partitioned __session cookies
behind; update remove() in session.ts to also explicitly remove the
non-partitioned variants by calling sessionCookie.remove(...) and
suffixedSessionCookie.remove(...) with both getCookieAttributes(options) and
getCookieAttributes({ ...options, partitioned: false }) (or otherwise obtain
both partitioned and non-partitioned attribute sets) so both cookie flavors are
deleted, and apply the same dual-attribute removal change to the analogous
remove logic in devBrowser.ts.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f4dd805 and ba2a15b.

📒 Files selected for processing (4)
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts
  • packages/clerk-js/src/core/auth/devBrowser.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/clerk-js/src/core/auth/devBrowser.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts

Comment on lines 38 to 42
const remove = () => {
const attributes = getCookieAttributes();
const attributes = getCookieAttributes(options);
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

remove() doesn't clean up non-partitioned cookie variants when transitioning to partitioned mode.

set() (lines 52-55) correctly removes the old non-partitioned cookies before writing partitioned ones, but remove() only deletes cookies matching the current (partitioned) attributes. Because the browser treats partitioned and non-partitioned cookies with the same name as distinct, a sign-out that hits remove() without a prior set() in the same page lifecycle will leave stale non-partitioned __session cookies behind. The same gap exists in devBrowser.ts.

Proposed fix
 const remove = () => {
const attributes = getCookieAttributes(options);
+ // When partitioned, also remove leftover non-partitioned variants+ // (browser treats them as separate cookies).+ if (attributes.partitioned) {+ sessionCookie.remove();+ suffixedSessionCookie.remove();+ }
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/session.ts` around lines 38 - 42, The
remove() function only deletes cookies using the current partitioned attributes,
leaving non-partitioned __session cookies behind; update remove() in session.ts
to also explicitly remove the non-partitioned variants by calling
sessionCookie.remove(...) and suffixedSessionCookie.remove(...) with both
getCookieAttributes(options) and getCookieAttributes({ ...options, partitioned:
false }) (or otherwise obtain both partitioned and non-partitioned attribute
sets) so both cookie flavors are deleted, and apply the same dual-attribute
removal change to the analogous remove logic in devBrowser.ts.

brkalowand others added 2 commits February 24, 2026 21:42
Collapse nested ternaries into single conditions since both branches
resolve to 'None', and condense non-partitioned cleanup comments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The remove() function only deleted cookies using the current partitioned
attributes, leaving the other variant behind. Now also removes
non-partitioned cookies when partitioned is enabled, matching the
existing pattern in set().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/clerk-js/src/core/auth/cookies/clientUat.ts (1)

62-67: ⚠️ Potential issue | 🟠 Major

Partitioned mode does not clear domain-scoped non-partitioned __client_uat cookies

set() only removes host-only variants before writing, but writes with domain. If partitioned mode is turned on, stale domain-scoped non-partitioned cookies can remain and conflict with auth-state reads.

Proposed fix
 // Removes any existing cookies without a domain specified to ensure the change doesn't break existing sessions.
suffixedClientUatCookie.remove();
clientUatCookie.remove();
++ // When partitioned is enabled, also remove previously written domain-scoped+ // non-partitioned variants (partitioned/non-partitioned are distinct cookies).+ if (partitioned && domain) {+ suffixedClientUatCookie.remove({ domain, sameSite, secure });+ clientUatCookie.remove({ domain, sameSite, secure });+ }
suffixedClientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
clientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts` around lines 62 - 67,
When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts`:
- Around line 62-67: When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba2a15b and 4d1a4a9.

📒 Files selected for processing (3)
  • packages/clerk-js/src/core/auth/cookies/clientUat.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts

@jacekradkojacekradko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet!

@brkalow
brkalow merged commit dc886a9 into mainFeb 25, 2026
41 checks passed
@brkalow
brkalow deleted the bryce/remove-chips-build-variant branch February 25, 2026 21:47
brkalow added a commit that referenced this pull request Feb 26, 2026
… partitioned cookies (#7916)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@brkalow@jacekradko
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies - #7916

Merged
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant
Feb 25, 2026
Merged

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies#7916
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant

Conversation

@brkalow

@brkalowbrkalow commented Feb 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove the separate clerk.chips.browser.js build variant from rspack config, dev scripts, and bundlewatch
  • Add partitioned_cookies field to the Environment API response (EnvironmentJSON / EnvironmentResource), following the client_debug_mode pattern
  • Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime usePartitionedCookies getter that reads from Environment.getInstance().partitionedCookies
  • Thread the flag through all three cookie handlers: session, client UAT, and dev browser

Test plan

  • All existing cookie tests pass (session, clientUat, devBrowser)
  • New test cases verify partitioned cookie behavior when usePartitionedCookies returns true
  • Verify with a FAPI response that includes partitioned_cookies: true in the environment payload
  • Confirm cookies are set with SameSite=None; Secure; Partitioned in a cross-origin iframe context

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Removed the legacy CHIPS build variant, its build/config entries, dev script, and bundlewatch entry.
    • Removed build-time cookie flag from tool configs.
  • New Features

    • Added a runtime partitioned-cookies flag persisted in environment snapshots and configs.
    • Dev tooling exposes a refreshCookies action to reapply cookie state in development.
  • Tests

    • Updated and added tests to validate partitioned-cookie behavior driven by the new runtime flag.

brkalowand others added 4 commits February 24, 2026 10:35
The separate `clerk.chips.browser.js` bundle is no longer needed. This
removes the variant from the rspack build config, dev scripts, and
bundlewatch. The `__BUILD_VARIANT_CHIPS__` flag is temporarily hardcoded
to `false` and will be replaced with an environment flag in the next
commit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `partitioned_cookies` to `EnvironmentJSON` and
`EnvironmentResource`, following the same pattern as
`client_debug_mode`. The flag is read from the Clerk environment API
response and defaults to `false`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime
flag from the Clerk environment API response. Cookie handlers now
receive a usePartitionedCookies getter that reads
Environment.partitionedCookies, following the same pattern as
clientDebugMode.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Thread the usePartitionedCookies getter through createDevBrowser to
createDevBrowserCookie so that the dev browser cookie also sets
SameSite=None, Secure, and Partitioned when the environment flag is
enabled.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercelBot commented Feb 24, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentFeb 25, 2026 4:06am

Request Review

@changeset-bot

changeset-botBot commented Feb 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4d1a4a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
NameType
@clerk/clerk-jsPatch
@clerk/sharedPatch
@clerk/chrome-extensionPatch
@clerk/expoPatch
@clerk/agent-toolkitPatch
@clerk/astroPatch
@clerk/backendPatch
@clerk/expo-passkeysPatch
@clerk/expressPatch
@clerk/fastifyPatch
@clerk/localizationsPatch
@clerk/mswPatch
@clerk/nextjsPatch
@clerk/nuxtPatch
@clerk/react-routerPatch
@clerk/reactPatch
@clerk/tanstack-react-startPatch
@clerk/testingPatch
@clerk/uiPatch
@clerk/vuePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-newBot commented Feb 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7916

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7916

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7916

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7916

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7916

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7916

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7916

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7916

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7916

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7916

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7916

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7916

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7916

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7916

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7916

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7916

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7916

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7916

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7916

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7916

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7916

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7916

commit: 4d1a4a9

@coderabbitai

coderabbitaiBot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes remove the CHIPS build variant and its compile-time flag from bundlewatch, build, and test configs, and delete the related dev script. Runtime control for partitioned cookies is introduced: Environment gains a partitionedCookies flag (serialized as partitioned_cookies), new cookie option types and callbacks (usePartitionedCookies) are added, and dev/session cookie creation and devBrowser APIs are updated to accept and act on these runtime cookie options. Tests and coverage configs were updated accordingly.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and specifically summarizes the main changes: removing the CHIPS build variant and replacing it with a runtime environment flag for partitioned cookies.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@brkalowbrkalow changed the title Remove CHIPS build variant, use environment flag for partitioned cookieschore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookiesFeb 24, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/remove-chips-build-variant.md:
- Around line 2-3: The changes add new exported API surface (partitionedCookies
on EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies
plus cookieOptions parameters threading through cookie handlers on Environment
in `@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 73247c1 and 2e4d38c.

📒 Files selected for processing (1)
  • .changeset/remove-chips-build-variant.md

Comment on lines +2 to +3
"@clerk/clerk-js": patch
"@clerk/shared": patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider whether minor bump is warranted for new public API surface.

Both packages are bumped as patch, but the changes introduce new public API surface:

  • @clerk/shared adds partitionedCookies to the exported EnvironmentJSON / EnvironmentResource types.
  • @clerk/clerk-js adds a partitionedCookies property to Environment and new cookieOptions parameters threading through cookie handlers.

Under standard SemVer, additive changes to a public API should be a minor bump. If your project's SemVer policy treats all non-breaking additions as patch (e.g., because these are considered internal/implementation details), this is fine to keep as-is — but it's worth a conscious call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/remove-chips-build-variant.md around lines 2 - 3, The changes add
new exported API surface (partitionedCookies on
EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies plus
cookieOptions parameters threading through cookie handlers on Environment in
`@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…titioned attributes
Dev browser cookies are written at Step 0 before Environment is fetched,
so they initially use stale (non-partitioned) attributes. After Environment
resolves, refreshCookies() re-writes them with the correct attributes.
Also fixes non-partitioned cookie cleanup: when transitioning to partitioned,
the old non-partitioned cookies are now properly removed (plain remove without
partitioned attribute targets the non-partitioned version, since the browser
treats them as different cookies).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/clerk-js/src/core/auth/cookies/session.ts`:
- Around line 38-42: The remove() function only deletes cookies using the
current partitioned attributes, leaving non-partitioned __session cookies
behind; update remove() in session.ts to also explicitly remove the
non-partitioned variants by calling sessionCookie.remove(...) and
suffixedSessionCookie.remove(...) with both getCookieAttributes(options) and
getCookieAttributes({ ...options, partitioned: false }) (or otherwise obtain
both partitioned and non-partitioned attribute sets) so both cookie flavors are
deleted, and apply the same dual-attribute removal change to the analogous
remove logic in devBrowser.ts.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f4dd805 and ba2a15b.

📒 Files selected for processing (4)
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts
  • packages/clerk-js/src/core/auth/devBrowser.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/clerk-js/src/core/auth/devBrowser.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts

Comment on lines 38 to 42
const remove = () => {
const attributes = getCookieAttributes();
const attributes = getCookieAttributes(options);
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

remove() doesn't clean up non-partitioned cookie variants when transitioning to partitioned mode.

set() (lines 52-55) correctly removes the old non-partitioned cookies before writing partitioned ones, but remove() only deletes cookies matching the current (partitioned) attributes. Because the browser treats partitioned and non-partitioned cookies with the same name as distinct, a sign-out that hits remove() without a prior set() in the same page lifecycle will leave stale non-partitioned __session cookies behind. The same gap exists in devBrowser.ts.

Proposed fix
 const remove = () => {
const attributes = getCookieAttributes(options);
+ // When partitioned, also remove leftover non-partitioned variants+ // (browser treats them as separate cookies).+ if (attributes.partitioned) {+ sessionCookie.remove();+ suffixedSessionCookie.remove();+ }
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/session.ts` around lines 38 - 42, The
remove() function only deletes cookies using the current partitioned attributes,
leaving non-partitioned __session cookies behind; update remove() in session.ts
to also explicitly remove the non-partitioned variants by calling
sessionCookie.remove(...) and suffixedSessionCookie.remove(...) with both
getCookieAttributes(options) and getCookieAttributes({ ...options, partitioned:
false }) (or otherwise obtain both partitioned and non-partitioned attribute
sets) so both cookie flavors are deleted, and apply the same dual-attribute
removal change to the analogous remove logic in devBrowser.ts.

brkalowand others added 2 commits February 24, 2026 21:42
Collapse nested ternaries into single conditions since both branches
resolve to 'None', and condense non-partitioned cleanup comments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The remove() function only deleted cookies using the current partitioned
attributes, leaving the other variant behind. Now also removes
non-partitioned cookies when partitioned is enabled, matching the
existing pattern in set().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/clerk-js/src/core/auth/cookies/clientUat.ts (1)

62-67: ⚠️ Potential issue | 🟠 Major

Partitioned mode does not clear domain-scoped non-partitioned __client_uat cookies

set() only removes host-only variants before writing, but writes with domain. If partitioned mode is turned on, stale domain-scoped non-partitioned cookies can remain and conflict with auth-state reads.

Proposed fix
 // Removes any existing cookies without a domain specified to ensure the change doesn't break existing sessions.
suffixedClientUatCookie.remove();
clientUatCookie.remove();
++ // When partitioned is enabled, also remove previously written domain-scoped+ // non-partitioned variants (partitioned/non-partitioned are distinct cookies).+ if (partitioned && domain) {+ suffixedClientUatCookie.remove({ domain, sameSite, secure });+ clientUatCookie.remove({ domain, sameSite, secure });+ }
suffixedClientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
clientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts` around lines 62 - 67,
When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts`:
- Around line 62-67: When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba2a15b and 4d1a4a9.

📒 Files selected for processing (3)
  • packages/clerk-js/src/core/auth/cookies/clientUat.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts

@jacekradkojacekradko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet!

@brkalow
brkalow merged commit dc886a9 into mainFeb 25, 2026
41 checks passed
@brkalow
brkalow deleted the bryce/remove-chips-build-variant branch February 25, 2026 21:47
brkalow added a commit that referenced this pull request Feb 26, 2026
… partitioned cookies (#7916)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@brkalow@jacekradko
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies - #7916

Merged
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant
Feb 25, 2026
Merged

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies#7916
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant

Conversation

@brkalow

@brkalowbrkalow commented Feb 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove the separate clerk.chips.browser.js build variant from rspack config, dev scripts, and bundlewatch
  • Add partitioned_cookies field to the Environment API response (EnvironmentJSON / EnvironmentResource), following the client_debug_mode pattern
  • Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime usePartitionedCookies getter that reads from Environment.getInstance().partitionedCookies
  • Thread the flag through all three cookie handlers: session, client UAT, and dev browser

Test plan

  • All existing cookie tests pass (session, clientUat, devBrowser)
  • New test cases verify partitioned cookie behavior when usePartitionedCookies returns true
  • Verify with a FAPI response that includes partitioned_cookies: true in the environment payload
  • Confirm cookies are set with SameSite=None; Secure; Partitioned in a cross-origin iframe context

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Removed the legacy CHIPS build variant, its build/config entries, dev script, and bundlewatch entry.
    • Removed build-time cookie flag from tool configs.
  • New Features

    • Added a runtime partitioned-cookies flag persisted in environment snapshots and configs.
    • Dev tooling exposes a refreshCookies action to reapply cookie state in development.
  • Tests

    • Updated and added tests to validate partitioned-cookie behavior driven by the new runtime flag.

brkalowand others added 4 commits February 24, 2026 10:35
The separate `clerk.chips.browser.js` bundle is no longer needed. This
removes the variant from the rspack build config, dev scripts, and
bundlewatch. The `__BUILD_VARIANT_CHIPS__` flag is temporarily hardcoded
to `false` and will be replaced with an environment flag in the next
commit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `partitioned_cookies` to `EnvironmentJSON` and
`EnvironmentResource`, following the same pattern as
`client_debug_mode`. The flag is read from the Clerk environment API
response and defaults to `false`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime
flag from the Clerk environment API response. Cookie handlers now
receive a usePartitionedCookies getter that reads
Environment.partitionedCookies, following the same pattern as
clientDebugMode.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Thread the usePartitionedCookies getter through createDevBrowser to
createDevBrowserCookie so that the dev browser cookie also sets
SameSite=None, Secure, and Partitioned when the environment flag is
enabled.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercelBot commented Feb 24, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentFeb 25, 2026 4:06am

Request Review

@changeset-bot

changeset-botBot commented Feb 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4d1a4a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
NameType
@clerk/clerk-jsPatch
@clerk/sharedPatch
@clerk/chrome-extensionPatch
@clerk/expoPatch
@clerk/agent-toolkitPatch
@clerk/astroPatch
@clerk/backendPatch
@clerk/expo-passkeysPatch
@clerk/expressPatch
@clerk/fastifyPatch
@clerk/localizationsPatch
@clerk/mswPatch
@clerk/nextjsPatch
@clerk/nuxtPatch
@clerk/react-routerPatch
@clerk/reactPatch
@clerk/tanstack-react-startPatch
@clerk/testingPatch
@clerk/uiPatch
@clerk/vuePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-newBot commented Feb 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7916

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7916

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7916

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7916

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7916

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7916

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7916

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7916

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7916

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7916

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7916

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7916

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7916

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7916

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7916

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7916

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7916

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7916

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7916

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7916

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7916

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7916

commit: 4d1a4a9

@coderabbitai

coderabbitaiBot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes remove the CHIPS build variant and its compile-time flag from bundlewatch, build, and test configs, and delete the related dev script. Runtime control for partitioned cookies is introduced: Environment gains a partitionedCookies flag (serialized as partitioned_cookies), new cookie option types and callbacks (usePartitionedCookies) are added, and dev/session cookie creation and devBrowser APIs are updated to accept and act on these runtime cookie options. Tests and coverage configs were updated accordingly.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and specifically summarizes the main changes: removing the CHIPS build variant and replacing it with a runtime environment flag for partitioned cookies.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@brkalowbrkalow changed the title Remove CHIPS build variant, use environment flag for partitioned cookieschore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookiesFeb 24, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/remove-chips-build-variant.md:
- Around line 2-3: The changes add new exported API surface (partitionedCookies
on EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies
plus cookieOptions parameters threading through cookie handlers on Environment
in `@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 73247c1 and 2e4d38c.

📒 Files selected for processing (1)
  • .changeset/remove-chips-build-variant.md

Comment on lines +2 to +3
"@clerk/clerk-js": patch
"@clerk/shared": patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider whether minor bump is warranted for new public API surface.

Both packages are bumped as patch, but the changes introduce new public API surface:

  • @clerk/shared adds partitionedCookies to the exported EnvironmentJSON / EnvironmentResource types.
  • @clerk/clerk-js adds a partitionedCookies property to Environment and new cookieOptions parameters threading through cookie handlers.

Under standard SemVer, additive changes to a public API should be a minor bump. If your project's SemVer policy treats all non-breaking additions as patch (e.g., because these are considered internal/implementation details), this is fine to keep as-is — but it's worth a conscious call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/remove-chips-build-variant.md around lines 2 - 3, The changes add
new exported API surface (partitionedCookies on
EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies plus
cookieOptions parameters threading through cookie handlers on Environment in
`@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…titioned attributes
Dev browser cookies are written at Step 0 before Environment is fetched,
so they initially use stale (non-partitioned) attributes. After Environment
resolves, refreshCookies() re-writes them with the correct attributes.
Also fixes non-partitioned cookie cleanup: when transitioning to partitioned,
the old non-partitioned cookies are now properly removed (plain remove without
partitioned attribute targets the non-partitioned version, since the browser
treats them as different cookies).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/clerk-js/src/core/auth/cookies/session.ts`:
- Around line 38-42: The remove() function only deletes cookies using the
current partitioned attributes, leaving non-partitioned __session cookies
behind; update remove() in session.ts to also explicitly remove the
non-partitioned variants by calling sessionCookie.remove(...) and
suffixedSessionCookie.remove(...) with both getCookieAttributes(options) and
getCookieAttributes({ ...options, partitioned: false }) (or otherwise obtain
both partitioned and non-partitioned attribute sets) so both cookie flavors are
deleted, and apply the same dual-attribute removal change to the analogous
remove logic in devBrowser.ts.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f4dd805 and ba2a15b.

📒 Files selected for processing (4)
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts
  • packages/clerk-js/src/core/auth/devBrowser.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/clerk-js/src/core/auth/devBrowser.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts

Comment on lines 38 to 42
const remove = () => {
const attributes = getCookieAttributes();
const attributes = getCookieAttributes(options);
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

remove() doesn't clean up non-partitioned cookie variants when transitioning to partitioned mode.

set() (lines 52-55) correctly removes the old non-partitioned cookies before writing partitioned ones, but remove() only deletes cookies matching the current (partitioned) attributes. Because the browser treats partitioned and non-partitioned cookies with the same name as distinct, a sign-out that hits remove() without a prior set() in the same page lifecycle will leave stale non-partitioned __session cookies behind. The same gap exists in devBrowser.ts.

Proposed fix
 const remove = () => {
const attributes = getCookieAttributes(options);
+ // When partitioned, also remove leftover non-partitioned variants+ // (browser treats them as separate cookies).+ if (attributes.partitioned) {+ sessionCookie.remove();+ suffixedSessionCookie.remove();+ }
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/session.ts` around lines 38 - 42, The
remove() function only deletes cookies using the current partitioned attributes,
leaving non-partitioned __session cookies behind; update remove() in session.ts
to also explicitly remove the non-partitioned variants by calling
sessionCookie.remove(...) and suffixedSessionCookie.remove(...) with both
getCookieAttributes(options) and getCookieAttributes({ ...options, partitioned:
false }) (or otherwise obtain both partitioned and non-partitioned attribute
sets) so both cookie flavors are deleted, and apply the same dual-attribute
removal change to the analogous remove logic in devBrowser.ts.

brkalowand others added 2 commits February 24, 2026 21:42
Collapse nested ternaries into single conditions since both branches
resolve to 'None', and condense non-partitioned cleanup comments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The remove() function only deleted cookies using the current partitioned
attributes, leaving the other variant behind. Now also removes
non-partitioned cookies when partitioned is enabled, matching the
existing pattern in set().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/clerk-js/src/core/auth/cookies/clientUat.ts (1)

62-67: ⚠️ Potential issue | 🟠 Major

Partitioned mode does not clear domain-scoped non-partitioned __client_uat cookies

set() only removes host-only variants before writing, but writes with domain. If partitioned mode is turned on, stale domain-scoped non-partitioned cookies can remain and conflict with auth-state reads.

Proposed fix
 // Removes any existing cookies without a domain specified to ensure the change doesn't break existing sessions.
suffixedClientUatCookie.remove();
clientUatCookie.remove();
++ // When partitioned is enabled, also remove previously written domain-scoped+ // non-partitioned variants (partitioned/non-partitioned are distinct cookies).+ if (partitioned && domain) {+ suffixedClientUatCookie.remove({ domain, sameSite, secure });+ clientUatCookie.remove({ domain, sameSite, secure });+ }
suffixedClientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
clientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts` around lines 62 - 67,
When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts`:
- Around line 62-67: When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba2a15b and 4d1a4a9.

📒 Files selected for processing (3)
  • packages/clerk-js/src/core/auth/cookies/clientUat.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts

@jacekradkojacekradko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet!

@brkalow
brkalow merged commit dc886a9 into mainFeb 25, 2026
41 checks passed
@brkalow
brkalow deleted the bryce/remove-chips-build-variant branch February 25, 2026 21:47
brkalow added a commit that referenced this pull request Feb 26, 2026
… partitioned cookies (#7916)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@brkalow@jacekradko
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies - #7916

Merged
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant
Feb 25, 2026
Merged

chore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookies#7916
brkalow merged 9 commits into
mainfrom
bryce/remove-chips-build-variant

Conversation

@brkalow

@brkalowbrkalow commented Feb 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove the separate clerk.chips.browser.js build variant from rspack config, dev scripts, and bundlewatch
  • Add partitioned_cookies field to the Environment API response (EnvironmentJSON / EnvironmentResource), following the client_debug_mode pattern
  • Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime usePartitionedCookies getter that reads from Environment.getInstance().partitionedCookies
  • Thread the flag through all three cookie handlers: session, client UAT, and dev browser

Test plan

  • All existing cookie tests pass (session, clientUat, devBrowser)
  • New test cases verify partitioned cookie behavior when usePartitionedCookies returns true
  • Verify with a FAPI response that includes partitioned_cookies: true in the environment payload
  • Confirm cookies are set with SameSite=None; Secure; Partitioned in a cross-origin iframe context

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Removed the legacy CHIPS build variant, its build/config entries, dev script, and bundlewatch entry.
    • Removed build-time cookie flag from tool configs.
  • New Features

    • Added a runtime partitioned-cookies flag persisted in environment snapshots and configs.
    • Dev tooling exposes a refreshCookies action to reapply cookie state in development.
  • Tests

    • Updated and added tests to validate partitioned-cookie behavior driven by the new runtime flag.

brkalowand others added 4 commits February 24, 2026 10:35
The separate `clerk.chips.browser.js` bundle is no longer needed. This
removes the variant from the rspack build config, dev scripts, and
bundlewatch. The `__BUILD_VARIANT_CHIPS__` flag is temporarily hardcoded
to `false` and will be replaced with an environment flag in the next
commit.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `partitioned_cookies` to `EnvironmentJSON` and
`EnvironmentResource`, following the same pattern as
`client_debug_mode`. The flag is read from the Clerk environment API
response and defaults to `false`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the build-time __BUILD_VARIANT_CHIPS__ constant with a runtime
flag from the Clerk environment API response. Cookie handlers now
receive a usePartitionedCookies getter that reads
Environment.partitionedCookies, following the same pattern as
clientDebugMode.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Thread the usePartitionedCookies getter through createDevBrowser to
createDevBrowserCookie so that the dev browser cookie also sets
SameSite=None, Secure, and Partitioned when the environment flag is
enabled.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercelBot commented Feb 24, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentFeb 25, 2026 4:06am

Request Review

@changeset-bot

changeset-botBot commented Feb 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4d1a4a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
NameType
@clerk/clerk-jsPatch
@clerk/sharedPatch
@clerk/chrome-extensionPatch
@clerk/expoPatch
@clerk/agent-toolkitPatch
@clerk/astroPatch
@clerk/backendPatch
@clerk/expo-passkeysPatch
@clerk/expressPatch
@clerk/fastifyPatch
@clerk/localizationsPatch
@clerk/mswPatch
@clerk/nextjsPatch
@clerk/nuxtPatch
@clerk/react-routerPatch
@clerk/reactPatch
@clerk/tanstack-react-startPatch
@clerk/testingPatch
@clerk/uiPatch
@clerk/vuePatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-newBot commented Feb 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7916

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7916

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7916

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7916

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7916

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7916

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7916

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7916

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7916

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7916

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7916

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7916

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7916

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7916

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7916

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7916

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7916

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7916

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7916

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7916

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7916

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7916

commit: 4d1a4a9

@coderabbitai

coderabbitaiBot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes remove the CHIPS build variant and its compile-time flag from bundlewatch, build, and test configs, and delete the related dev script. Runtime control for partitioned cookies is introduced: Environment gains a partitionedCookies flag (serialized as partitioned_cookies), new cookie option types and callbacks (usePartitionedCookies) are added, and dev/session cookie creation and devBrowser APIs are updated to accept and act on these runtime cookie options. Tests and coverage configs were updated accordingly.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and specifically summarizes the main changes: removing the CHIPS build variant and replacing it with a runtime environment flag for partitioned cookies.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@brkalowbrkalow changed the title Remove CHIPS build variant, use environment flag for partitioned cookieschore(clerk-js): Remove CHIPS build variant, use environment flag for partitioned cookiesFeb 24, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/remove-chips-build-variant.md:
- Around line 2-3: The changes add new exported API surface (partitionedCookies
on EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies
plus cookieOptions parameters threading through cookie handlers on Environment
in `@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 73247c1 and 2e4d38c.

📒 Files selected for processing (1)
  • .changeset/remove-chips-build-variant.md

Comment on lines +2 to +3
"@clerk/clerk-js": patch
"@clerk/shared": patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider whether minor bump is warranted for new public API surface.

Both packages are bumped as patch, but the changes introduce new public API surface:

  • @clerk/shared adds partitionedCookies to the exported EnvironmentJSON / EnvironmentResource types.
  • @clerk/clerk-js adds a partitionedCookies property to Environment and new cookieOptions parameters threading through cookie handlers.

Under standard SemVer, additive changes to a public API should be a minor bump. If your project's SemVer policy treats all non-breaking additions as patch (e.g., because these are considered internal/implementation details), this is fine to keep as-is — but it's worth a conscious call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/remove-chips-build-variant.md around lines 2 - 3, The changes add
new exported API surface (partitionedCookies on
EnvironmentJSON/EnvironmentResource in `@clerk/shared` and partitionedCookies plus
cookieOptions parameters threading through cookie handlers on Environment in
`@clerk/clerk-js`); update the changeset bump from "patch" to "minor" for both
"@clerk/shared" and "@clerk/clerk-js" or, if you intentionally treat these
additions as internal, add an explicit rationale in the changeset explaining why
they remain "patch" (refer to the symbols EnvironmentJSON, EnvironmentResource,
Environment, partitionedCookies, and cookieOptions when documenting your
decision).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…titioned attributes
Dev browser cookies are written at Step 0 before Environment is fetched,
so they initially use stale (non-partitioned) attributes. After Environment
resolves, refreshCookies() re-writes them with the correct attributes.
Also fixes non-partitioned cookie cleanup: when transitioning to partitioned,
the old non-partitioned cookies are now properly removed (plain remove without
partitioned attribute targets the non-partitioned version, since the browser
treats them as different cookies).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/clerk-js/src/core/auth/cookies/session.ts`:
- Around line 38-42: The remove() function only deletes cookies using the
current partitioned attributes, leaving non-partitioned __session cookies
behind; update remove() in session.ts to also explicitly remove the
non-partitioned variants by calling sessionCookie.remove(...) and
suffixedSessionCookie.remove(...) with both getCookieAttributes(options) and
getCookieAttributes({ ...options, partitioned: false }) (or otherwise obtain
both partitioned and non-partitioned attribute sets) so both cookie flavors are
deleted, and apply the same dual-attribute removal change to the analogous
remove logic in devBrowser.ts.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f4dd805 and ba2a15b.

📒 Files selected for processing (4)
  • packages/clerk-js/src/core/auth/AuthCookieService.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts
  • packages/clerk-js/src/core/auth/devBrowser.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/clerk-js/src/core/auth/devBrowser.ts
  • packages/clerk-js/src/core/auth/AuthCookieService.ts

Comment on lines 38 to 42
const remove = () => {
const attributes = getCookieAttributes();
const attributes = getCookieAttributes(options);
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

remove() doesn't clean up non-partitioned cookie variants when transitioning to partitioned mode.

set() (lines 52-55) correctly removes the old non-partitioned cookies before writing partitioned ones, but remove() only deletes cookies matching the current (partitioned) attributes. Because the browser treats partitioned and non-partitioned cookies with the same name as distinct, a sign-out that hits remove() without a prior set() in the same page lifecycle will leave stale non-partitioned __session cookies behind. The same gap exists in devBrowser.ts.

Proposed fix
 const remove = () => {
const attributes = getCookieAttributes(options);
+ // When partitioned, also remove leftover non-partitioned variants+ // (browser treats them as separate cookies).+ if (attributes.partitioned) {+ sessionCookie.remove();+ suffixedSessionCookie.remove();+ }
sessionCookie.remove(attributes);
suffixedSessionCookie.remove(attributes);
};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/session.ts` around lines 38 - 42, The
remove() function only deletes cookies using the current partitioned attributes,
leaving non-partitioned __session cookies behind; update remove() in session.ts
to also explicitly remove the non-partitioned variants by calling
sessionCookie.remove(...) and suffixedSessionCookie.remove(...) with both
getCookieAttributes(options) and getCookieAttributes({ ...options, partitioned:
false }) (or otherwise obtain both partitioned and non-partitioned attribute
sets) so both cookie flavors are deleted, and apply the same dual-attribute
removal change to the analogous remove logic in devBrowser.ts.

brkalowand others added 2 commits February 24, 2026 21:42
Collapse nested ternaries into single conditions since both branches
resolve to 'None', and condense non-partitioned cleanup comments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The remove() function only deleted cookies using the current partitioned
attributes, leaving the other variant behind. Now also removes
non-partitioned cookies when partitioned is enabled, matching the
existing pattern in set().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/clerk-js/src/core/auth/cookies/clientUat.ts (1)

62-67: ⚠️ Potential issue | 🟠 Major

Partitioned mode does not clear domain-scoped non-partitioned __client_uat cookies

set() only removes host-only variants before writing, but writes with domain. If partitioned mode is turned on, stale domain-scoped non-partitioned cookies can remain and conflict with auth-state reads.

Proposed fix
 // Removes any existing cookies without a domain specified to ensure the change doesn't break existing sessions.
suffixedClientUatCookie.remove();
clientUatCookie.remove();
++ // When partitioned is enabled, also remove previously written domain-scoped+ // non-partitioned variants (partitioned/non-partitioned are distinct cookies).+ if (partitioned && domain) {+ suffixedClientUatCookie.remove({ domain, sameSite, secure });+ clientUatCookie.remove({ domain, sameSite, secure });+ }
suffixedClientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
clientUatCookie.set(val, { domain, expires, partitioned, sameSite, secure });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts` around lines 62 - 67,
When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/clerk-js/src/core/auth/cookies/clientUat.ts`:
- Around line 62-67: When partitioned mode is enabled the current logic calls
suffixedClientUatCookie.remove() and clientUatCookie.remove() (host-only
removals) then calls set(..., { domain, ... }) which writes domain-scoped
cookies but does not clear existing domain-scoped non-partitioned __client_uat
cookies; update the code so that before writing in partitioned mode you
explicitly remove any domain-scoped variants as well (e.g., call remove with the
domain option or enhance set() to first clear domain-scoped cookies) for both
suffixedClientUatCookie and clientUatCookie to prevent stale domain-scoped
cookies from conflicting with auth reads.

ℹ️ Review info

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba2a15b and 4d1a4a9.

📒 Files selected for processing (3)
  • packages/clerk-js/src/core/auth/cookies/clientUat.ts
  • packages/clerk-js/src/core/auth/cookies/devBrowser.ts
  • packages/clerk-js/src/core/auth/cookies/session.ts

@jacekradkojacekradko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet!

@brkalow
brkalow merged commit dc886a9 into mainFeb 25, 2026
41 checks passed
@brkalow
brkalow deleted the bryce/remove-chips-build-variant branch February 25, 2026 21:47
brkalow added a commit that referenced this pull request Feb 26, 2026
… partitioned cookies (#7916)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@brkalow@jacekradko