Skip to main content

EventStorming

Design-level EventStorming of the hint flow, using the ddd-crew glossary colours: orange domain events, blue commands, yellow aggregates, lilac policies, pink external systems, green read models, red hotspots. The model was derived from the code and ADRs, not from a workshop.

Source: internal/domain/stationtrip/{trip,events}.go, internal/domain/policy/policy.go, internal/domain/recommend/recommend.go, internal/application/usecases/*.go (apply_task_completed.go, apply_task_claimed.go, expire_hints.go), internal/adapters/inbound/expiry/worker.go, docs/adr/0001 to 0005, apis/asyncapi.yaml, and fulfillment-execution's apis/asyncapi.yaml on its origin/develop for the TaskAvailable scope. Each domain event name is the Go type; the wire name is the CloudEvents event name in ADR 0004.

Reading it​

  1. Declare. An operator declares a site policy. Until then the site is inert.
  2. Feed. fulfillment-execution and facility-layout events fill the local copies (open-task pool, claims, geometry) through the always-on consumers. fulfillment-execution publishes TaskAvailable today for RELOCATE, REPLENISH and sited PICK tasks.
  3. Complete. A TaskCompleted records the station's new position, taken from the completed task's to_location in the pool copy.
  4. Hint. The recommender ranks the pool; when it yields at least one candidate, IssueHint supersedes any Active hint and raises HintIssued.
  5. Outcome. A claim of a candidate while unexpired raises HintConsumed; the hint-expiry worker raises HintExpired; a newer hint supersedes silently.

Hotspots​

#HotspotState
1Who calls Expire? The ExpireHints use case, driven by the inbound/expiry worker every HINT_EXPIRY_INTERVAL (default 5 s). The aggregate still takes the instant from the caller.Resolved in code (ADR text still silent)
2A completion with no candidate leaves an older Active hint in place until its TTL (bounded staleness; the hint is advisory and fail-open). Retracting it would need an event for the retraction: a later ADR if the floor needs it (ADR 0002).Accepted by ADR 0002
3Announcement scope and the hint consumer. fulfillment-execution publishes TaskAvailable for RELOCATE, REPLENISH and PICK tasks (its ADR 0049, ADR 0050 and ADR 0062; a PICK only when its plan carries the site and the pick face), so the pool, and every candidate list, holds those three types only; PACK, SLAM and REBIN have no location there. PICK needed no change in this context (ADR 0012): it ranks like the other types and the maxCandidates bound holds end to end. fulfillment-execution consumes InterleavingHintIssued since its ADR 0051 (both earlier ADRs had left it out of scope), so a hint can break a tie inside one priority band (ADR 0001).PICK announcement resolved (ADR 0012 consumer side, producer ADR 0062); PACK, SLAM and REBIN open, other contexts; hint consumer resolved
4Site and geometry code spaces. v1 assumes the pool's site_id equals facility-layout's siteCode and one geometry frame per site (ADR 0003, live-data rule).Open until checked on live data
5Wording drift in the REST spec. apis/openapi.yaml says a hint is Superseded by "a newer completion at the same station" and mentions supersededAt; ADR 0002 and the code supersede a hint only when a newer hint is issued (a completion with no candidate supersedes nothing). The code does keep supersededAt (hints.superseded_at), so only the "newer completion" wording differs.Reported as a discrepancy