EventStorming
Design-level EventStorming, reconstructed from the code rather than from a workshop: every sticky below is a real use case, aggregate, domain event, policy or read model, and every hotspot is a gap already documented in an ADR, a code comment or these docs. Time flows left to right.
Legend
Process 1 — Inbound: register, classify, receive, stow
Source: internal/application/usecases/register_bin.go, apply_product_classification.go,
receive_stock.go, stow_stock.go, internal/adapters/outbound/facilitycache/consumer.go,
internal/adapters/inbound/kafka/product_master_consumer.go,
internal/domain/product/segregation.go,
internal/adapters/outbound/kafka/publisher.go and analytics_publisher.go.
Omitted: the rejection paths (they raise no event) and the HTTP fallback
lookup.
Process 2 — Reservation lifecycle
Source: internal/application/usecases/reserve_stock.go,
revoke_reservation.go, confirm_pick.go, confirm_picks_for_order.go,
internal/adapters/inbound/kafka/task_completed_consumer.go, reservation_expiry.go,
get_usable.go, get_reservations_by_demand_ref.go,
internal/domain/reservation/reservation.go, internal/adapters/inbound/mcp/tools.go.
Omitted: the analytics copies of the events and the 409 paths.
Process 3 — Cycle count and accuracy
Source: internal/application/usecases/run_cycle_count.go,
internal/adapters/inbound/kafka/analytics_consumer.go,
internal/adapters/outbound/analyticsstore/postgres_projection.go,
internal/adapters/inbound/http/reports_handler.go.
Omitted: the clean-count branch (only CycleCountCompleted with
discrepancy=false).
Stickies and their evidence
| Sticky | Kind | Code evidence |
|---|---|---|
| Inventory control, Picker or simulator, MCP host / agent | Actor | REST callers of PUT /bins/{binId}, POST /stock-receipts, POST /stowages, POST /bins/{binId}/cycle-counts, POST /reservations/{id}/pick-confirmations; MCP revoke_reservation |
| RegisterBin, ApplyProductClassification (Kafka, ADR 0034), ReceiveStock, StowStock, ReserveStock, RevokeReservation, ConfirmPick, ConfirmPicksForOrder (Kafka, ADR 0035), RunCycleCount | Command | internal/application/usecases/*.go, routed in internal/adapters/inbound/http/server.go |
| StockUnit, Bin, Reservation, ProductClassification | Aggregate | internal/domain/stock, location, reservation, product |
| StockReceived, ItemStowed, LocationRecorded, StockReserved, ReservationRevoked, ReservationExpired, StockPicked, ItemUnlocated, CycleCountCompleted, DiscrepancyDetected | Domain Event | internal/domain/shared/events.go |
| ProductClassified | Domain Event (external, product-master's) | consumed in internal/adapters/inbound/kafka/product_master_consumer.go (ADR 0034); this service no longer raises or publishes one |
| ZoneRegistered, LocationSlotRegistered, LocationSlotDecommissioned | Domain Event (external) | consumed in internal/adapters/outbound/facilitycache/consumer.go |
| TaskCompleted | Domain Event (external) | consumed in internal/adapters/inbound/kafka/task_completed_consumer.go (ADR 0035) |
| Placement check | Policy | StowStock.checkPlacement |
| Same-bin DOT segregation | Policy | StowStock.checkSegregation, product.Incompatible |
| Replay guard | Policy | ReserveStock.activeReservationFor, isReplayOf |
| Lazy expiry on every read | Policy | expireIfDue, expireAllIfDue |
| Shortfall marks whole units UNLOCATED | Policy | RunCycleCount.markShortfallUnlocated |
| Projector upsert | Policy | inbound/kafka.AnalyticsConsumer, analyticsstore.PostgresProjection |
| Facility location cache | Read Model | facilitycache.Consumer.GetSlotAttributes |
| Usable inventory per SKU | Read Model | usecases.GetUsable |
| Reservations by demandRef | Read Model | usecases.GetReservationsByDemandRef |
| Flow and Accuracy report | Read Model | internal/analytics/report, table flow_accuracy_rollup |
| facility-layout, order-management, wes-work-planning, fulfillment-execution, warehouse-ops-agent | External System | see the Context Map |
Hotspots and where they are documented
| # | Hotspot | Documented in |
|---|---|---|
| H1 | A bin id is never validated against facility-layout's slot catalogue | Context Map, "What is still not built" |
| H2 | Fragile, Oversized, HighValue carry no placement rule | Context Map; ADR 0009 |
| H3 | Decided 2026-10-06: kept permissive (ADR 0013/0020) — the binary default LOCATION_LOOKUP_MODE=permissive stayed: a cold facility cache would reject every receipt, and the cluster already injects kafka. Overtaken by ADR 0042: permissive and the unset default were removed, the mode is kafka or http | cmd/inventory/lookup.go, cmd/inventory/config.go; ADR 0013, ADR 0020, ADR 0042 |
| H4 | ProductClassified is raised but never publishedLocationRecorded stays in-process (no consumer). Superseded by ADR 0034: product-master owns classification; this service's own ProductClassified and the one-shot backfill were removed at stage E (2026-10-17) and nothing here raises or publishes it any more | ADR 0031, ADR 0034, Domain Events |
| H5 | Decided 2026-10-06: kept (ADR 0003) — no background sweeper for timed-out reservations; expiry stays lazy | Domain Events; ADR 0003 |
| H6 | The ReserveStock replay guard is best-effort under concurrency | code comment on activeReservationFor in reserve_stock.go |
| H7 | Decided 2026-10-07 (audit decision 18; supersedes the counting of 17a for line-aware work): confirm-pick is event-driven and PER LINE (ADR 0036, builds on ADR 0035) — picks are confirmed from fulfillment-execution's TaskCompleted (PICK, order_ref, line_no), never a sync REST/MCP call. order-management sends lineNo on POST /reservations, the Reservation stores it (reservations.line_no) and the event carries the task's line_no, so the consumer confirms exactly the ACTIVE reservation of (order_ref, line_no); the order's other lines stay ACTIVE. This closes ADR 0035's "one pick early" edge for line-aware events. The ADR 0035 counting (order_pick_progress, confirm on the order's LAST pick, never early) remains as the backward-compatible fallback for events without line_no and reservations with a NULL line_no. An expired one is skipped and counted | ADR 0036, ADR 0035, Context Relationships |
| H8 | Cycle-count overage is reported, never reconciled | run_cycle_count.go comment; Use Cases |
| H9 | Short picks are not modelled: a Task carries no SKU or quantity, so a confirmed line's whole reserved quantity is picked (per-line identity, ADR 0036, makes partial picks expressible, but they still need per-line quantities in wes-work-planning's WorkUnit and fulfillment-execution's Task, and a business rule no ADR specifies) | ADR 0035, ADR 0036 |