Conversation
🦋 Changeset detectedLatest commit: 2cf4786 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds a changeset declaring a major version bump for 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
|
!allow-major |
| @@ -127,13 +139,29 @@ const checkBillingAuthorization: CheckBillingAuthorization = (params, options) = | |||
| }; | |||
|
|
|||
| const splitByScope = (fea: string | null | undefined) => { | |||
There was a problem hiding this comment.
This got flagged by Codex
splitByScope edge case: missing :
In the new loop, it does:
• const colonIndex = part.indexOf(':')
• then slices using that index. 
If a segment ever lacks : (or is malformed), colonIndex becomes -1, and the slicing behavior gets weird (scope becomes part.slice(0, -1) and value becomes the entire string). Today the features claim may always be well-formed, but this helper is the kind of thing that gets reused and then surprises someone later.
Suggestion: guard early:
• if colonIndex <= 0 (or === -1) → continue (or treat as invalid and throw, depending on how strict you want claims parsing to be).
• also consider trimming out empty value.
There was a problem hiding this comment.
Added a check! These are from FAPI so they're likely always well-formed, but it doesn't hurt to at least throw an error.
Description
This PR updates our parsing of the features claim and related functions to throw an error when provided with an invalid scope.
Previously, the following check would return
truefor thefeaclaim ofu:featurename:This is because the previous implementation would simply drop any unknown scope. This became confusing because the following would also return
true:This is because
organizationis not the scope for an organization feature; it'sorg.With the new parser, you're able to use any of the following scopes:
u, user, o, org, organization.This PR also optimizes the
splitScopefunction to be a bit more performant since it was doing lots of redundant maps and filters.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
Breaking Changes
New Features
Tests