Repository navigation
feat(shopping): suggest the next step after checkout get and other shopping commands - #366
Conversation
…opping commands `shopping checkout get` now suggests what to do next based on the checkout session's state: place the order when a payment method is selected, select a saved payment method when none is, add a payment method when none is saved, and review the order once the checkout is completed. A checkout that is not ready gets no completion suggestion, and no suggestion ever includes --agree. Other shopping commands that ended without a next step now point onward: `catalog lookup` suggests starting a checkout, `catalog category` suggests searching a category, and `checkout complete` points at the checkout session when the order ID is not returned straight away. The shopping guide no longer tells customers to avoid `checkout get` after placing an order, since it now links to the order. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Checkout guidance suggests adding a payment method for ineligible statuses, and the completed-order follow-up omits --wait, risking a transient 404 after a successful purchase.
2 open issues
What changed in this PR
This PR connects previously disconnected steps in the shopping CLI by adding follow-up actions for catalog browsing, checkout review, and order retrieval.
Changes:
- Adds checkout-state-based guidance while preserving explicit purchase consent.
- Adds catalog follow-ups and shares checkout-creation action construction.
- Adds an order-retrieval fallback, unit tests, and updated shopping guidance.
| File | Description |
|---|---|
rust/src/shopping/guides/shopping.md |
Documents retrieving an order ID through its checkout session. |
rust/src/shopping/checkout/get.rs |
Adds state-based next actions and tests. |
rust/src/shopping/checkout/create.rs |
Extracts the shared agreement-review reminder. |
rust/src/shopping/checkout/complete.rs |
Suggests retrieving the checkout when no order ID is returned. |
rust/src/shopping/catalog/search.rs |
Reuses the shared checkout-creation action. |
rust/src/shopping/catalog/mod.rs |
Defines the shared checkout-creation action helper. |
rust/src/shopping/catalog/lookup.rs |
Suggests checkout for the first available purchase option. |
rust/src/shopping/catalog/get.rs |
Reuses the shared checkout-creation action. |
rust/src/shopping/catalog/categories.rs |
Adds a category-search next action and tests. |
Review effort: Balanced
`checkout get` now suggests adding or selecting a payment method only for a checkout that is ready to place, so a canceled, in-progress or unrecognised checkout with no saved methods no longer points at `payment-method add`. The order suggested for a completed checkout waits for the order to become visible, matching the suggestion shown right after placing an order, so following it straight away no longer fails with a not-found error. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Could we retain the Reproduced on this branch in prod: This is a gap in the new next-step guidance rather than a regression: In |
sswaminathan-godaddy
left a comment
There was a problem hiding this comment.
approved, added a suggestion
| /// Points at the order once the API returns its ID; an accepted completion | ||
| /// without one is followed up through the checkout session, which links to the | ||
| /// order as soon as it exists. | ||
| fn order_follow_up_action(order_id: Option<String>, checkout_id: &str) -> cli_engine::NextAction { |
There was a problem hiding this comment.
If complete returns no order.id, we point at checkout get. For status=completed without order.id, get then suggests nothing, so the agent/user can loop with no progress. Can we have get suggest retrying get (or waiting) when completed-but-no-order, or soften this fallback description to say the order ID may take a few seconds and to re-run get until it appears.
There was a problem hiding this comment.
Good catch, thanks. Fixed in 38688b6. checkout get now suggests checking again (shopping checkout get <checkout-id>) for a completed checkout without an order ID and for complete_in_progress, with wording that the order can take a few seconds and must not be placed twice. The fallback in checkout complete uses the same action. For AI assistants the description asks them to check a few times at most and then report the order as still pending, so they don't loop indefinitely.
…ry pending orders `checkout get` suggests adding or selecting a saved payment method for an incomplete checkout as well as a ready one, matching `checkout create`, which reports a new checkout with no payment method as incomplete. Completion is still only suggested once the checkout is ready and a payment method is selected. When an order is still being placed, `checkout get` and `checkout complete` now suggest checking the checkout session again, noting that the order can take a few seconds to appear and must not be placed twice, instead of ending without a next step. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e guide Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks, @sswaminathan-godaddy. Fixed in 38688b6. |
There was a problem hiding this comment.
🔵 Needs a closer look
Live Shopping API behavior for completed sessions, order IDs, and delayed-completion polling remains unverified, requiring human validation before relying on purchase-recovery guidance.
No open issues 🎉
Review effort: Balanced

Summary
gddy shopping checkout getreturned no next actions, so the flow dead-ended at the review step:checkout createandcheckout updatepoint atget, and nothing pointed on tocheckout complete. It now suggests a next step based on the checkout session's state:shopping checkout complete <checkout-id>, with the agreement-review reminder and theAI assistants:noteshopping checkout update <checkout-id> --payment-instrument <instrument-id>payment-method addshopping order get <order-id> --waitshopping checkout get <checkout-id>again, noting the order can take a few seconds and must not be placed twiceCompletion is only ever suggested for a ready checkout with a selected payment method.
No suggestion includes
--agreeor any other consent flag; completion stays gated on the explicit review.Other shopping commands that ended without a next step now point onward:
catalog lookupsuggestscheckout createfor the first available purchase option, matchingcatalog getandcatalog search(they now share one helper).catalog categorysuggestscatalog search --category <category>.checkout completepoints atcheckout getwhen the order ID is not returned straight away, andcheckout getkeeps suggesting a re-check until the order appears.The shopping guide no longer says to avoid
checkout getafter an order is placed, since it now links to the order.Completed-checkout behaviour relies on the
completedstatus andorder.idfield described in the Shopping API spec; they have not been confirmed against a live completed session. An unrecognised status gets no suggestion.Test plan
checkout getstate, including that no action contains--agreecatalog lookup,catalog categoryandcheckout completeactionscargo check,cargo clippy --workspace -- -D warnings,cargo test --workspace,cargo fmt --check,check-module-size.shResolves DEVEX-1277
🤖 Generated with Claude Code