Skip to main content

Bounded context canvas

ddd-crew Bounded Context Canvas v5. Every message row maps to a real route in internal/adapters/inbound/http/router.go, a real MCP tool in internal/adapters/inbound/mcp/, or a real Kafka topic and CloudEvents type in the consumers and publishers.

Canvas at a glance​

Two pictures of the sections below, laid out like the ddd-crew canvas: first the inbound collaborators feeding this context (purpose, domain roles and the business decisions it enforces), then the outbound collaborators it calls or notifies. Arrows follow the message type: solid blue commands (cmd), dotted green queries (qry), thick orange events (evt); each arrow names its channel and the messages it carries. Box shapes mark the collaborator kind: rounded = people, UI or any client; blue = sibling bounded context; double border = external system or platform; grey = this context's own projector, reports or dead-letter path; dashed = published today with no consumer. Channel names on the arrows are abbreviated (REST, MCP, Kafka, HTTP, port); the Inbound and Outbound Communication tables carry the exact route, tool, topic and CloudEvents type for every message.

Inbound​

Outbound​

Source: the Inbound Communication and Outbound Communication tables of this page, which map to internal/adapters/inbound/{http,kafka,mcp} and internal/adapters/outbound/. The diagram omits assumptions, verification metrics, open questions and the ubiquitous language (sections below), the relationship pattern per message (OHS, ACL, Conformist, Customer/Supplier - see the tables) and anything the tables mark as deprecated or platform-only (health probes).

Name​

Fulfillment Execution (fulfillment-execution, CloudEvents subdomain wes, source /warehouse/fulfillment-execution).

Purpose​

Turn released work into physically completed work on the warehouse floor. Each released work unit becomes a Task (Pick, Rebin, Pack or SLAM) that a station pulls when it is free; the context guarantees that a task is held by at most one station at a time (a time-boxed lease), that it is done by a station with the right capabilities, and that the earliest CPT is served first. It also seals packages (with DOT hazard segregation), runs the SLAM weigh-check, consolidates an order's lines at Rebin, and reports completions and missed CPTs back to planning, labour and order management.

Strategic Classification​

DimensionValueWhy
DomainCorePull-based dispatch with lease semantics is the throughput differentiator; see Subdomain classification and Core domain chart. Pack and SLAM slices are Supporting and kept thin.
Business modelCost reduction / operational efficiencyIt earns nothing directly; it raises units per hour and on-time-to-CPT shipment, measured by the throughput and on-time-to-CPT reports (ADR-0026).
EvolutionCustom-builtBuilt in-house, still gaining behaviour (claim compare-and-set, Rebin, package read model are recent ADRs).

Domain Roles​

  • Execution context — owns the task lifecycle (Pending → Claimed → Completed) and the claim/lease rules.
  • Enforcer — enforces at-most-once claiming, capability matching, DOT segregation and the SLAM weigh tolerance.
  • Gateway to the floor (strategic) — the only context that would talk to equipment (WCS), behind a deliberately empty anti-corruption seam (ADR-0015).
  • Analysis context (side role) — owns its own throughput and on-time-to-CPT read model (cmd/fulfillment-projector, cmd/fulfillment-reports).

Inbound Communication​

CollaboratorMessageTypeChannelRelationship
wes-work-planningWorkReleasedEventKafka warehouse.work-planning.events, com.warehouse.wes.work-planning.workunit.WorkReleasedCustomer/Supplier, ACL on this side
process-path-management (opt-in)ProcessPathCreated / ProcessPathUpdated / ProcessPathDeactivatedEventKafka warehouse.process-path-management.events, com.warehouse.wes.process-path-management.processpath.* (only with PATH_CATALOGUE_SOURCE=kafka)Conformist on a Published Language
Station client / consoleCreate taskCommandREST POST /tasks (Idempotency-Key with Postgres)OHS
Station client / consoleRegister stationCommandREST POST /stationsOHS
Station clientClaim next taskCommandREST POST /stations/{stationId}/task-claimsOHS
Station clientCheck in / check outCommandREST POST /stations/{stationId}/check-ins, POST /stations/{stationId}/check-outsOHS
Station clientRenew leaseCommandREST POST /tasks/{id}/lease-renewalsOHS
Station clientComplete taskCommandREST POST /tasks/{id}/completionsOHS
Pack stationSeal packageCommandREST POST /tasks/{id}/package-sealsOHS
SLAM stationRun SLAM weigh-checkCommandREST POST /packages/{id}/slam-runsOHS
Rebin stationRecord arrival at RebinCommandREST POST /rebin/arrivalsOHS
Scheduler (external)Expire leasesCommandREST POST /task-lease-expirationsOHS
Scheduler (external)Sweep CPT missesCommandREST POST /cpt-miss-sweepsOHS
warehouse-ops-agent / console BFFTasks for an orderQueryREST GET /tasks?orderRef=OHS
SLAM client / consolePackage by id, packages for an orderQueryREST GET /packages/{id}, GET /packages?orderRef=OHS
Any clientQueue depthQueryREST GET /queues/{taskType}/depthOHS
workforce-managementInstalled capacityQueryREST GET /capacity/{capability}OHS
warehouse-ops-agentQueue status, claimable work, stuck tasksQueryMCP get_queue_status, find_claimable_work, diagnose_stuck_tasks; resource queue://fulfillment/{type}/status; prompt triage_backlogOHS
Any MCP host (warehouse-ops-agent has no write path and never calls it)Complete taskCommandMCP complete_taskOHS
warehouse-ops-agentThroughput / on-time-to-CPT reportQueryMCP get_fulfillment_throughput_report, get_on_time_to_cpt (when REPORTS_BASE_URL is set), served by REST GET /reports/throughput on cmd/fulfillment-reportsOHS

