Skip to content

Log store auth session decisions in theme commands under --verbose - #8186

Merged
alfonso-noriega merged 1 commit into
mainfrom
theme-store-auth-debug-logging
Jul 29, 2026
Merged

Log store auth session decisions in theme commands under --verbose#8186
alfonso-noriega merged 1 commit into
mainfrom
theme-store-auth-debug-logging

Conversation

@alfonso-noriega

@alfonso-noriega alfonso-noriega commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Final layer of the theme dev store-auth regression fix (Slack thread); stacked on #8185.

Diagnosing why a theme command picked (or skipped) a stored store auth session previously required tracing the code — the session source was invisible in --verbose output, which made the original support investigations slow (the wyzecom case took multiple support rounds to attribute to the store-auth cache).

WHAT is this pull request doing?

  • Emits outputDebug lines when a stored store-auth session is:
    • adopted (store + scopes),
    • skipped because it's missing required scopes (has/needs),
    • skipped because it's expired (expiry timestamp).
  • Tokens are never logged.
  • Asserts the debug lines in the existing unit tests.

No changeset: debug-only output, no user-facing behavior change.

How to test your changes?

  1. shopify store auth --store <store> --scopes read_themes,write_themes
  2. shopify theme pull --store <store> --verbose — the debug output includes Using stored store auth session for <store> (scopes: ...).

Measuring impact

  • Existing analytics will cater for this addition

alfonso-noriega commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Jul 28, 2026
@alfonso-noriega
alfonso-noriega marked this pull request as ready for review July 28, 2026 14:56
@alfonso-noriega
alfonso-noriega requested review from a team as code owners July 28, 2026 14:56
Diagnosing why a theme command picked (or skipped) a stored store auth
session previously required tracing the code: the session source was
invisible in verbose output, which made support investigations slow.
Emit debug lines when a stored session is adopted, skipped for missing
scopes, or skipped as expired. Tokens are never logged.

Assisted-By: devx/60503589-d48c-43b2-8fba-b0df1e076f15
@alfonso-noriega
alfonso-noriega force-pushed the theme-store-auth-debug-logging branch from 23ade87 to 1fe2f2f Compare July 29, 2026 09:33
@alfonso-noriega
alfonso-noriega force-pushed the theme-store-auth-skip-expired branch from 6abd257 to 7bb01a9 Compare July 29, 2026 09:33
@github-actions

Copy link
Copy Markdown
Contributor

Differences in type declarations

We 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:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/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).

Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions

Copy link
Copy Markdown
Contributor

🫰✨ Thanks @alfonso-noriega! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260729111116

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

Base automatically changed from theme-store-auth-skip-expired to main July 29, 2026 14:37
@alfonso-noriega
alfonso-noriega added this pull request to the merge queue Jul 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 29, 2026
@alfonso-noriega
alfonso-noriega added this pull request to the merge queue Jul 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 29, 2026
@alfonso-noriega
alfonso-noriega added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit f45cb51 Jul 29, 2026
30 of 53 checks passed
@alfonso-noriega
alfonso-noriega deleted the theme-store-auth-debug-logging branch July 29, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants