[Prototype] Add shopify app channel-spec generate for partner channel spec export - #8360
Draft
suzkiee wants to merge 2 commits into
Draft
[Prototype] Add shopify app channel-spec generate for partner channel spec export#8360suzkiee wants to merge 2 commits into
shopify app channel-spec generate for partner channel spec export#8360suzkiee wants to merge 2 commits into
Conversation
Generates a deployable channel_config spec TOML from the Shopify-authored
default channel specification. The TOML is produced and validated server-side
by the Channels-owned exporter; the CLI handles app context, transport, and
local file UX only.
- shopify app channel-spec generate writes extensions/channel-config/specifications/<handle>.toml
- --stdout prints only the TOML (warnings go to stderr)
- --overwrite required to replace an existing file
- Backend warnings ({code, message}) are rendered out-of-band, never into the TOML
- Failure reason codes map to partner-facing guidance
…el spec fetch
- A 404 is not part of the export contract (failures are 422 with a
reason code), so stop mapping it to no_exportable_frozen_record and
abort with an endpoint-unavailable message instead.
- Validate that backend warnings are {code, message} objects before
rendering them, dropping malformed entries.
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.
Note
Draft / directional prototype — the backend endpoint this calls is not shipped yet.
WHY are these changes introduced?
Legacy channel apps need a migration path onto partner-owned
channel_configextension specs. Shopify already has app-level FrozenRecord fallback specs for some legacy channels. Partners need a safe way to receive a deployable, partner-owned copy of the public parts of that spec.The Channels team is prototyping two surfaces over one canonical, Channels-owned exporter (
Channels::PartnerChannelSpecExport, shop/world#2007891):WHAT is this pull request doing?
Adds a new command:
Flow:
linkedAppContext(standard--path/--client-id/--config/--resetflags).services/channel-spec/fetch.ts) that delegates to the canonical Channels exporter. The CLI never transforms or validates spec fields — the backend response is the deployable artifact.extensions/channel-config/specifications/<handle>.toml(creates directories as needed).Behavior details:
--overwriteis passed.--stdoutprints only the TOML to stdout (pipeable); warnings go to stderr.{code, message}, e.g.automatic_product_feed_management) render out-of-band — never written into the TOML.no_exportable_frozen_record,multiple_exportable_records,not_allowlisted,contains_no_public_fields,invalid_public_schema.shopify app deployas the next step.Files:
packages/app/src/cli/commands/app/channel-spec/generate.tspackages/app/src/cli/services/channel-spec/generate.tspackages/app/src/cli/services/channel-spec/fetch.tspackages/app/src/cli/services/channel-spec/generate.test.tsindex.ts+ generated filesDesign constraints (from the prototype design doc)
channel_configvalidation contract; the exporter fails closed otherwise.--specification-handle <handle>flag is reserved for future multi-spec support and intentionally not included here.What we'd like the dev tools team's steer on
app_management/unstable/organizations/:orgId/apps/:id/channel_spec_export.json, contract per shop/world#2007902 —{success, handle, filename, toml, warnings}/ 422{error: "not_exportable_yet", reason}). Should this instead be a GraphQL operation on App Management, a wrapper API, or a CLI-owned route? The only hard requirement: it must invoke the canonical Channels exporter.app channel-spec generatevs. something else in the topic tree.channel_spec_export_cli_invoked/succeeded/failedevents withapp_id,spec_handle,surface,result,failure_reason_code,warning_typesdimensions (never logging manifest contents). What's the right way to emit these from the CLI — existing command metadata hooks or custom events?How to test your changes?
End-to-end tophatting is not possible yet — the backend endpoint hasn't shipped. Verified locally:
pnpm vitest run packages/app/src/cli/services/channel-spec/generate.test.ts--overwrite,--stdoutpurity, out-of-band warnings, failure mapping)pnpm nx run app:type-checkpnpm eslinton changed filespnpm refresh-manifests/pnpm build-dev-docsNo changeset added — this is a prototype and not ready for public release notes.
Post-release steps
None — not releasable until the backend contract is agreed and shipped; rollout will be staff-gated/allowlisted per the prototype rollout plan.