EventStorming (design level)
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/kafka/shipment_confirmed_consumer.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
(2026-11-06 addendum: the event path is primary, the REST route is the operator fallback).
Omitted: the 404 branch for an unknown networkRef on the REST route, the
dead-letter topic for a ShipmentConfirmed message that cannot be applied, and
the ledger row written with the save. The Request label step runs before the
order is confirmed, so a label failure leaves it ACKNOWLEDGED.
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 (fallback) | 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.Execute (REST) / ExecuteForShipment (event) |
| Request label | Command | NetworkGateway.RequestLabel, called first in ExecuteForShipment |
| 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 or (shipment, order) recorded returns unchanged | Policy | ConfirmNetworkOrderShipment.alreadyConfirmed (ShipmentConfirmationLog, State() == StateConfirmed) |
orders[].order_id joins NetworkOrder.localOrderId; no match is skipped | Policy | ShipmentConfirmedConsumer.confirm (FindByLocalOrderId) |
| 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 |
| outbound-shipping | External System | ShipmentConfirmedConsumer on warehouse.outbound-shipping.events (ADR 0014 addendum). fulfillment-execution is named in ADR 0014 only as the trigger that was not built |
| 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" (the ADR 0001 addendum of 2026-11-13 records what the code does) |
| No WorkUnitId → NetworkRef mapping | Hotspot, resolved 2026-11-06 (ADR 0014 addendum) | The join is orders[].order_id on NetworkOrder.localOrderId, consumed from outbound-shipping's ShipmentConfirmed (shipment_confirmed_consumer.go); PackageManifested is still not consumed |
| Package count is always 1 | Hotspot | singlePackage in confirm_network_order_shipment.go; outbound-shipping's ShipmentConfirmed.orders[] carries only order_id, the consumer decodes package_count for the day it does (ADR 0014 addendum, ADR 0026) |
| Shipment before the acknowledgement is deferred | Policy, decided 2026-11-14 (ADR 0014 addendum D7) | ShipmentConfirmedConsumer.confirmOrder calls DeferShipmentConfirmation when the confirm fails with ErrConfirmBeforeAcknowledge; a SUBMITTED order records the shipment (pendingShipment) and ConfirmPendingShipments confirms it once ACKNOWLEDGED; NEW/REJECTED still retry and dead-letter |
| Confirm-before-acknowledge → 409 | Policy | errors.go maps ErrConfirmBeforeAcknowledge to 409 confirm-before-acknowledge (resolved 2026-10-06) |
| Offer reaches the network only in live mode | Hotspot | RecomputeCapabilityOffers calls no gateway (doc comment); FeedInventory sends the persisted offers (ADR 0027 part 2, cmd/netfulfil/inventory_feed.go: no worker in stub mode); 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) |