Outbound Communication​

CollaboratorMessageTypeChannelRelationship
wes-work-planningTaskCompletedEventKafka warehouse.fulfillment.events, com.warehouse.wes.fulfillment-execution.task.TaskCompletedCustomer/Supplier feedback edge
labor-performanceTaskCompleted (with associate_id, duration_seconds, task_type)EventKafka warehouse.fulfillment.events, com.warehouse.wes.fulfillment-execution.task.TaskCompletedPublished Language
order-managementTaskCPTMissedEventKafka warehouse.fulfillment.events, com.warehouse.wes.fulfillment-execution.task.TaskCPTMissedPublished Language
order-managementPackageManifestedEventKafka warehouse.fulfillment.events, com.warehouse.wes.fulfillment-execution.package.PackageManifestedPublished Language
network-inventory-planning (transfer saga)TransferPicked, TransferDispatched, TransferArrivedEventKafka warehouse.fulfillment.events, com.warehouse.wes.fulfillment-execution.transfer.<Event> (raised when a transfer-kind task completes, ADR-0036)Published Language
own analytics read side13 analytics events: 10 always (TaskCreated, TaskClaimed, LeaseExpired, TaskCompleted, ItemPicked, PackageSealed, WeightDiscrepancyDetected, PackageDiverted, LabelApplied, PackageManifested) and WorkBatchFormed, WorkBatchCompleted, WorkBatchAbandoned only with PICK_BATCH_MODE=onEventKafka warehouse.fulfillment.analytics, com.warehouse.wes.fulfillment-execution.<task, package or workbatch>.<Event>internal (same context)
product-master (opt-in)ProductClassified into a local classification copyEventKafka warehouse.product-master.events, com.warehouse.wms.product-master.product.ProductClassified (PRODUCT_CLASSIFICATION_MODE=kafka, ADR-0039)Published Language, ACL on this side
facility-layout (opt-in)Location role lookupQueryREST GET /locations/{locationCode} (LOCATION_ROLE_MODE=http)Conformist behind ACL
wes-work-planning (operators)Poison or failed WorkReleasedEventKafka warehouse.work-planning.events.dlq (EVENT_PUBLISHER=kafka)—
WCS / equipmentnone—none — ports.EquipmentCommandPort has no methodsstrategic only

Ubiquitous Language​

The full glossary is on Ubiquitous language. Top terms:

  • Task — a unit of physical work with a type, a CPT and required capabilities.
  • claimNext — pull dispatch: the station asks, the context answers with the earliest-CPT task it can do.
  • Lease — a time-boxed claim (5 minutes by default) that returns the task to the pool on expiry.
  • CPT — Critical Pull Time, the deadline that sets priority.
  • Station / Capability — a work position and what it is certified and equipped for.
  • Package / Seal / SLAM — the Pack output, closing it, and the weigh-check that labels or diverts it.
  • Rebin / OrderConsolidation — fan-in of an order's lines before Pack.

Business Decisions​

  • Dispatch is pull, never push — there is no assign(task, station) (ADR-0002, Why pull, not push).
  • Priority is earliest CPT first, nothing else.
  • A task is claimed at most once at a time; a lapsed lease silently returns it to the pool (ADR-0003).
  • Capabilities are read from the registered station, not from the request.
  • A weigh-check outside ±0.05 of the expected weight diverts the package — a domain outcome, not an error.
  • Items with incompatible DOT hazard classes may not share a package (ADR-0010).
  • A missed CPT is reported, not enforced, and re-reported on every sweep (ADR-0025).
  • The PACK task for a multi-line order is created once, when the last line reaches Rebin (ADR-0016).

Assumptions​

  • wes-work-planning releases work at the right rate; this context does not throttle intake.
  • An external scheduler calls POST /task-lease-expirations and POST /cpt-miss-sweeps; no code in this repository schedules them. The Helm chart ships CronJobs for both, on by default (sweeps.enabled; every minute / every 5 minutes; ADR-0037).
  • WorkReleased.data.work_unit_id is a stable correlation key, reused as orderRef and returned as work_unit_id on TaskCompleted.
  • Hazard classification and location roles fail open: if the lookup is disabled or unavailable, sealing and registration proceed.
  • Downstream consumers deduplicate on the CloudEvents id (outbox retries reuse it) and on their own business key for TaskCPTMissed.

Verification Metrics​

MetricWhere
Completions, lease expiries, weigh-check diverts, claim-to-complete seconds per task type, station and hourthroughput_rollup (analytics DB), GET /reports/throughput
On-time-to-CPT: packages manifested on time vs latethroughput_rollup.packages_on_time_cpt / packages_late_cpt, MCP get_on_time_to_cpt
Queue depth per task typeGET /queues/{taskType}/depth, MCP get_queue_status
Report freshnessGET /reports/throughput/freshness
OpenTelemetry metrics (task completions, HTTP, Kafka)internal/observability/metrics.go (ADR-0019)

Open Questions​

  • Should a station have to be checked in before it can claim? Today ClaimNext ignores occupancy.
  • Should ItemPicked be raised (item-level Pick), or removed from the catalogue?
  • Should ItemArrivedAtRebin and OrderConsolidated be published, and to whom?
  • Who owns the schedule for the lease and CPT sweeps in production? Decided 2026-10-06: the chart's CronJobs, on by default — expire-leases every minute, sweep-cpt-misses every 5 minutes, both configurable per environment (ADR-0037). TaskCPTMissed volume scales with the CPT sweep's frequency.
  • When does the WCS seam get its first method, and which vendor protocol does it translate?
  • MCP governance: authentication was removed fleet-wide (ADR-0022); the governance charter §7–§8 remain unmet.