Skip to main content

Bounded context canvas

Synced from slotting-optimization

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​

DimensionValue
DomainSupporting (Subdomain classification)
TierWMS, CloudEvents subdomain wms
Business modelCost reduction (pick travel and labor)
EvolutionCustom-built, genesis

Domain roles​

  • Policy engine: computes a proposal from declarative inputs (planning.Planner, policy abc-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/.

CollaboratorMessageKindChannel
order-managementSiteSkuDemandChangedeventwarehouse.order-management.events
product-masterProductClassified, ProductDimensionsDeclared, ProductMeasuredeventswarehouse.product-master.events
facility-layoutZoneRegistered, LocationSlotRegistered, LocationSlotDecommissionedeventswarehouse.facility.events
inventory-storageStockRelocatedeventwarehouse.inventory.events (execution progress, ADR 0010)
planner (human, or the web remote slotting_mfe)Generate slot plan, Approve, RejectcommandsPOST /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 velocityqueriesGET /slot-plans/{planId}, GET /slot-plans, GET /forward-slots, GET /sku-velocity
warehouse-ops-agent (its ADR 0024, slot-plan watch) and any MCP clientGet plan, List plans (the agent); Forward slots, SKU velocity (other clients)queriesMCP get_slot_plan, list_slot_plans, get_forward_slots, get_sku_velocity (cmd/mcp, read-only)
warehouse-console reports screenSlot-plan funnel, freshnessqueriesGET /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.

MessageKindChannelConsumers
SlotPlanGeneratedeventwarehouse.slotting-optimization.events and warehouse.slotting-optimization.analyticsno sibling (wes-work-planning and pick-face-replenishment skip it); this repository's slotting-projector reads the analytics copy
SlotPlanApprovedeventsamewes-work-planning (RELOCATE work per move, its ADR 0040; ADR 0010), pick-face-replenishment (forward assignment map, ApplyForwardAssignmentMap); slotting-projector (analytics copy)
SlotPlanRejectedeventsameno 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​

DecisionRule in code
Who is a candidateSKUs with at least one ACTIVE demand line due in the window
Rank of candidatespicks desc, units desc, SKU asc
ABC classcumulative pick share before the SKU: below 80 % is A, below 95 % is B, else C
Which slots are forward slotsactive, role Storage, zone of the site, zone code in FORWARD_ZONE_CODES
Eligibilityhazmat matches, temperature class matches (empty is Ambient), one unit fits volume and weight
Slot rankinglexical by location code (v1, a port)
Churn limitkeep the previous slot when still eligible and free
Human approvalnothing becomes the site's map without approve; one Approved plan per site

Assumptions​

  • Forward slots are Storage slots in zones listed in FORWARD_ZONE_CODES (default FWD); one SKU per forward slot.
  • The demand site_id equals the facility siteCode (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 on develop: wes-work-planning (RELOCATE work) and pick-face-replenishment (forward assignment map). No sibling reads SlotPlanGenerated or SlotPlanRejected.
  • A travel-distance ranking needs layout geometry the consumer does not read yet (LocationGeometryUpdated is ignored today).