Skip to main content

EventStorming

Synced from fulfillment-execution

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.

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, renew_lease.go, complete_task.go, internal/domain/task/task.go, internal/domain/station/station.go. Omits RegisterStation (setup, no event) and the MCP complete_task path (same command).

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.

Process 3 — sweeps​

Source: internal/application/usecases/expire_leases.go, sweep_cpt_misses.go, internal/analytics/, internal/adapters/outbound/kafka/publisher.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.

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, RenewLease, CompleteTask, ArriveAtRebin, SealPackage, RunSlam, ExpireLeases, SweepCPTMissesCommandinternal/application/usecases/*.go
Task, Station, Package, OrderConsolidationAggregateinternal/domain/{task,station,package,consolidation}
WorkReleasedDomain event (inbound)com.warehouse.wes.work-planning.workunit.WorkReleased, internal/adapters/inbound/kafka/consumer.go
TaskCreated, TaskClaimed, LeaseExpired, TaskCompleted, TaskCPTMissed, PackageSealed, LabelApplied, PackageManifested, WeightDiscrepancyDetected, PackageDiverted, ItemArrivedAtRebin, OrderConsolidatedDomain 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 (wasAlreadyComplete, 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-masterExternal systemapis/asyncapi.yaml; inbound/kafka/product_classified_consumer.go
Claim does not require check-inHotspotAggregates & invariants "Honest status"; claim_next.go never reads occupancy
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)