Recover a failed basket cleanup
Operational procedure for investigating and recovering a failed basket deletion after checkout.
Trigger / Symptom & Blast Radius
Basket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets, Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs publishes Basket deletion failedEventv1.0.0Basket deletion failedIndicates that Basket could not delete the submitted basket during checkout cleanup. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs on <code>bookworm.{env}.basket.delete-failed</code>, Place orderCommandv1.0.0Place orderShared Finance order-placement command consumed by Notification to render and submit a new-order email. Ownerplatform-engineering-teamSchemaDiagramOpen docs messages land in <code>bookworm.{env}.basket.dead-letter-queue</code>, or a customer’s BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs remains in Basket DatabaseContainerv1.0.0Basket DatabaseAuthoritative Redis key-value store owned by the Shopping bounded context for customer-scoped pre-checkout shopping bask...Ownercommerce-fulfillment-teamDiagramOpen docs after checkout. Blast radius is post-checkout basket state; always verify the downstream OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs in Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs before deleting any basket.
Never delete a customer’s basket until you confirm the downstream order was accepted in Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs. If the order status is ambiguous or missing, stop immediately and escalate.
Pre-Flight Check
Verify the downstream order status in Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle,
creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs and check Basket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets,
Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs logs in <ENV>:
curl -sS -H "Authorization: Bearer <ADMIN_TOKEN>" "https://<GATEWAY_HOST>/ordering/api/v1/orders/<ORDER_ID>"az containerapp logs show --name <SERVICE_NAME> --resource-group <RESOURCE_GROUP> --tail 150Quick Recovery Procedure
Distinguish the two failure modes
Inspect Basket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets, Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs logs, Basket DatabaseContainerv1.0.0Basket DatabaseAuthoritative Redis key-value store owned by the Shopping bounded context for customer-scoped pre-checkout shopping bask...Ownercommerce-fulfillment-teamDiagramOpen docs key
basket:<CUSTOMER_ID>, and Kafka topics (<code>bookworm.{env}.finance.place-order</code>, <code>bookworm.{env}.basket.delete-failed</code>, <code>bookworm.{env}.basket.dead-letter-queue</code>):Mode A (Key already absent): Redis was reachable, but the basket key was already gone. Finance reacts by sending Handle basket deletion failedCommandv1.0.0Handle basket deletion failedReports Finance's failed basket-cleanup outcome so Order API can soft-delete the affected Order. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs to Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs, which soft-deletes the order (
404 Not Found).Mode B (Transient Redis/broker exception): Redis failed during deletion, releasing the 24-hour
OrderIdidempotency guard and routing Place orderCommandv1.0.0Place orderShared Finance order-placement command consumed by Notification to render and submit a new-order email. Ownerplatform-engineering-teamSchemaDiagramOpen docs to the DLQ while the basket remains in Redis.Execute the matching recovery path
Mode B (Order accepted and
New, basket still in Redis): Restore Redis / Basket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets, Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs health, then replay Place orderCommandv1.0.0Place orderShared Finance order-placement command consumed by Notification to render and submit a new-order email. Ownerplatform-engineering-teamSchemaDiagramOpen docs from <code>bookworm.{env}.basket.dead-letter-queue</code> to <code>bookworm.{env}.finance.place-order</code> so Basket deletion completedEventv1.0.0Basket deletion completedIndicates that Basket successfully deleted the submitted basket during checkout cleanup. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs is emitted cleanly.Mode A (Order soft-deleted
404) or ambiguous outcome: Stop without modifying Redis or issuing manual order transitions, and escalate with<ORDER_ID>,<CUSTOMER_ID>, and event timestamps.
Verification
Confirm the basket is absent for the customer and Basket deletion completedEventv1.0.0Basket deletion completedIndicates that Basket successfully deleted the submitted basket during checkout cleanup. Ownercommerce-fulfillment-teamSchemaDiagramOpen docs was emitted on <code>bookworm.{env}.basket.delete-complete</code>:
curl -sS -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer <CUSTOMER_TOKEN>" "https://<GATEWAY_HOST>/basket/api/v1/baskets"Expected output:
404Rollback / Escalation
- Rollback: Do not restore deleted baskets after confirmed checkout; customers can add new items anytime.
- Escalation: Escalate Mode A soft-deleted orders or ambiguous checkout outcomes to Commerce Fulfillment TeamTeamCommerce Fulfillment TeamStream-Aligned team owning customer shopping baskets, checkout coordination, order lifecycle, and financial saga orchest...Open docs; escalate Redis outages to Platform Engineering TeamTeamPlatform Engineering TeamPlatform team providing BookWorm's thinnest viable platform—orchestration, messaging fabric, scheduling, notifications, ...Open docs.
Related documentation
- User CheckoutFlowv1.0.0User CheckoutAn authenticated customer checks out a persisted basket through Ordering API; Finance coordinates asynchronous basket cl...Ownercommerce-fulfillment-teamView flowOpen docs — End-to-end checkout and cleanup flow.
- ADR-005: Publish explicit basket cleanup outcomesDecision Recordv1.0.0ADR-005: Publish explicit basket cleanup outcomesCheckout basket deletion publishes distinct completion and failure integration events so downstream workflows can recove...Ownercommerce-fulfillment-teamOpen docs — Explicit cleanup outcome events.