Skip to content

PoC: typed result contract for store execute - #8243

Draft
dmerand wants to merge 1 commit into
mainfrom
donald/store-execute-result-contract-poc
Draft

PoC: typed result contract for store execute#8243
dmerand wants to merge 1 commit into
mainfrom
donald/store-execute-result-contract-poc

Conversation

@dmerand

@dmerand dmerand commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Intent

This draft is a proof of concept for migrating the finite store execute command to a data-only typed result contract. It keeps execution facts separate from CLI output adapters.

Design

  • StoreExecuteResult contains JSON-safe operation data and an optional coded failure.
  • The codec owns JSON wire encoding. With --output-file, the file contains the operation payload; JSON stdout contains a structured sink document.
  • The presenter owns terminal output, file writing, and unsuccessful result classification.
  • GraphQL transport errors remain execution-level failures: no result document exists and the existing error boundary handles them.
  • GraphQL responses containing nested userErrors are result-level failures: data is emitted and the command exits unsuccessfully with code USER_ERRORS.

Explicit output decisions

  1. User-error responses: Before, a response with userErrors was reported as success. After, the operation payload is emitted and the command exits unsuccessfully; JSON remains data-only and does not add English sentences.
  2. JSON plus --output-file: Before, the payload was written to the file and stdout was empty. After, stdout emits a JSON sink document containing outputFile, success, and (on failure) failureCode; the file still contains only the operation payload.

No other command output was changed. --allow-mutations remains input safety policy and is not part of the result contract or codec.

Deliberately not done

  • No BaseCommand or launcher changes.
  • No automatic serialization.
  • No event plumbing or diagnostics channel.
  • No migration of other commands.
  • No shared store schemas in @shopify/cli-kit.

Validation

  • Focused Vitest and added wire/result-level-failure tests: not completed in this PoC checkout.
  • Changed-file ESLint: initially found and fixed formatting/order issues; final run was interrupted by dependency type-check command.
  • pnpm --filter @shopify/store type-check: blocked by unresolved local @shopify/cli-kit declarations and Node globals despite dependency builds; these are environment/dependency build issues, not reported as clean.
  • git diff --check: run before commit.

Assisted-By: devx/44d59e1d-1ea0-4691-81ad-7784225a5dc4
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Aug 3, 2026
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.

1 participant