Skip to main content

EventStorming

Built on develop, not deployed

Derived from model/model.yaml. The shopping-cart service is built on develop (IQVO/shopping-cart at 95bc5bc, checked 2026-10-27) and not deployed (no warehouse-infra entry). Every Err... name, REST route and CloudEvents type of this context named on this page exists in the service; where the built service differs from the model's design, the page says so (As built) or the context's Service and operations section lists it.

Process-level boards in the ddd-crew EventStorming glossary & cheat sheet notation. Every sticky comes from model.yaml. Events published by a neighbour are drawn as orange stickies prefixed with the producer. Every hotspot is a gap or a risk the model itself shows, and its source is given in the hotspot table. Boards are drawn left to right; each stays within the page width.

Legend​

ColourStickyMeaning here
Pale yellow #fff59dActorThe shopper (through the BFF), the clock
Blue #a5d8ffCommandA command from aggregates[Cart].commands
Yellow #ffec99AggregateThe Cart aggregate and its held quote
Orange #ffc078Domain EventOurs (publishes) or a neighbour's (consumes, prefixed with the producer)
Lilac #d0bfffPolicypolicies, or the reaction a command takes to an event
Green #b2f2bbRead ModelPurchasabilityView, EstimateView, CheckoutReadiness, a read route
Pink #fcc2d7External SystemA sibling context or the network (pricing, offer-availability, delivery-promise, checkout, analytics)
Red #ff8787HotspotA gap or risk in the model (see the table at the end)

1. Cart building​

Derived from: model.yaml → contexts[shopping-cart].inbound (BFF cmd row), .aggregates[Cart].commands + .invariants, .publishes[CartLineAdded], .read_models[PurchasabilityView].

Omitted: the invariant errors on the add path (ErrQuantityOutOfRange, ErrTooManyLines, ErrItemNotPurchasable, ErrCartClosed on a closed cart, ErrMergeTarget on a bad merge target) and the outbox. Adding an existing item merges quantities into the one line; nothing is rejected as a duplicate. Only AddLine publishes, by design: analytics needs add, quote, abandon and checkout. Every mutating command on this board except AcceptRequotedOffers also clears the quote and the selections (business decision 3; board 2). AcceptRequotedOffers {offers[]} writes the selected delivery from the supplied set without calling delivery-promise; checkout re-verifies the offers through its pre-authorize check.

2. Destination, quote and selection​

Derived from: model.yaml → contexts[shopping-cart].sync_calls, .aggregates[Cart] (QuotedOffer, DeliverySelection value objects, ErrNoDestination, ErrStaleDeliverySelection), .publishes[CartDeliveryQuoted], .read_models[CheckoutReadiness]; network/model/model.yaml → contexts[delivery-promise].inbound.

Before a destination is set the estimate shows the item subtotal only with estimateComplete=false; the delivery charge and tax appear once a destination exists. Omitted: the estimate arithmetic (board 3) and the offer expiry clock (readiness compares expiresAt; no event announces an expiry). A quote holds no capacity: the offers are delivery-promise facts frozen at quote time, and capacity is held only when checkout places the order.

3. The estimate and the views​

Derived from: model.yaml → contexts[shopping-cart].consumes, .read_models[PurchasabilityView, EstimateView]; contexts[product-discovery].ul[Purchasable]. The cart is lenient by design: it accepts any catalogued, priced item, and checkout's binding quote is the gate.

Omitted: CheckoutReadiness (derived from the cart itself, board 2) and the inbox. No pricing or catalogue event touches the Cart aggregate: a price move never clears a quote — it moves the estimate, which is why the estimate can be labelled non-binding (gap S2, answered by the binding PriceQuote at checkout).

4. Cart lifecycle​

Derived from: model.yaml → contexts[shopping-cart].policies, .aggregates[Cart] (states, transitions, ErrCartClosed), .publishes, .size_estimate; contexts[checkout].publishes[CheckoutCompleted].

Omitted: MergeInto (board 1) and the inbox. CHECKED_OUT, ABANDONED and MERGED are terminal: ErrCartClosed rejects every later change. A CheckoutCompleted for a cart that is not OPEN has no transition in the model — in practice the race needs a session to outlive 30 idle days.

Hotspots​

#HotspotWhere it comes from in the model
H1Resolved in the model-fix (by design): only AddLine publishes an event, because analytics needs add, quote, abandon and checkout. Removals, quantity changes, destination changes, selections and merges raise nothing. No new events.business_decisions; aggregates[Cart].commands vs publishes
H2Resolved in the model-fix: ErrDuplicateLine is removed. Adding an existing item merges quantities into its line; nothing is ever rejected with it. The REST wording and this pack are corrected.aggregates[Cart].invariants, storefront/apis/shopping-cart/openapi.yaml (addCartLine)
H3Resolved in the model-fix (by design): PurchasabilityView is lenient. The cart accepts any catalogued, priced item; product-discovery's stricter Purchasable is not mirrored and checkout's binding quote is the gate. Stated in the cart and discovery context-map relationship.business_decisions; read_models[PurchasabilityView]
H4Resolved in the model-fix (by design): no cart consumer. All four events are analytics-only; checkout reads the cart synchronously (GET /carts/{cartId}).publishes; business_decisions
H5Resolved in the model-fix: the policy PurgeAbandonedCarts (scheduled) deletes carts idle for 30 days and raises no event.policies[PurgeAbandonedCarts]
H6Resolved in the model-fix: with no destination the estimate shows the item subtotal only with estimateComplete=false; the delivery charge and tax appear once a destination is set.business_decisions; aggregates[Cart].notes; apis/shopping-cart/openapi.yaml (Estimate)