Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

ADR-005: Publish explicit basket cleanup outcomes

Checkout basket deletion publishes distinct completion and failure integration events so downstream workflows can recover deliberately.

October 21, 2026AcceptedReliability

1. Context & Problem

Once checkout passes a customer’s purchase intent to downstream order processing, the submitted BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs must be cleared so it cannot be reused by mistake. However, deleting the basket can fail on its own after the order has already started. Treating a failed cleanup as a success would leave an already-submitted cart active, while confusing a cleanup failure with a failed order would cause serious business and customer-support errors.

2. Business Value

  • Prevents accidental cart reuse: Confirms when a checked-out basket has been safely cleared.
  • Protects order integrity: Ensures a temporary cart cleanup issue is never misinterpreted as a failed order or failed payment.
  • Actionable failure recovery: Gives downstream teams and operations clear visibility when cleanup fails so they can trigger targeted recovery or follow-up steps.

3. How It Works

After checkout begins processing an order, it sends a cleanup request to delete the customer’s basket. If the deletion succeeds, the cart service announces a cleanup-completed outcome. If deletion fails, it announces a separate cleanup-failed outcome instead.

These two outcomes travel along separate communication channels so downstream systems and monitoring tools can tell successful cleanups apart from cases that need recovery. Neither announcement means that payment or order processing is finished, and a cleanup failure never cancels or alters ownership of the confirmed order. Because Finance may resend the cleanup request after a timeout—and Notification also listens to that request to send new-order emails—every receiving system must safely handle duplicate messages.

4. Trade-offs & Lessons Learned

  • Duplicate-safe consumers required: Because cleanup requests and outcome messages can be retried after timeouts, every downstream consumer (including both basket cleanup and order notification emails) must safely handle receiving the same message more than once.
  • Independent monitoring needed: Operations teams must monitor both the completion and failure channels separately to spot repeated outcomes and unresolved cleanup failures.
  • Outcome reporting, not delivery guarantees: Publishing explicit outcomes tells downstream systems what happened during cleanup, but it does not guarantee single-attempt execution or prescribe a specific retry schedule.

5. Technical Reference