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
Source: internal/adapters/inbound/http/server.go, internal/adapters/inbound/kafka/*_consumer.go,
internal/adapters/outbound/events/encoder.go, ADR 0001 canvas. Dashed boxes are edges with no consumer or caller yet. A
solid box is built on develop; deployment state is on Integration.
Name
pick-face-replenishment
Purpose
Keep every forward pick face stocked between its minimum and maximum by requesting a move from the best reserve bin, and close the request when the ledger records the move.
Strategic classification
Supporting subdomain, WMS tier (reasoning). Business model: cost reduction (no empty forward pick face, fewer short picks). Evolution: custom-built (genesis).
Domain roles
- Policy holder: owns the min/max rule per site and SKU.
- Work generator: raises replenishment requests from levels, from a new forward map, from the sweep, or by hand.
- Closer: completes a request from the ledger's
StockRelocated.
Inbound communication
| Message | Type | Sender | Channel | Collaborator behaviour |
|---|---|---|---|---|
PUT /policies/{siteId}/{sku} | command | planner, console | REST | declare or change a policy (If-Match) |
DELETE /policies/{siteId}/{sku} | command | planner | REST | remove a policy, cancel its open requests |
POST /replenishments | command | planner, agent | REST | raise a request by hand (Idempotency-Key) |
POST /replenishments/{requestId}/cancellations | command | planner | REST | cancel an open request (Idempotency-Key) |
POST /sites/{siteId}/evaluations | command | planner, agent | REST | sweep a site (Idempotency-Key) |
GET /policies, /policies/{siteId}/{sku}, /pick-faces, /replenishments, /replenishments/{requestId} | query | planner, console, agent | REST | read |
com.warehouse.wms.inventory-storage.stock.BinStockLevelChanged | event | inventory-storage | Kafka warehouse.inventory.events | absolute bin level, versioned (inventory-storage ADR 0040) |
com.warehouse.wms.inventory-storage.stock.StockRelocated | event | inventory-storage | Kafka warehouse.inventory.events | completes a request when reason is REPLENISHMENT (produced for a completed REPLENISH task, inventory-storage ADR 0041) |
com.warehouse.wms.slotting-optimization.slotplan.SlotPlanApproved | event | slotting-optimization | Kafka warehouse.slotting-optimization.events | full forward map |
com.warehouse.wms.facility-layout.zone.ZoneRegistered | event | facility-layout | Kafka warehouse.facility.events | zone code per zone |
com.warehouse.wms.facility-layout.locationslot.LocationSlotRegistered | event | facility-layout | Kafka warehouse.facility.events | location, its zone and role |
com.warehouse.wms.facility-layout.locationslot.LocationSlotDecommissioned | event | facility-layout | Kafka warehouse.facility.events | location retired |
Outbound communication
| Message | Type | Receiver | Channel |
|---|---|---|---|
com.warehouse.wms.pick-face-replenishment.replenishment.ReplenishmentRequested | event | wes-work-planning (plans one REPLENISH work unit per request id; opt-in through REPLENISHMENT_MODE=kafka, its ADR 0042) | Kafka warehouse.pick-face-replenishment.events and .analytics |
com.warehouse.wms.pick-face-replenishment.replenishment.ReplenishmentCompleted | event | anyone (wes-work-planning ignores it) | Kafka ...events and ...analytics |
com.warehouse.wms.pick-face-replenishment.replenishment.ReplenishmentCancelled | event | wes-work-planning (withdraws its unit only while Pending) and anyone | Kafka ...events and ...analytics |
com.warehouse.wms.pick-face-replenishment.policy.ReplenishmentPolicyDeclared | event | analytics | Kafka ...analytics only |
| REST responses | query results | planner, console, agent | REST |
<topic>.dlq dead letters | event | operators | Kafka |
Ubiquitous language
See the glossary. Key terms: pick face, forward bin, reserve bin, policy (min, max, multiple), request, projected level, priority, source bin policy, usable stock.
Business decisions
- A face is low when
projected <= minQty, withprojected = on_hand - reserved + open request quantity. - How much: up to
maxQty, rounded down to a multiple, capped at the source's usable stock. - Which reserve bin: the one with the most usable stock, ties to the smallest bin code (
fullest-reserve-bin-v1). URGENTwhen nothing is available.- At most one open request per pick face.
- When a request is cancelled: operator, a newer slot plan that drops the assignment, or policy removal.
- A request completes only on a matching
REPLENISHMENTrelocation.
Assumptions
- Reserve bins are Storage locations in zones listed in
RESERVE_ZONE_CODES(defaultRSV); forward faces are inFORWARD_ZONE_CODES(defaultFWD). - One SKU per forward slot; the forward bin of a SKU is its slot in the last approved slot plan.
- A bin never seen reads as level 0 (ADR 0005).
- The execution chain is built end to end on
develop: wes-work-planning plans oneREPLENISHwork unit perReplenishmentRequested(its ADR 0042; started only withREPLENISHMENT_MODE=kafka), process-path-management declares theREPLENISHpath (its ADR 0036), fulfillment-execution runs theREPLENISHtask (its ADR 0050) and inventory-storage records a relocation with reasonREPLENISHMENT(its ADR 0041). Inwarehouse-infrathe service is registered and wes-work-planning hasREPLENISHMENT_MODE=kafka; cluster state was not checked.
Verification metrics
Domain coverage gate 90 %; mutation efficacy and mutant coverage thresholds 90 % (measured 100 %); 57 BDD scenarios; golden bytes per published type; fitness tests (Testing). The service exports no runtime metrics (Observability).
Open questions
- Producer changes P1 (
BinStockLevelChanged, inventory-storage ADR 0040), P3 and P3b (REPLENISHwork in wes-work-planning, its ADR 0042, with theREPLENISHpath in process-path-management ADR 0036) and P4 (reasonREPLENISHMENTonStockRelocated, inventory-storage ADR 0041) are all built, and fulfillment-execution runs theREPLENISHtask (its ADR 0050) (ADR 0001, 0003). What remains is operational: the wes-work-planning consumer is off unlessREPLENISHMENT_MODE=kafkawithREPLENISHMENT_CONSUMER_GROUPis set (the defaultpermissiveconsumes nothing), theREPLENISHpath has to be seeded withscripts/seed_catalogue.py(until then wes-work-planning dead-letters the requests), andwarehouse-infrasetsREPLENISHMENT_MODE=kafka(so the consumer is on there) but does not seed the path. - slotting-optimization's relocation consumer acts only on reason
SLOTTINGand counts every other reason, includingREPLENISHMENT, as unmatched (internal/application/usecases/record_relocation.go), so the clash ADR 0003 records no longer exists. - No data retention exists for
outbox_events,processed_eventsandidempotency_keys(Runbook).