Skip to content

Commit 6c956c5

Browse files
RyanDJLeeclaude
andcommitted
Tighten scope delimiter regex and fix bogus test
- Narrow regex from /[\s,]+/ to /[ ,]+/ to match server-side Access::ScopeSet.parse_scopes behavior (space and comma only) - Remove dead .trim() — splitting on /[ ,]+/ can't produce elements with leading/trailing whitespace - Fix test that claimed to cover space-separated parsing but actually passed comma-separated input (exercising no new code) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ae0a747 commit 6c956c5

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

packages/cli/src/cli/services/store/auth/scopes.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ describe('store auth scope helpers', () => {
2929
])
3030
})
3131

32-
test('resolveGrantedScopes succeeds when requested scopes were space-separated', () => {
32+
test('resolveGrantedScopes succeeds when granted scopes are space-separated', () => {
3333
expect(
3434
resolveGrantedScopes(
3535
{
3636
access_token: 'token',
37-
scope: 'read_products,read_inventory',
37+
scope: 'read_products read_inventory',
3838
},
3939
['read_products', 'read_inventory'],
4040
),

packages/cli/src/cli/services/store/auth/scopes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import type {StoreTokenResponse} from './token-client.js'
44

55
export function parseStoreAuthScopes(input: string): string[] {
66
const scopes = input
7-
.split(/[\s,]+/)
8-
.map((scope) => scope.trim())
7+
.split(/[ ,]+/)
98
.filter(Boolean)
109

1110
if (scopes.length === 0) {

0 commit comments

Comments
 (0)