Skip to content

feat(shopping): suggest the next step after checkout get and other shopping commands - #366

Merged
jpage-godaddy merged 5 commits into
mainfrom
checkout-next-steps
Nov 6, 2026
Merged

jpage-godaddy merged 5 commits into
mainfrom
checkout-next-steps

Conversation

@jpage-godaddy

@jpage-godaddy jpage-godaddy commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

gddy shopping checkout get returned no next actions, so the flow dead-ended at the review step: checkout create and checkout update point at get, and nothing pointed on to checkout complete. It now suggests a next step based on the checkout session's state:

State Suggested next step
Ready, payment method selected shopping checkout complete <checkout-id>, with the agreement-review reminder and the AI assistants: note
Incomplete or ready, saved methods available but none selected shopping checkout update <checkout-id> --payment-instrument <instrument-id>
Incomplete or ready, no saved payment method payment-method add
Completed with an order shopping order get <order-id> --wait
Order still being placed (in progress, or completed without an order ID yet) shopping checkout get <checkout-id> again, noting the order can take a few seconds and must not be placed twice
Any other or unrecognised status none

Completion is only ever suggested for a ready checkout with a selected payment method.

No suggestion includes --agree or any other consent flag; completion stays gated on the explicit review.

Other shopping commands that ended without a next step now point onward:

  • catalog lookup suggests checkout create for the first available purchase option, matching catalog get and catalog search (they now share one helper).
  • catalog category suggests catalog search --category <category>.
  • checkout complete points at checkout get when the order ID is not returned straight away, and checkout get keeps suggesting a re-check until the order appears.

The shopping guide no longer says to avoid checkout get after an order is placed, since it now links to the order.

Completed-checkout behaviour relies on the completed status and order.id field described in the Shopping API spec; they have not been confirmed against a live completed session. An unrecognised status gets no suggestion.

Test plan

  • Unit tests for each checkout get state, including that no action contains --agree
  • Unit tests for the catalog lookup, catalog category and checkout complete actions
  • cargo check, cargo clippy --workspace -- -D warnings, cargo test --workspace, cargo fmt --check, check-module-size.sh

Resolves DEVEX-1277

🤖 Generated with Claude Code

…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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread rust/src/shopping/checkout/get.rs Resolved
Comment thread rust/src/shopping/checkout/get.rs Resolved
`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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the shopping next-step suggestion changes.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@sswaminathan-godaddy

Copy link
Copy Markdown
Collaborator

Could we retain the payment-method add suggestion for an incomplete checkout with no saved payment methods?

Reproduced on this branch in prod: shopping checkout create --item titanemail-light:1yr --currency USD returned Status: incomplete, no selected payment method, and a next step to run gddy payment-method add. Running shopping checkout get for the same session returned the same state but no next steps.

This is a gap in the new next-step guidance rather than a regression: main does not attach next actions to checkout get.

In checkout/get.rs, no_saved_payment_method_action currently runs only for ready_for_complete. Please also offer the add-payment suggestion for incomplete sessions with no saved methods, while keeping the completion suggestion restricted to ready_for_complete, and cover that state with a test.

@sswaminathan-godaddy sswaminathan-godaddy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved, added a suggestion

Comment thread rust/src/shopping/checkout/complete.rs Outdated
/// 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 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

jpage-godaddy and others added 2 commits November 6, 2026 12:39
…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>
@jpage-godaddy

Copy link
Copy Markdown
Collaborator Author

Thanks, @sswaminathan-godaddy. Fixed in 38688b6. checkout get now suggests payment-method add for an incomplete checkout with no saved payment methods, and completion is still only suggested for ready_for_complete with a selected payment method. I also made an incomplete checkout with saved but unselected methods suggest selecting one, so that case does not dead-end either. Tests cover both states.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

@jpage-godaddy
jpage-godaddy merged commit 72f25e8 into main Nov 6, 2026
4 checks passed
@jpage-godaddy
jpage-godaddy deleted the checkout-next-steps branch November 6, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants