Bounded context canvas
This page is a copy of docs/docs/ddd/bounded-context-canvas.md on develop, derived from that repository's code. Edit it there, then re-sync.
ddd-crew Bounded Context Canvas v5,
filled from the code on develop and ADR 0001.
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
slotting-optimization
Purpose
Decide, explainably and repeatably, which SKUs get a forward pick slot and which slot each one gets; let a person approve or reject that proposal; and publish the approved assignment map with the physical moves it implies.
Strategic classification
| Dimension | Value |
|---|---|
| Domain | Supporting (Subdomain classification) |
| Tier | WMS, CloudEvents subdomain wms |
| Business model | Cost reduction (pick travel and labor) |
| Evolution | Custom-built, genesis |
Domain roles
- Policy engine: computes a proposal from declarative inputs
(
planning.Planner, policyabc-velocity-v1). - Approval workflow: a Draft becomes Approved or Rejected by a human decision; the previous Approved plan of the site becomes Superseded.
Inbound communication
Source: internal/adapters/inbound/kafka/{demand,product,layout,stock}_consumer.go,
internal/adapters/inbound/http/server.go, internal/adapters/inbound/mcp/.
| Collaborator | Message | Kind | Channel |
|---|---|---|---|
| order-management | SiteSkuDemandChanged | event | warehouse.order-management.events |
| product-master | ProductClassified, ProductDimensionsDeclared, ProductMeasured | events | warehouse.product-master.events |
| facility-layout | ZoneRegistered, LocationSlotRegistered, LocationSlotDecommissioned | events | warehouse.facility.events |
| inventory-storage | StockRelocated | event | warehouse.inventory.events (execution progress, ADR 0010) |
planner (human, or the web remote slotting_mfe) | Generate slot plan, Approve, Reject | commands | POST /slot-plans, POST /slot-plans/{planId}/approvals, POST /slot-plans/{planId}/rejections |
planner (human, or the web remote slotting_mfe) | Get plan, List plans, Forward slots, SKU velocity | queries | GET /slot-plans/{planId}, GET /slot-plans, GET /forward-slots, GET /sku-velocity |
| warehouse-ops-agent (its ADR 0024, slot-plan watch) and any MCP client | Get plan, List plans (the agent); Forward slots, SKU velocity (other clients) | queries | MCP get_slot_plan, list_slot_plans, get_forward_slots, get_sku_velocity (cmd/mcp, read-only) |
| warehouse-console reports screen | Slot-plan funnel, freshness | queries | GET /reports/slot-plan-funnel, GET /reports/freshness on cmd/slotting-reports (no Kong route to it, see Integration) |
Outbound communication
Source: internal/adapters/outbound/kafka/encoder.go (FanoutEncoder), ADR 0001 (context map), ADR 0006.
| Message | Kind | Channel | Consumers |
|---|---|---|---|
SlotPlanGenerated | event | warehouse.slotting-optimization.events and warehouse.slotting-optimization.analytics | no sibling (wes-work-planning and pick-face-replenishment skip it); this repository's slotting-projector reads the analytics copy |
SlotPlanApproved | event | same | wes-work-planning (RELOCATE work per move, its ADR 0040; ADR 0010), pick-face-replenishment (forward assignment map, ApplyForwardAssignmentMap); slotting-projector (analytics copy) |
SlotPlanRejected | event | same | no sibling; slotting-projector (analytics copy) |
Ubiquitous language
SlotPlan, window, lookback, policy, Draft, Approved, Rejected, Superseded, assignment, move (Assign, Relocate, Vacate), unassigned (NoEligibleSlot, NoPhysicalProfile, NoCapacityFit), ABC class, velocity (picks, units), forward slot, eligibility, stickiness, local copy. Full glossary: Ubiquitous language.
Business decisions
| Decision | Rule in code |
|---|---|
| Who is a candidate | SKUs with at least one ACTIVE demand line due in the window |
| Rank of candidates | picks desc, units desc, SKU asc |
| ABC class | cumulative pick share before the SKU: below 80 % is A, below 95 % is B, else C |
| Which slots are forward slots | active, role Storage, zone of the site, zone code in FORWARD_ZONE_CODES |
| Eligibility | hazmat matches, temperature class matches (empty is Ambient), one unit fits volume and weight |
| Slot ranking | lexical by location code (v1, a port) |
| Churn limit | keep the previous slot when still eligible and free |
| Human approval | nothing becomes the site's map without approve; one Approved plan per site |
Assumptions
- Forward slots are
Storageslots in zones listed inFORWARD_ZONE_CODES(defaultFWD); one SKU per forward slot. - The demand
site_idequals the facilitysiteCode(ADR 0003 calls for verifying this against live data). - The local copies are current enough: a stale copy yields a partial plan that lists unplaceable SKUs instead of guessing.
Verification metrics
- Deterministic output: same input, same plan (planner tests).
- Mutation gate: 99 % efficacy and mutant coverage on both domain packages.
- Coverage gate: 90 % over domain and application.
- Golden CloudEvents tests per published type and
TestEventCatalogueMatchesContract.
Open questions
- Who executes the moves? Decided:
ADR 0010
(wes-work-planning RELOCATE work, inventory-storage records it; progress
comes back as
StockRelocated). Should a new proposal wait for the previous plan's execution? Not in v1. - Which consumer reads
SlotPlanApproved? Answered ondevelop: wes-work-planning (RELOCATE work) and pick-face-replenishment (forward assignment map). No sibling readsSlotPlanGeneratedorSlotPlanRejected. - A travel-distance ranking needs layout geometry the consumer does not read
yet (
LocationGeometryUpdatedis ignored today).