Skip to main content

EventStorming

Design-level EventStorming of the three main processes, reconstructed from the code rather than from a workshop. Read each board left to right: an actor issues a command, an aggregate decides, a domain event records the fact, a policy reacts ("whenever ... then ..."), read models inform the next decision, and external systems sit on the edges. Hotspots are real open issues from the ADRs and docs, not invented ones.

Legend​

Source: ddd-crew EventStorming cheat sheet colours as fixed by the fleet documentation brief.

Process 1 — release, dispatch and completion​

Source: internal/adapters/inbound/kafka/consumer.go, internal/application/usecases/create_task.go, check_in_station.go, claim_next.go, form_work_batch.go, renew_lease.go, complete_task.go, internal/domain/task/task.go, internal/domain/station/station.go, internal/domain/workbatch/workbatch.go. Omits RegisterStation (setup, no event) and the MCP complete_task path (same command). CreateTask raises TaskCreated and TaskAvailable on every creation path (create_task.go); the integration encoder publishes TaskAvailable only for a task with a determinable location (RELOCATE, REPLENISH, and a PICK with both a site and a pick face — placement.go, ADR-0062). CompleteTask raises exactly one of the three transfer facts, selected by the task's work_kind, only for a task released with a transfer correlation block (ADR-0036), and WorkBatchCompleted when the completed task was the last open member of its batch. FormWorkBatch and the two WorkBatch* stickies exist only with PICK_BATCH_MODE=on (ADR-0063).

Process 2 — Rebin, Pack and SLAM​

Source: internal/application/usecases/arrive_at_rebin.go, seal_package.go, run_slam.go, get_package.go, internal/domain/consolidation/order_consolidation.go, internal/domain/package/package.go. Omits the PACK task's claim and completion (process 1 applies unchanged) and the policy ordering detail: in code CreateTask runs before OrderConsolidated is published, in the same transaction. CreateTask PACK raises TaskCreated and TaskAvailable like every creation, but a PACK task has no placement (internal/domain/task/placement.go), so TaskAvailable never reaches the integration topic for it.

Process 3 — sweeps​

Source: internal/application/usecases/expire_leases.go, sweep_cpt_misses.go, internal/analytics/, internal/adapters/outbound/kafka/publisher.go, internal/domain/workbatch/workbatch.go. Omits the lazy expiry inside Claim / RenewLease / Complete, which frees a lapsed lease without raising LeaseExpired. The re-promise policy lives in order-management, not here. ExpireLeases raises LeaseExpired and TaskAvailable for every freed task (the task re-enters the pool; published only if it has a determinable location, expire_leases.go), and WorkBatchAbandoned when the freed task was the last open member of an open batch (PICK_BATCH_MODE=on only, ADR-0063).

Sticky inventory​

StickyKindCode evidence
Station operator, Packer, Rebin associate, SLAM lineActorREST callers of router.go
External schedulerActorcallers of POST /task-lease-expirations, POST /cpt-miss-sweeps
CreateTask, CheckInStation, ClaimNext, FormWorkBatch, RenewLease, CompleteTask, ArriveAtRebin, SealPackage, RunSlam, ExpireLeases, SweepCPTMissesCommandinternal/application/usecases/*.go
Task, Station, Package, OrderConsolidation, WorkBatchAggregateinternal/domain/{task,station,package,consolidation,workbatch}
WorkReleasedDomain event (inbound)com.warehouse.wes.work-planning.workunit.WorkReleased, internal/adapters/inbound/kafka/consumer.go
TaskCreated, TaskAvailable, TaskClaimed, LeaseExpired, TaskCompleted, TaskCPTMissed, TransferPicked, TransferDispatched, TransferArrived, WorkBatchFormed, WorkBatchCompleted, WorkBatchAbandoned, PackageSealed, LabelApplied, PackageManifested, WeightDiscrepancyDetected, PackageDiverted, ItemArrivedAtRebin, OrderConsolidated (19 of the 20 events in the file; the 20th, ItemPicked, is the hotspot below)Domain eventinternal/domain/shared/events.go
Create a task from the path cataloguePolicyconsumer.go → PathCatalogue.Lookup → CreateTask (ADR-0017)
Create the PACK task oncePolicyarrive_at_rebin.go (HasArrived, IsComplete)
A lapsed lease is claimable againPolicyTask.IsAvailable, TaskRepo.FindClaimableByType
Re-promise on CPT missPolicy (downstream)order-management, ADR-0025
Queue depth, Package read model, Throughput rollupRead modelget_queue_depth.go; get_package.go (ADR-0033); throughput_rollup (ADR-0012)
wes-work-planning, labor-performance, order-management, product-master, task-interleaving, network-inventory-planningExternal systemapis/asyncapi.yaml; inbound/kafka/product_classified_consumer.go
Claim does not require check-inHotspotAggregates & invariants "Honest status"; claim_next.go never reads occupancy
WorkBatch events have no consumer yetHotspotx-no-consumer-reason on the three WorkBatch* messages in apis/asyncapi.yaml: labor-performance is the intended consumer but has no handler for them; PICK_BATCH_MODE defaults to off (ADR-0063)
ItemPicked never raisedHotspotDomain events; no caller of shared.NewItemPicked outside tests
Rebin events never leave the processHotspotnot in inIntegrationContract / inAnalyticsContract, not in apis/asyncapi.yaml (ADR-0016)
SortLane with no WCSHotspotPackage.SortLane; ports.EquipmentCommandPort has no methods (ADR-0010, ADR-0015)
Sweeps are not scheduled in-processDecided 2026-10-06: no in-process scheduler; chart CronJobs on by default — expire-leases every minute, sweep-cpt-misses every 5 minutes (ADR 0037)Task lifecycle; no ticker in cmd/execution/main.go (by design, ADR-0003/0025); charts/fulfillment-execution/templates/sweeps-cronjob.yaml (sweeps.enabled, default on, per-environment schedules)
TaskCPTMissed re-firesHotspotsweep_cpt_misses.go changes no state (ADR-0025)