Bounded context canvas
ddd-crew Bounded Context Canvas v5,
filled from ADR 0001 (which
carries its own canvas), the domain code and the contracts. Every message below is
carried by an adapter on develop (REST, Kafka consumers, outbox relay); see
Integration for whether the collaborator on the
other side has its half.
Canvas at a glance
Arrows follow the message type: solid blue commands (cmd), dotted green
queries (qry), thick orange events (evt). Dashed boxes are edges whose other
side is not built.
Inbound
* published by fulfillment-execution for RELOCATE, REPLENISH and sited PICK tasks (PACK, SLAM and REBIN are not announced).
Outbound
Source: the Inbound and Outbound Communication tables of this page, which follow
docs/adr/0001-task-interleaving-bounded-context.md, apis/asyncapi.yaml and the
adapters internal/adapters/inbound/{http,kafka} and
internal/adapters/outbound/{events,outbox,kafka}.
Name
task-interleaving
Purpose
After a station completes a task, recommend the few open tasks nearest to where the
operator now stands, as an advisory, expiring hint that fulfillment-execution
may use as a tie-break inside one priority band.
Strategic classification
| Dimension | Value |
|---|---|
| Domain | Supporting (Subdomain classification) |
| Tier | WES, CloudEvents subdomain wes, type prefix com.warehouse.wes.task-interleaving., source /warehouse/task-interleaving, Kong path /api/task-interleaving |
| Business model | Cost reduction (less travel between tasks) |
| Evolution | Custom-built, genesis |
Domain roles
- Advisor: computes hints (
recommend.Recommend,StationTrip.IssueHint). - Policy holder: per-site settings (
policy.Policy). - Simulation: a read-only what-if (
POST /recommendations).
Inbound communication
| Collaborator | Message | Kind | Channel | Status |
|---|---|---|---|---|
| fulfillment-execution | TaskCompleted | event | warehouse.fulfillment.events | producer verified; consumer built (always on) |
| fulfillment-execution | TaskAvailable (RELOCATE, REPLENISH and sited PICK tasks), TaskClaimed (every task type) | events | warehouse.fulfillment.events | producer verified (its ADR 0049, ADR 0050 and ADR 0062); consumer built; PICK-ready on this side (ADR 0012) |
| facility-layout | ZoneRegistered, LocationSlotRegistered, LocationSlotDecommissioned, LocationGeometryUpdated | events | warehouse.facility.events | producer verified; consumer built (always on) |
| operator (console, agent) | Declare policy | command | PUT /sites/{siteId}/policy | built |
| operator (console, agent) | Get policy, list hints, get hint, get station, simulate | queries | GET /sites/{siteId}/policy, GET /hints, GET /hints/{hintId}, GET /stations/{stationId}, POST /recommendations | built |
Outbound communication
| Message | Kind | Channel | Consumers |
|---|---|---|---|
InterleavingHintIssued | event | warehouse.task-interleaving.events and warehouse.task-interleaving.analytics | fulfillment-execution (consumer built, its ADR 0051); on the analytics topic also ti-projector (ADR 0008) |
InterleavingHintConsumed, InterleavingHintExpired, InterleavingPolicyDeclared | events | warehouse.task-interleaving.analytics only | ti-projector (ADR 0008) |
Source: apis/asyncapi.yaml, ADR 0004.
Ubiquitous language
StationTrip, position, hint (Active, Consumed, Expired, Superseded), candidate, detour, policy, travel model, open-task pool, priority band, tie-break, inert, fail-open. Full glossary: Ubiquitous language.
Business decisions
| Decision | Rule in code |
|---|---|
| Is a site served | only if it declared a policy; otherwise inert |
| How far | MaxDetourM, finite and greater than 0; a detour equal to the limit qualifies |
| How many | MaxCandidates, 1 to 5 |
| For how long | HintTTL, greater than 0; expires_at = issued_at + TTL |
| Which tasks | EligibleTaskTypes, non-empty subset of the six task types |
| How vertical travel weighs | VerticalWeight, at least 0 |
| Who is a candidate | same site, eligible type, not the completed task, known geometry, within the limit |
| Order | detour ascending, then task id ascending; distinct by task id |
| Hint count | at most one Active hint per station; a new hint supersedes it |
| Outcome | Consumed on a claim of a candidate while unexpired; Expired at expires_at |
Assumptions
From ADR 0001 and ADR 0003:
- A station's position is the end location of its last completed task.
- A location's site is its zone's site.
- Geometry from facility-layout is in metres in one frame per site.
- The pool's
site_idvalues equal facility-layout'ssiteCodevalues (one code space); to be checked on live data before the first live hint. - The pool copy is as fresh as the events.
Verification metrics
- Deterministic recommender: same pool in any order, same output
(
TestRecommendIsIndependentOfPoolOrder). - Mutation gate: 90 / 90 on the four domain packages, measured 100% / 100%.
- Coverage gate: 90% over
internal/domainandinternal/application, measured 99.9% on this commit (make coverage). - BDD: 68 godog scenarios over the real use cases; integration: 55 testcontainers tests (Testing).
TestEventCatalogueMatchesContractkeeps ADR 0004 andapis/asyncapi.yamlin step; golden CloudEvents bytes per published type live ininternal/adapters/outbound/events/testdata.
Open questions
- When does fulfillment-execution announce
TaskAvailablefor PACK, SLAM and REBIN tasks? They carry no location there, so today the pool holds RELOCATE, REPLENISH and sited PICK tasks only (a PICK is announced only when its plan carries both the site and the pick face, producer ADR 0062; the pick face stands for both ends of the trip). The consumer side of PICK needed no change: PICK parity, the candidate bound and the pool-size envelope are tested (ADR 0012). (It consumesInterleavingHintIssuedsince its ADR 0051, which ADR 0049 and ADR 0050 of that context had left out of scope.) - Expiry is triggered by the hint-expiry worker (
HINT_EXPIRY_INTERVAL); no ADR names it, so a future ADR should record the interval as a decision. - Do the pool's
site_idvalues equal the facilitysiteCodevalues, what share of pool locations has geometry, and is the frame the same per site (ADR 0003's live-data rule)?