Skip to main content

EventStorming (design level)

Design-level EventStorming in the ddd-crew EventStorming glossary & cheat sheet notation. Each flow reads left to right: Actor → Command → Aggregate → Domain Event → Policy → next Command / Read Model / External System. Hotspots are real gaps recorded in the code, ADRs or this site — none are invented for the exercise.

Legend​

Process 1 — Building the map (structure and placement rules)​

Source: internal/application/usecases/register_site.go, register_zone.go, register_aisle.go, register_location_type.go, define_placement_rule.go, internal/domain/shared/enums.go. Omitted: the analytics topic and the Idempotency-Key check.

Process 2 — Registering a slot (single or bulk)​

Source: internal/application/usecases/register_location_slot.go, import_facility_layout.go, internal/domain/slot/location_slot.go, functional.go, internal/domain/placement/rules.go, internal/adapters/inbound/kafka/analytics_consumer.go. Omitted: SetLocationGeometry invoked by import rows that carry geometry (Process 3), and the rejection branches (see Invariants).

Process 3 — Geometry and travel distance​

Source: internal/application/usecases/set_location_geometry.go, set_aisle_geometry.go, register_cross_aisle.go, register_fixed_structure.go, travel_graph_builder.go, estimate_travel_distance.go, internal/domain/travel/graph.go, internal/adapters/outbound/kafka/publisher.go. The read models are built per request from repository state, not from the events — the event arrows show what makes the read model change. Omitted: zone pitch (set only at RegisterZone).

Process 4 — Retiring a slot​

Source: internal/application/usecases/decommission_location_slot.go, internal/adapters/outbound/postgres/slot_repo.go (version guard), ADR 0005, ADR 0025.

Sticky evidence​

StickyKindCode evidence
OperatorActorweb/ (facility-mfe), or any REST client
RegisterSite … DefinePlacementRuleCommandinternal/application/usecases/register_site.go, register_zone.go, register_aisle.go, register_location_type.go, define_placement_rule.go
RegisterLocationSlot, ImportFacilityLayout, DecommissionLocationSlotCommandregister_location_slot.go, import_facility_layout.go, decommission_location_slot.go
SetLocationGeometry, SetAisleGeometry, RegisterCrossAisle, RegisterFixedStructureCommandset_location_geometry.go, set_aisle_geometry.go, register_cross_aisle.go, register_fixed_structure.go
Site, Zone, Aisle, CrossAisle, LocationSlot, LocationType, PlacementRule, FixedStructureAggregateinternal/domain/site, zone, aisle, slot, placement, structure
15 eventsDomain Eventinternal/domain/shared/events.go
Parent must exist and be Active / Chain of custodyPolicyRegisterZone, RegisterAisle, RegisterLocationSlot.resolveChain
Placement rulesPolicyplacement.RuleSet.Check
Role needs dockFlow / activities / capacityPolicyslot.NewFunctionalAttributes, LocationRole.RequiresCapacity
Ensure parents exist per rowPolicyImportFacilityLayout.ensureSite, ensureZone, ensureAisle
One-way decommissionPolicyErrDuplicateLocationCode, slot.ErrAlreadyDecommissioned
Optimistic concurrencyPolicyPostgres SlotRepo.Save, ports.ErrConcurrentModification
Site layout, Zone grid, Locations by role, Zone travel graph, Travel distanceRead Modelget_site_layout.go, get_zone_grid.go, reads.go, get_zone_travel_graph.go, estimate_travel_distance.go
Catalog growth reportRead Modelcmd/facility-projector, catalog_growth_rollup
inventory-storage, inbound-receiving, dock-scheduling, yard-management, outbound-shipping, slotting-optimization, pick-face-replenishment, task-interleaving, warehouse-planning, network-inventory-planning (Kafka), wes-work-planning, fulfillment-execution (REST), warehouse-ops-agent (MCP)External Systemsee Context map
H1 nothing decommissions Site/Zone/Aisle or sets UnderMaintenanceHotspotinternal/domain/shared/enums.go (UnderMaintenance comment); only DecommissionLocationSlot calls a Decommission method
H2 no routed cross-zone pathHotspotestimate_travel_distance.go (crossZoneBeeline), ADR 0017
H3 cross-aisle edges always estimatedHotspottravel.crossAisleDistance
H4 FixedStructure not an obstacleHotspotinternal/domain/structure/fixed_structure.go package comment ("in a later phase")
H5 geometry and import events keyed by event typeResolvedNow keyed by aggregate identity (FacilityLayoutImported: by CloudEvents id) — kafka.aggregateKey / partitionKey, ADR 0032. Decided 2026-10-06: FacilityLayoutImported stays keyed by its CloudEvents id — no consumer needs import ordering, and keying by site would need an additive siteCode (a contract change) for no benefit (ADR 0034)