Conversation
When a theme command skips a stored store auth session and then falls back to device authentication, the skip reason only appeared with --verbose. Device authentication cannot replace a preview store session, so the user had no way to see why the stored session was ignored. Attach the reason and a recovery step to the next steps of the authentication error. Assisted-By: devx/e5be4a75-315f-44ac-9b24-78944589ddd8
Thread the store auth session result through the multi-environment pre-pass, so an environment no longer re-reads the cached session after validation discarded the skipped reason. Preserve the original AbortError when attaching next steps, so an error subclass and its extra fields survive. Give an expired preview session no `store auth` advice, which cannot run while a preview session is present. Trim the standard-session advice to the `--password` recovery step. Add tests for the preview scope bypass, each skip reason, error identity, non-AbortError pass-through, and single derivation in multi-environment commands. Correct the changeset wording. Assisted-By: devx/e5be4a75-315f-44ac-9b24-78944589ddd8
There was a problem hiding this comment.
🟡 Changes recommended
Three unresolved moderate issues affect error propagation and recovery guidance.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR improves theme authentication errors by explaining skipped cached sessions and suggesting recovery actions.
Changes:
- Records expired, standard, and insufficient-scope session reasons.
- Adds contextual recovery steps to authentication errors.
- Adds regression tests and a patch changeset.
Review findings:
- Moderate (2 votes): Multi-environment errors drop
AbortError.nextSteps. - Moderate (1 vote):
theme profilecannot recover using--password. - Moderate (2 votes): Expired-session advice is invalid for commands without
storeAuthScopes().
File summaries
| File | Summary |
|---|---|
packages/theme/src/cli/utilities/theme-command.ts |
Tracks skipped sessions and enriches authentication errors. |
packages/theme/src/cli/utilities/theme-command.test.ts |
Tests session reuse, skip reasons, and error propagation. |
.changeset/name-skipped-store-auth-session.md |
Documents the user-facing patch release. |
Review details
Suppressed comments (1)
packages/theme/src/cli/utilities/theme-command.ts:465
theme profilealso takes this no-scope path, but its service rejects every--passwordvalue (packages/theme/src/cli/services/profile.ts:25-30). Following this new recovery step therefore leads to another error instead of recovering; the advice needs to be omitted or specialized for commands that cannot use a password.
return {skipped: {reason, advice: 'Pass a Theme Access password with `--password`.'}}
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const store = flags.store as string | ||
| await useThemeStoreContext(store, async () => { | ||
| const session = requiresAuth ? await this.createSession(flags, storeAuthSession) : undefined | ||
| const session = requiresAuth ? await this.createSession(flags, storeAuthResult) : undefined |
| advice: isPreviewSession | ||
| ? undefined | ||
| : `Run \`shopify store auth --store ${storeFqdn}\` to store a fresh session.`, |
|
/snapit |
|
🫰✨ Thanks @gonzaloriestra! 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-20260917115034Caution After installing, validate the version by running |
|
I've converted this one to a draft while I revisit the scope of this change. The downstack PR is the more important unblocker. |
WHY are these changes introduced?
Stacked on #8546.
When a theme command skips a stored store auth session and falls back to device authentication, it reports the skip reason only through
outputDebug. Without--verbose, the user cannot see that a session sat in the cache. A device login cannot replace a preview store session, so the silent fall-through costs the user all recovery options.WHAT is this pull request doing?
AbortError.The recovery step matches the reason. A standard session points to
--password. Missing scopes point toshopify store auth --scopes.How to manually test your changes?
Seed a standard session with
scopes: ['read_products'], whichtheme pullrejects, then run the command.Result with this branch:
Result on
main: the same error without the two next steps.Checklist
patch) and added a changeset