Fetch preview store claim URL from GET request in store info#7929
Open
amcaplan wants to merge 1 commit into
Open
Fetch preview store claim URL from GET request in store info#7929amcaplan wants to merge 1 commit into
amcaplan wants to merge 1 commit into
Conversation
Following shop/world#863938, GET /services/preview-stores/:id now returns claim_url alongside access_url. store info no longer makes a separate POST .../claim request, reducing backend calls from two to one and removing the now-redundant claim code path. Assisted-By: devx/77e7fd0b-38f4-44cb-aa92-23fda52bb067
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the preview-store store info flow to use the claim_url returned by GET /services/preview-stores/:id, removing the now-redundant claim POST request and aligning CLI behavior with the backend’s “degrade gracefully” semantics when claim minting fails.
Changes:
- Simplifies
store infopreview-store URL fetching to a singlegetPreviewStorecall and makessaveUrloptional. - Extends the preview-store GET client response shape to include optional
claimUrl, and removes the legacy claim request path. - Updates tests to assert
claim_urlhandling (including the degradednullcase) and removes dead claim tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/store/src/cli/services/store/info/index.ts | Removes claim POST usage; populates optional saveUrl from claim_url returned by GET. |
| packages/store/src/cli/services/store/info/index.test.ts | Updates expectations to match single-request flow; adds coverage for degraded/missing claim URL. |
| packages/store/src/cli/services/store/create/preview/client.ts | Adds claim_url parsing to GET response; removes claim endpoint/client code; renames authenticated headers helper. |
| packages/store/src/cli/services/store/create/preview/client.test.ts | Removes claim endpoint tests; adds GET claim_url assertion and null degradation coverage. |
Comments suppressed due to low confidence (1)
packages/store/src/cli/services/store/create/preview/client.ts:255
previewStoreGetErrorreturnsrawTextdirectly intryMessage, which can leak sensitive URLs/tokens (and now potentiallyclaim_url) in error output. UseredactPreviewStoreRawText(rawText)before truncating, consistent with the create error path.
function previewStoreGetError(status: number, rawText: string): {message: string; tryMessage?: string} {
const parsed = parseErrorBody(rawText)
return {
message: `Preview store lookup failed with HTTP ${status}.`,
tryMessage: parsed.message ?? (rawText.length > 0 ? rawText.slice(0, 1000) : 'No response body returned.'),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| headers: previewStoreAuthenticatedHeaders(getOrCreateCliInstanceId(options.storage), request.adminApiToken), | ||
| }) | ||
|
|
||
| const rawText = await response.text() |
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.
What this does
Following backend shop/world#863938,
GET /services/preview-stores/:idnow returnsclaim_urlalongsideaccess_url. As a result,shopify store infono longer needs a separatePOST .../claimrequest to obtain the claim ("Save your progress") URL.This:
store infofaster — one backend request instead of two (the previousPromise.allofclaimPreviewStore+getPreviewStoreis now a singlegetPreviewStorecall).Changes
packages/store/src/cli/services/store/create/preview/client.tsgetPreviewStorenow readsclaim_urlfrom the GET response and returns it as an optionalclaimUrl. The backend degradesclaim_urltonullon a BP mint failure, so it's treated as absent rather than an error.claim_url.claimPreviewStore,PreviewStoreClaimRequest,PreviewStoreClaimResponse,RawPreviewStoreClaimResponse,narrowClaimResponse,previewStoreClaimError, andredactPreviewStoreClaimResponse.previewStoreClaimHeaderstopreviewStoreAuthenticatedHeaders(now only used by the authenticated GET).packages/store/src/cli/services/store/info/index.tsfetchPreviewStoreUrlsmakes a singlegetPreviewStorecall;saveUrlis populated frompreviewStore.claimUrlwhen present.Tests —
client.test.tsandindex.test.ts: removed dead claim tests, added aclaim_urlassertion to the GET test, and added coverage for the degraded (nullclaim URL leads to nosaveUrl) path.Behavior note
Previously, a claim-mint failure threw and aborted
store info. Now (matching the backend's intentional design) it degrades gracefully:store infostill shows the store and access URL, just without the "Save your progress" link.No changeset
Preview stores aren't a publicized feature yet, so this change doesn't need a public changelog entry.
Testing