EventStorming (design level)
This page is a copy of docs/docs/ddd/eventstorming.md on develop, derived from that repository's code. Edit it there, then re-sync.
Uses the ddd-crew EventStorming glossary & cheat sheet notation. Each sticky is backed by code. The hotspots are real gaps, taken from ADRs or from the code itself, and none is invented.
Legend
Source: the ddd-crew EventStorming notation only; the legend has no code behind it. The code files behind every sticky are named under each section's diagram.
1. Demand intake and answer
Source: internal/adapters/inbound/poller/poller.go,
internal/application/usecases/receive_network_demand.go,
internal/adapters/outbound/ordermanagement/planner.go,
internal/domain/networkorder/network_order.go.
Omitted: the submission to the network that follows each answer
(SubmitAcknowledgement(ref, true|false)), shown in
sequence-diagrams.md; and the outbox write. The
ex-hotspot "crash after raising hold leaves a NEW order with no localOrderId"
is resolved by recording the hold right after the raise and by the
orphaned-hold sweep (diagram 2); what remains open is listed in the sticky
inventory.
2. Reconciliation and the acknowledgement clock
Source: internal/application/usecases/reconcile_submitted_orders.go,
sweep_acknowledgement_deadlines.go, reject_overdue_orders.go,
sweep_orphaned_holds.go;
internal/adapters/outbound/analyticsstore/postgres_projection.go;
docs/adr/0001-network-fulfillment-bounded-context.md §5, §6.
Omitted: the per-order "skip on error, retry next pass" behaviour of all
three passes (four, with the orphaned-hold sweep). The overdue reject cancels the held order only when a
hold is recorded and still open. The orphaned-hold sweep also reads 409/422
as "already released" (outcome recorded, no event) and 404 as "gone"; a 5xx or
an open breaker leaves the hold for the next pass.
3. Shipment confirmation
Source: internal/application/usecases/confirm_network_order_shipment.go,
internal/adapters/inbound/http/server.go (handleConfirmShipment),
internal/adapters/inbound/http/errors.go (ErrConfirmBeforeAcknowledge
maps to 409 confirm-before-acknowledge), docs/adr/0014-explicit-shipment-confirmation-endpoint.md.
Omitted: the 404 branch for an unknown networkRef.
4. Capability offer recompute
Source: internal/application/usecases/recompute_capability_offers.go,
internal/domain/capabilityoffer/capability_offer.go,
internal/adapters/outbound/{processpathcache,pathcapacitycache,inventoryclient}/,
cmd/netfulfil/main.go (wireCapabilityOffer, siteId).
Omitted: the boot-time WaitReady gate, which the always-on capability-offer
pipeline blocks on. CapabilityOffer raises no domain
event, so there is no orange sticky.
Sticky inventory
| Sticky | Kind | Code evidence |
|---|---|---|
| Poll / sweep / recompute timers | Actor | poller.Run, runSweep, runRejectOverdue, runSweepOrphanedHolds, runReconcile in cmd/netfulfil/workers.go; runRecompute in cmd/netfulfil/capability.go |
| Operator or upstream caller | Actor | POST /network-orders/{networkRef}/shipment-confirmation |
| Receive network demand | Command | ReceiveNetworkDemand.Execute |
| Raise / release / cancel held order | Command | FulfillmentPlanner.RaiseHeldOrder / ReleaseHeldOrder / CancelHeldOrder |
| Submit acceptance | Command | NetworkOrder.Submit + LinkLocalOrder |
| Record / settle the hold | Command | NetworkOrder.RecordHold / SettleHold |
| Reject | Command | NetworkOrder.Reject |
| Confirm acknowledgement | Command | NetworkOrder.ConfirmAcknowledgement |
| Confirm shipment | Command | NetworkOrder.ConfirmShipment, ConfirmNetworkOrderShipment |
| Compute capability offer | Command | capabilityoffer.Compute |
| NetworkOrder | Aggregate | internal/domain/networkorder |
| CapabilityOffer | Aggregate | internal/domain/capabilityoffer |
| NetworkOrderReceived / Submitted / Acknowledged / Rejected / ShipmentConfirmed / AcknowledgementDeadlineAtRisk / OrphanedHoldCancelled | Domain Event | internal/domain/shared/events.go |
| Already-answered or overdue NetworkRef returns existing order; an unanswered one resumes | Policy | ReceiveNetworkDemand.Execute (FindByRef, resume) |
| Unknown product rejects whole order | Policy | ReceiveNetworkDemand.translate → rejectUntranslatable |
| Null promiseDate means infeasible | Policy | ordermanagement.Planner.RaiseHeldOrder |
| SUCCESS / FAILURE / PENDING | Policy | ReconcileSubmittedOrders.Execute |
| Overdue reported, never mutated | Policy | SweepAcknowledgementDeadlines |
| Overdue refused, never answered late | Policy | RejectOverdueOrders |
| Open hold past acknowledgeBy + grace is cancelled, state untouched | Policy | SweepOrphanedHolds, NetworkOrder.HoldOrphaned (ADR 0024) |
| Hold recorded the moment it exists | Policy | ReceiveNetworkDemand.answer → NetworkOrder.RecordHold (ADR 0024) |
| Already CONFIRMED returns unchanged | Policy | ConfirmNetworkOrderShipment.Execute |
| Unknown capacity falls back to physical | Policy | capabilityoffer.Compute (throughputKnown=false) |
| Product translation dictionary | Read Model | memory.ProductTranslation (PRODUCT_TRANSLATION_FILE) |
| Submitted / unanswered orders | Read Model | NetworkOrderRepo.ListSubmitted / ListUnanswered |
| Open holds | Read Model | NetworkOrderRepo.ListOpenHolds (partial index network_orders_open_holds) |
| Process-path capability cache | Read Model | processpathcache.Consumer.NextCutoff |
| Path capacity cache | Read Model | pathcapacitycache.Consumer.RemainingCapacity |
| Capability offers | Read Model | CapabilityOfferRepo.ListAll, GET /capability-offers |
| retail-network | External System | ports.NetworkGateway, network.StubGateway |
| order-management | External System | internal/adapters/outbound/ordermanagement |
| inventory-storage | External System | internal/adapters/outbound/inventoryclient |
| process-path-management, wes-work-planning | External System | the two Kafka caches |
| fulfillment-execution | External System | named in ADR 0014 as the deliberately unused trigger |
| Decided 2026-10-06: Submitted at SUBMITTED, Acknowledged only on settle (ADR 0016) | Policy | ReceiveNetworkDemand.acknowledge publishes NetworkOrderSubmitted; ReconcileSubmittedOrders.confirm publishes NetworkOrderAcknowledged (v2) with the save (ex-hotspots "Acknowledged at SUBMITTED" and "No event on settle") |
| Orphaned hold after crash | Hotspot, resolved 2026-10-17 (ADR 0024, gap OM-0020) | The hold id is recorded right after RaiseHeldOrder (RecordHold) and SweepOrphanedHolds cancels the ones nobody decided, so RejectOverdueOrders's cancel now has a hold to find. Still open, on purpose (ADR 0024): a hold never named because the process stopped between order-management's commit and the id being saved, if the window closes before a re-delivery repeats the raise; a SUBMITTED order whose network status stays PENDING; an ACKNOWLEDGED order whose release failed (not a cancel case); rows rejected before migration 0005 whose raise had succeeded |
| SUBMISSION_FAILED counted | Policy | PostgresProjection.ApplyNetworkOrderRejected increments orders_rejected_submission_failed (analytics migration 0002, ADR 0015; resolved 2026-10-06) |
| At-risk only after the deadline | Hotspot | AcknowledgementOverdue vs ADR 0001 §6 "approaching" |
| No WorkUnitId → NetworkRef mapping | Hotspot | ADR 0014 |
| Confirm-before-acknowledge → 409 | Policy | errors.go maps ErrConfirmBeforeAcknowledge to 409 confirm-before-acknowledge (resolved 2026-10-06) |
| Offer never submitted outward | Hotspot | RecomputeCapabilityOffers doc comment; ADR 0001 §8 "published outward on a schedule" |
| Decided 2026-10-06: path eligible only if CycleTimeP95 ≤ cutoff − now, missing/zero stays eligible (ADR 0017) | Policy | RecomputeCapabilityOffers.throughputFeasible / cycleTimeFits (ex-hotspot "CycleTimeP95 unused") |
| Single SITE_ID | Hotspot | RecomputeCapabilityOffers.SiteId; ADR 0001 Consequences (single-site inherited) |