Fall back to local validation when a remote contract cannot be compiled - #8477
Closed
alfonso-noriega wants to merge 1 commit into
Closed
Fall back to local validation when a remote contract cannot be compiled#8477alfonso-noriega wants to merge 1 commit into
alfonso-noriega wants to merge 1 commit into
Conversation
A server-provided validation schema that fails normalisation (broken $ref) or AJV compilation (e.g. an empty enum, which some environments render when the data backing it is empty) crashed every app command at load time, inside createConfigExtensionInstances - including for apps that do not use the affected module at all. unifiedConfigurationParserFactory now degrades per module: an unusable contract logs a once-per-process warning naming the module and reason, and parsing falls back to the CLI's local zod schema. The server still validates on deploy, so nothing ships unvalidated. Repro: any app command against a shop/world rig whose custom-data spec renders "enum": [] for standard metaobject templates (empty taxonomy registry). Server-side fix for that instance: shop/world#1016890. Assisted-By: pi Assisted-By: devx/3210d700-6e94-4dca-95ca-6372c5535f56
Contributor
Author
|
Closing — the triggering issue is rig-local; withdrawing for now. |
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.
WHY are these changes introduced?
A server-provided module validation schema that AJV cannot compile crashes every
shopify app *command at load time — including for apps that don't use the affected module at all.createConfigExtensionInstancesparses the app config against every remote app-config spec, so one bad contract takes down the whole CLI for that environment.Live repro: any app command against a
shop/worldlocal rig whose custom-data spec renders"enum": []for standard metaobject templates (empty taxonomy registry — emptyenumis invalid JSON Schema):The server-side instance of that bug is fixed in shop/world#1016890, but the CLI shouldn't hard-fail on data it doesn't control: a malformed contract for one module should degrade, not brick
app info.WHAT is this pull request doing?
unifiedConfigurationParserFactorynow degrades per module when a contract is unusable:$ref): fall back to the merged spec's local zod parser for that modulejsonSchemaValidatecall, e.g. empty enum): return the zod parse result for that calloutputWarnonce per module identifier per process, naming the module and the underlying reason — and noting the server still validates on deploy, so nothing ships unvalidatedHow to test your changes?
pnpm vitest run packages/app/src/cli/utilities/json-schema.test.ts— 3 new tests: empty-enum contract → zod result + single warning (deduped on repeat calls); zod errors still gate when the contract is broken; broken$ref→ factory returns the local parsershopify app infoloads with a warning instead of crashingMeasuring impact