ADR-003: Keep Order status separate from Finance saga state
Ordering owns the Order's business status, while Finance owns checkout coordination state; basket cleanup outcomes do not implicitly complete or cancel an Order.
1. Context & Problem
Placing an OrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs kicks off a separate coordination workflow in Finance SystemSystemv1.0.0Finance SystemInternal BookWorm workflow system that coordinates post-checkout basket cleanup and order notifications through Durable ...Ownercommerce-fulfillment-teamDiagramOpen docs to handle follow-up tasks such as clearing the customer’s shopping basket and triggering notifications. Those operational steps can succeed, retry, or fail independently of the business lifecycle of the accepted order.
If the outcome of that follow-up workflow automatically changed an order’s business status, technical cleanup steps would overwrite business decisions. For example, successfully emptying a shopping basket does not mean an order has been fulfilled and completed, nor should a retry failure in basket cleanup silently mark an order as cancelled without Ordering validating the business transition.
2. Business Value
- Unambiguous business status: Stakeholders, customers, and support teams can trust that “Completed” and “Cancelled” reflect deliberate business transitions validated by Ordering, not side effects of background housekeeping.
- Resilient failure handling: Operational hiccups in basket cleanup or notifications do not corrupt an order’s official business state.
- Independent system evolution: Ordering and Finance teams can modify their internal workflows, retry policies, and recovery rules without tightly coupling their state machines.
3. How It Works
OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs remains the sole authority for an order’s business status, while Finance SystemSystemv1.0.0Finance SystemInternal BookWorm workflow system that coordinates post-checkout basket cleanup and order notifications through Durable ...Ownercommerce-fulfillment-teamDiagramOpen docs owns its separate coordination workflow state. The two systems communicate through explicit business announcements rather than directly mutating each other’s records.
- When an order is placed, Ordering announces the checkout so Finance can start its coordination workflow.
- Basket cleanup outcomes do not change business status: a successful basket deletion does not mark an order as completed, and a failed or exhausted basket-deletion workflow does not mark it as cancelled.
- If basket cleanup fails, Finance’s outcome may be logged or result in the matching order being hidden via soft deletion, without changing its underlying business status.
- An order only moves from “New” to “Completed” or “Cancelled” when Ordering explicitly accepts and validates that status change, after which Ordering announces the change so Finance can advance its workflow and trigger follow-up actions.
4. Trade-offs & Lessons Learned
Alternatives Considered
- Let Finance set Order status after cleanup: Rejected because an external coordination outcome would bypass the validation rules owned by the Order aggregate.
- Treat basket deletion success as Order completion: Rejected because clearing a submitted basket only confirms housekeeping finished, not that the order’s business lifecycle is complete.
- Use one shared lifecycle state for the Order and saga: Rejected because it tightly couples state transitions and failure recovery across two distinct systems.
Operational Trade-offs & Risks
- Legitimate state divergence: An order can remain in the “New” status even when the corresponding Finance workflow has finished or been cancelled. Downstream consumers must read the order directly when they need its true business status.
- Soft deletion vs. business status: Operational soft deletion (such as hiding an order after a failed basket cleanup) is distinct from business cancellation or completion—a soft-deleted order is not considered completed or cancelled.
- Dual-view troubleshooting: Monitoring and support teams must inspect the Order and the Finance workflow independently, correlating the two by Order ID rather than assuming one mirrors the other.
5. Technical Reference
- Ownership split: OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing,
and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs (Order SystemSystemv1.0.0Order SystemInternal system that creates and manages accepted customer Orders, preserving
purchase-time items and prices while ownin...Ownercommerce-fulfillment-teamDiagramOpen docs / 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) owns the
Orderaggregate business status (New,Completed,Cancelled); Finance SystemSystemv1.0.0Finance SystemInternal BookWorm workflow system that coordinates post-checkout basket cleanup and order notifications through Durable ...Ownercommerce-fulfillment-teamDiagramOpen docs owns its checkout coordination saga state. - Integration contracts:
UserCheckedOutIntegrationEvent— published by Ordering upon placement; consumed by Finance to start the saga.OrderStatusChangedToCompleteIntegrationEvent— published by Ordering only after an explicit completion transition on an eligibleNewOrder.OrderStatusChangedToCancelIntegrationEvent— published by Ordering only after an explicit cancellation transition on an eligibleNewOrder.
- Non-mutating outcomes: Downstream consumers must not infer
CompletedorCancelledfrom basket cleanup, retry exhaustion, or notification requests. Failed basket deletion may be logged or trigger Order soft deletion, which remains separate from business status. - Correlation: Support and observability tooling must correlate Order records and Finance saga instances by Order ID.