Skip to content

Handle missing theme write access during theme creation#7941

Open
mbarak wants to merge 1 commit into
mainfrom
vault-31608-graphql-catchall
Open

Handle missing theme write access during theme creation#7941
mbarak wants to merge 1 commit into
mainfrom
vault-31608-graphql-catchall

Conversation

@mbarak

@mbarak mbarak commented Jun 27, 2026

Copy link
Copy Markdown

WHY are these changes introduced?

When theme commands create a development theme with an account or Admin API token that cannot access themeCreate, the Admin GraphQL API returns an ACCESS_DENIED error with requiredAccess details. fetchThemes and related read paths already map this shape to a friendly AbortError, but themeCreate still called adminRequestDoc directly and surfaced the raw GraphQL ClientError payload.

This addresses the latest-version write_themes / themeCreate tail under the linked issue; the broader Observe grouping also contains unrelated GraphQL failures that should be re-scoped separately.

WHAT is this pull request doing?

  • Routes themeCreate through the theme Admin request wrapper so missing theme access is reported with the existing friendly next steps.
  • Normalizes requiredAccess text that starts with The user needs ... so the rendered error sentence reads cleanly.
  • Adds a focused themeCreate regression test.

How to test your changes?

  • pnpm --filter @shopify/cli-kit vitest run src/public/node/themes/api.test.ts
  • pnpm --filter @shopify/cli-kit lint
  • pnpm --filter @shopify/cli-kit type-check

Resolves: https://github.com/shop/issues/issues/32995

Co-authored-by: Pi AI noreply@pi.dev

Route theme creation through the theme Admin request wrapper so ACCESS_DENIED responses use the existing friendly missing access error.

Normalize requiredAccess prose that starts with "The user needs" before embedding it in the user-facing message.

Co-authored-by: Pi AI <noreply@pi.dev>
Assisted-By: devx/a1027ad2-ceec-4016-b728-d7c842f1fe88
Copilot AI review requested due to automatic review settings June 27, 2026 03:40
@mbarak mbarak requested review from a team as code owners June 27, 2026 03:40
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Jun 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the UX for themeCreate failures when the authenticated identity lacks theme write access by routing the mutation through the existing theme Admin request wrapper that already converts ACCESS_DENIED + requiredAccess GraphQL errors into a friendly AbortError.

Changes:

  • Route themeCreate through requestThemeAdminDoc so missing theme access produces the established friendly error/next-steps instead of a raw GraphQL ClientError.
  • Normalize requiredAccess strings (strip trailing period and leading “The user needs …”) so the rendered error reads cleanly.
  • Add a regression test covering the themeCreate access-denied path, and include a changeset documenting the user-visible behavior change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/cli-kit/src/public/node/themes/api.ts Route themeCreate via the theme request wrapper and introduce requiredAccess formatting for cleaner abort messaging.
packages/cli-kit/src/public/node/themes/api.test.ts Add a regression test for friendly access-denied messaging and extend the test helper to support non-themes fields.
.changeset/friendly-theme-create-access-error.md Add a patch changeset describing the improved error behavior for denied theme creation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/cli @shopify/cli package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants