Require recorded scopes to reuse a store auth session in theme commands - #8184
Merged
Merged
Conversation
Contributor
Author
This was referenced Jul 28, 2026
alfonso-noriega
marked this pull request as ready for review
July 28, 2026 14:56
isaacroldan
reviewed
Jul 28, 2026
isaacroldan
approved these changes
Jul 28, 2026
graygilmore
approved these changes
Jul 28, 2026
hasRequiredStoreAuthScopes treated a stored session with no recorded scopes as satisfying any requirement, so theme pull and theme push could adopt sessions whose actual grant is unknown. Both store auth and preview store creation always record scopes, so an empty scope list means we cannot verify the grant; fall back to normal theme authentication instead. Assisted-By: devx/60503589-d48c-43b2-8fba-b0df1e076f15
alfonso-noriega
force-pushed
the
theme-store-auth-require-recorded-scopes
branch
from
July 29, 2026 09:33
b492a9f to
ed332dd
Compare
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/node/api/partners.d.ts@@ -1,5 +1,7 @@
import { GraphQLVariables, GraphQLResponse, CacheOptions, UnauthorizedHandler } from './graphql.js';
import { RequestModeInput } from '../http.js';
+import { Variables } from 'graphql-request';
+import { TypedDocumentNode } from '@graphql-typed-document-node/core';
/**
* Executes a GraphQL query against the Partners API.
*
@@ -12,6 +14,17 @@ import { RequestModeInput } from '../http.js';
* @returns The response of the query of generic type <T>.
*/
export declare function partnersRequest<T>(query: string, token: string, variables?: GraphQLVariables, cacheOptions?: CacheOptions, preferredBehaviour?: RequestModeInput, unauthorizedHandler?: UnauthorizedHandler): Promise<T>;
+/**
+ * Executes a GraphQL query against the Partners API. Uses typed documents.
+ *
+ * @param query - GraphQL query to execute.
+ * @param token - Partners token.
+ * @param variables - GraphQL variables to pass to the query.
+ * @param preferredBehaviour - Preferred behaviour for the request.
+ * @param unauthorizedHandler - Optional handler for unauthorized requests.
+ * @returns The response of the query of generic type <TResult>.
+ */
+export declare function partnersRequestDoc<TResult, TVariables extends Variables>(query: TypedDocumentNode<TResult, TVariables>, token: string, variables?: TVariables, preferredBehaviour?: RequestModeInput, unauthorizedHandler?: UnauthorizedHandler): Promise<TResult>;
/**
* Sets the next deprecation date from [GraphQL response extensions](https://www.apollographql.com/docs/resources/graphql-glossary/#extensions)
* if `response.extensions.deprecations` objects contain a `supportedUntilDate` (ISO 8601-formatted string).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

WHY are these changes introduced?
Second layer of the
theme devstore-auth regression fix (Slack thread); stacked on #8183.hasRequiredStoreAuthScopestreated a stored session with no recorded scopes as satisfying any requirement (if (scopes.length === 0) return true), sotheme pull/theme pushcould adopt sessions whose actual grant is unknown and fail later with missing-scope errors.WHAT is this pull request doing?
shopify store authandshopify store create previewalways record granted scopes, so an empty scope list means the grant can't be verified — the command now falls back to normal theme authentication instead (graceful, no error).How to test your changes?
Covered by unit tests (
theme-command.test.ts): a stored session withscopes: []no longer satisfiestheme pull/theme push; the command falls back toensureAuthenticatedThemes.Measuring impact