feat(clerk-js,shared): Backport Session Minter SDK changes to core-2#8643
feat(clerk-js,shared): Backport Session Minter SDK changes to core-2#8643nikosdouvlis wants to merge 7 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
|
The two failing checks ( #8633, the most recently merged PR against The failure is Static analysis (including bundlewatch) is now green after I bumped the |
Why
Session Minter (edge token minting) shipped to clerk-js on
mainbetween March and May 2026 across five small PRs. Until now, only the touch-intent change (#8135) was backported torelease/core-2. The other five SDK changes have to land on core-2 too so v5 consumers can opt into edge-minted tokens once their instance flag is flipped on.This is a behavior-preserving backport: every code path is gated behind
auth_config.session_minter, which defaults tofalse. With the gate off, clerk-js v5 sends the same/tokensrequest body and runs the same retry path it does today.What changed
Five upstream PRs ported, one per commit:
oiatfield toJwtHeaderpickFreshestJwt, so a stale edge-minted broadcast cannot clobber a fresher cached token/tokensPOST body whenauth_config.session_minteris truemissing_expired_tokenretry when Session Minter is enabled (the token is now in the body, so the retry-with-expired-token fallback is unnecessary). Legacy retry preserved when the flag is off.forceOrigin=truein the body whenskipCacheis true, so FAPI routes to origin instead of the Session Minter edgeA sixth commit cleans up a review-pass finding: rather than introduce a new
__internal_environmentgetter on Clerk (which exists onmainbut not on core-2), the code now reads the existing__unstable__environmentgetter that has been on core-2 since v3. Same commit also backports the Session test coverage from #8105 and #8106 that wasn't worth porting until the env-getter question was settled.Packages affected
@clerk/clerk-js: AuthConfig gains asessionMinterfield, Session sends the new body fields when the flag is on, tokenCache compares broadcast tokens withpickFreshestJwt. All behavior is gated.@clerk/shared:AuthConfigResource.sessionMinter,AuthConfigJSON.session_minter?,JwtHeader.oiat?. All additive.Test plan
pnpm vitest run src/corein clerk-js: 380/380 passpnpm testin shared: 641/641 passtokenFreshness.test.tscover the broadcast-side guard's edge cases (legacy tokens, equal oiat, tie-break)Session.test.tsblocks assert the/tokensbody shape for bothsessionMinter: trueandsessionMinter: false