Order change checklist
Pre-merge engineering checklist for Ordering API, Finance orchestration, persistence, and contract changes.
Purpose & Scope
This checklist defines the mandatory contract, lifecycle, persistence, concurrency, and verification checks for engineers modifying 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 or Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs in the OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs subdomain. Review it before merging changes to HTTP v1 routes, Kafka messages, Order DatabaseContainerv1.0.0Order DatabaseAuthoritative PostgreSQL system of record owned by the Ordering bounded context for buyers, accepted orders, purchase-ti...Ownercommerce-fulfillment-teamDiagramOpen docs schemas, or Redis coordination.
Visual Reference
The visual below contrasts authoritative 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 status transitions with independent Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs saga states.
Loading graph...
Order Status and Finance Orchestration State Transitions
Core Invariants & Design Rules
- Terminal status immutability: Only a
NewOrderEntityv1.0.0OrderDurable purchase record owned by a Buyer, capturing immutable purchase-time line items and governing order lifecycle tra...Ownercommerce-fulfillment-teamOpen docs can transition toCompletedorCancelled; terminal states can never reopen or switch. - Locked purchase snapshot: Each Order ItemEntityv1.0.0Order ItemChild entity within an Order capturing a purchased book identifier, positive quantity, and locked checkout-time unit pri...Ownercommerce-fulfillment-teamOpen docs stores
BookId, a positive quantity, and checkout unit price (PriceSale ?? Price), with the order total equal to the sum of recorded line totals. - Authorization & rate-limit boundaries: Preserve Microsoft Entra ID
customerandadminpolicies (ordering_read,ordering_writescopes, admin-only delete and summary endpoints) andPerUserRateLimit. - Privacy & correlation: Keep buyer street addresses and personal data out of routine logs and error payloads; correlate checkout and saga traces by
OrderIdand W3C trace context.
Do not conflate soft deletion or saga timeout with Order.Status = Cancelled. 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 soft-deletes the order while leaving Status as New, and Finance timeout exhaustion cancels only the finance-taskhub orchestration.
Boundaries & Guarantees
| Concern | Strategy & Guarantee | Failure / Edge-Case Behavior | Related Resources |
|---|---|---|---|
| Persistence | EF Core migrations in order-database use snake_case identifiers; Marten event streams and Wolverine outbox/inbox tables commit atomically with Order writes. | Missing migrations or unaligned Marten event types break audit history (GET /api/v1/orders/{id}/history) and projections (OrderSummary, OrderSummaryView). | order-database, order, buyer |
| Caching & Locks | order-create:{userId} (60s TTL) guards PostgreSQL Order writes; {METHOD}:{PATH}:{x-request-id} (3600s TTL) deduplicates POST/PATCH calls. | Duplicate x-request-id returns 409 Conflict; unhandled exceptions or >= 500 responses clear the idempotency marker so clients can safely retry. | order-cache, CreateOrder |
| Messaging | Outbound events (UserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent, OrderStatusChangedToCancelIntegrationEvent) and inbound basket-cleanup commands are partitioned by OrderId and Pact-verified. | Breaking CloudEvents schemas fail Ordering-Finance or Finance-Ordering Pact suites or route messages to <code>bookworm.{env}.ordering.dead-letter-queue</code>. | <code>bookworm.{env}.ordering.user-checked-out</code>, <code>bookworm.{env}.ordering.order-status-change-to-complete</code>, <code>bookworm.{env}.ordering.order-status-change-to-cancel</code>, <code>bookworm.{env}.ordering.dead-letter-queue</code> |
| Concurrency | Buyer-scoped distributed lock prevents concurrent checkout races; 24h Redis idempotency guard deduplicates inbound Kafka commands. | Lock contention aborts the competing checkout attempt cleanly without creating duplicate orders. | order-api, order-orchestration, adr-003-separate-order-status-from-finance-saga |
Safe Change & Verification Checklist
Pre-merge verification workflow
Verify HTTP v1 and gRPC consumer compatibility
Update OpenAPI v1 metadata for any changes to
/api/v1/orders,/api/v1/buyers, or/api/v1/dashboard, and confirm compatibility with Get basket over gRPCQueryv1.0.0Get basket over gRPCReturns the current basket through the basket.v1 gRPC contract.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs (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) and Get books over gRPCQueryv1.0.0Get books over gRPCReturns multiple Catalog books by identifier through the book.v1 gRPC contract.Ownercatalog-experience-teamSchemaDiagramOpen docs (Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs).Validate Kafka contracts and Pact suites
Keep CloudEvents schemas partitioned by
OrderIdand verify bothOrdering-FinanceandFinance-OrderingPact contracts for checkout, completion, cancellation, and basket-cleanup messages.Check lifecycle, snapshot, and persistence invariants
Confirm
New→Completed|Cancelledimmutability, checkout price snapshotting,snake_casemigrations in Order DatabaseContainerv1.0.0Order DatabaseAuthoritative PostgreSQL system of record owned by the Ordering bounded context for buyers, accepted orders, purchase-ti...Ownercommerce-fulfillment-teamDiagramOpen docs, Marten projection compatibility, andx-request-id/order-create:{userId}guards.Run formatting, build, and test suites
Execute
mise run format,mise run build, andmise run testto verify Ordering unit tests, architecture tests, and Pact contract tests pass.
Related Resources
- 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 — Authoritative Ordering REST API
- Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs — Finance post-checkout saga
- Create orderCommandv1.0.0Create orderCreates an Order for the authenticated Buyer using the current basket and Catalog pricing.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Complete orderCommandv1.0.0Complete orderMarks an existing Order as Completed when its current status is New.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Cancel orderCommandv1.0.0Cancel orderMarks an existing Order as Cancelled when its current status is New.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Delete orderCommandv1.0.0Delete orderSoft-deletes an Order by its identifier without changing its business status.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs — Order lifecycle commands
- Get orderQueryv1.0.0Get orderReturns Order details, including the recorded item quantities and prices.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, List ordersQueryv1.0.0List ordersReturns Orders with pagination and optional status and Buyer filters.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, Get buyerQueryv1.0.0Get buyerReturns the Buyer profile selected by identifier, subject to the caller's authorization.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs, List buyersQueryv1.0.0List buyersReturns Buyer profiles with pagination.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs — Order and buyer queries
- Order Lifecycle and Status TransitionsFlowv1.0.0Order Lifecycle and Status TransitionsCheckout creates a New Order owned by Ordering API, Finance coordinates post-order cleanup and notifications, and explic...Ownercommerce-fulfillment-teamView flowOpen docs, Order LifecycleDiagramv1.0.0Order LifecycleBusiness status lifecycle of an accepted Order showing creation in the New state and irreversible transitions to Complet...Ownercommerce-fulfillment-teamOpen diagram — Order lifecycle flow and visual model
- API and contracts indexCustom DocAPI and contracts indexConsolidated index of BookWorm HTTP v1, gRPC, AG-UI, MCP, A2A, and Kafka/Wolverine contracts grouped by service with aut...Ownerplatform-engineering-teamOpen doc — Consolidated HTTP, gRPC, and Kafka contracts