Fetch preview store claim URL from GET request in store info#7929
Fetch preview store claim URL from GET request in store info#7929amcaplan wants to merge 3 commits 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
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() |
There was a problem hiding this comment.
Good catch — fixed in 62b09d1. The non-JSON success path now runs redactPreviewStoreRawText(rawText) before truncation, matching createPreviewStore. I also redacted the previewStoreGetError fallback (rawText.slice(0, 1000)), which had the same leak class.
Assisted-By: devx/77e7fd0b-38f4-44cb-aa92-23fda52bb067
Assisted-By: devx/77e7fd0b-38f4-44cb-aa92-23fda52bb067
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