PoC: add a typed result contract for store:list - #8242
Draft
dmerand wants to merge 2 commits into
Draft
Conversation
Assisted-By: devx/48f80679-7765-44d2-aae2-f54bc011f8da
Assisted-By: devx/ecf1da3d-df27-457b-ba52-0a62492ff143
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.
PoC intent
This draft migrates one finite command,
store:list, toward a data-only execution result while preserving the current CLI behavior. The command still owns flag parsing and still returnsPromise<void>.Boundary
listStoresproduces typed data and does not print output.StoreListDocumentandencodeStoreListJsonform an explicit, store-owned codec boundary. The codec whitelists the existing JSON fields and excludes internal metadata such assource.presentStoreListResultis the explicit CLI presenter. It selects the JSON codec or the existing terminal rendering and keeps diagnostics on stderr.Compatibility proof
Focused tests cover the service, terminal presenter, and codec. The codec test asserts the exact formatted JSON document, optional-field omission, and exclusion of internal fields. Existing presenter tests continue to verify terminal text, JSON output, stderr notices, and truncation warnings.
Deliberately not done
BaseCommandchanges.JSON.stringify(result)behavior.store:listis migrated.Validation
pnpm --filter @shopify/store type-check: passed.git diff --check: passed.The type-check did not reproduce the reported pre-existing missing
@shopify/organizationsdeclaration failure in this checkout; no type errors were introduced by this change.Open decisions in this PoC
sourceremains internal and is explicitly excluded from JSON.