Bounded-Context Relationships
This page is the strategic view — the DDD relationship patterns. The technical view (topics, envelopes, payloads) is on the Ecosystem pages.
Pattern vocabulary
Using the patterns as warehouse-systems-ddd.md and
fulfillment-reference-ddd.md use them:
| Pattern | Meaning |
|---|---|
| OHS — Open Host Service | A context exposes a well-defined, public protocol for many consumers, rather than a bespoke integration per consumer. |
| PL — Published Language | The shared, documented vocabulary that protocol speaks (here: the REST DTOs + the event catalog). |
| C/S — Customer/Supplier | Upstream supplies something downstream needs; downstream's needs have standing with upstream. |
| CF — Conformist | Downstream accepts upstream's model as-is, with no translation leverage. |
| ACL — Anti-Corruption Layer | Downstream translates upstream's model into its own, so upstream concepts never leak inward. |
This context's role: Open Host Service, upstream
inventory-storage is an Open Host Service for two things:
- bin-accurate location — where stock physically is, and
- usable inventory — what portion of it can be promised.
Its Published Language has two surfaces:
- REST (
apis/openapi.yaml) — synchronous queries and commands. - Events (
apis/asyncapi.yaml, topicwarehouse.inventory.events) — asynchronous facts.
Both are versioned, Spectral-linted artefacts in the repository, not implementation details. That is what makes it an Open Host Service rather than a set of point-to-point integrations: a sixth consumer could arrive tomorrow and integrate from the published spec without this repo changing.
The reference model states the position directly:
Planning ↔ Inventory & Storage: Customer/Supplier. Planning asks "can I allocate?"; Inventory is the authoritative supplier of stock + bin location (its Open-Host Service exposes bin-accurate location as Published Language).
The map
Every edge above is implemented today. Arrows point upstream → downstream,
not in the direction of the network call: order-management calls this
service, but it is the downstream customer of this service's REST OHS.
network-fulfillment reads GET /inventory/{sku}/usable, and
warehouse-ops-agent reads GET /reservations?demandRef=, the Flow &
Accuracy report and two MCP read tools — the same OHS, omitted from the
diagram for legibility. See the
Context Map for every wire. No sibling reads
GET /products/{sku}/classification any more (the route is gone, ADR 0034).
Relationship by relationship
inventory-storage → wes-work-planning — Customer/Supplier, Conformist downstream
The consumer of this service's reservation events (StockReserved,
ReservationRevoked).
- Direction: upstream (supplier). This service publishes; Work Planning consumes.
- Pattern: Customer/Supplier with Work Planning as a Conformist to this
service's Published Language. It takes
StockReserved/ReservationRevokedin the shape they are published and projects them into its ownUsableInventoryObservedread model keyed by SKU — it does not negotiate the shape, and it does not get write access. - Why no write access:
warehouse-systems-ddd.mdis explicit — "WES does not get write access to WMS's Order/Inventory aggregates — only to the published events/API." Reserving stock is aPOST /reservationscall against this service's own API, which runs this service's own invariants. There is no path by which a WES-tier service can mutate aStockUnitdirectly. - The ACL runs in both directions. This context never learns what a "work
unit," a "CPT," a "process path" or a "station" is. Work Planning never
learns what a
StockUnit, aBinor anAllocationis — it holds only an observed usable count per SKU. That mutual ignorance is the boundary working.
inventory-storage ← fulfillment-execution — Conformist, one event, wired over Kafka
fulfillment-execution consumes warehouse.work-planning.events
(WorkReleased) and publishes warehouse.fulfillment.events; it does not
subscribe to warehouse.inventory.events. This service subscribes to exactly one
of its types, TaskCompleted, and conforms to it as published (no translation
layer). It makes no call the other way: its handling classification comes
from its own local copy of product-master's ProductClassified (its ADR 0039),
not from this service.
Strategically that is right: fulfillment-execution owns the task lifecycle
and needs work to do, not stock truth. The accounting consequence of a pick
reaches this service as an event, never as a synchronous call.
Decided 2026-10-06, implemented by ADR 0035 (supersedes ADR
0032), made per-line by ADR 0036 (2026-10-07): for a PICK task
with an order_ref (the OrderId, = a reservation's demand_ref) and the additive
line_no, ConfirmPicksForOrder confirms exactly the ACTIVE reservation of
(order_ref, line_no) through the existing ConfirmPick use case, in the same
transaction as the event's dedupe claim; the order's other lines stay ACTIVE.
Reservation stores the line (order-management sends lineNo when it reserves).
For a message without line_no, or for reservations made before the field existed,
the ADR 0035 fallback counts the order's completed PICK tasks and, when the last
one completes, confirms every ACTIVE reservation of the order; earlier picks only
record progress, because confirming early would mark unpicked lines as picked.
Neither fulfillment-execution nor
wes-work-planning ever calls POST /reservations/{id}/pick-confirmations.
order_ref and line_no are additive optional fields of TaskCompleted v1 that
fulfillment-execution publishes (its internal/adapters/outbound/kafka/publisher.go); a message without order_ref is a no-op, and the
consumer is
always on (TASK_COMPLETED_CONSUMER_GROUP, ADR 0042). A Task carries no SKU or quantity,
so short picks are not modelled. The
e2e-tests warehouse-day simulator and operators still use the REST route.
inventory-storage ← product-master — Conformist, wired over Kafka
product-master (WMS tier, Supporting subdomain) is the single source of
truth for SKU product master data, including the handling classification this
service's stow rules need. Since ADR 0034 this service no
longer owns that classification: it consumes
com.warehouse.wms.product-master.product.ProductClassified from
warehouse.product-master.events, as published (no translation layer), into a
version-guarded local copy in product_classifications
(ApplyProductClassification, consumer group from
PRODUCT_MASTER_CONSUMER_GROUP). StowStock's hazmat/temperature placement
(ADR 0009) and same-bin DOT segregation (ADR 0010) read that copy and stay
owned here — co-locating goods in a bin is still this context's job.
PUT and GET /products/{sku}/classification were removed at stage E
(2026-10-17): the router registers neither. The edge back was
migration-only: the legacy
com.warehouse.wms.inventory-storage.product.ProductClassified was emitted
solely by the one-shot republish-product-classifications backfill, which
product-master's legacy importer translated (product-master ADR 0003 stage B);
the type and the backfill were removed at stage E.
inventory-storage → slotting-optimization, pick-face-replenishment — Conformist downstream, wired over Kafka
Two WMS-tier Supporting contexts read this service's integration topic
warehouse.inventory.events as published, each into its own local read model
(no REST or MCP call into this service). slotting-optimization acts only on
StockRelocated (ADR 0039), the proof that a planned slot
move happened. pick-face-replenishment acts on BinStockLevelChanged
(ADR 0040) and StockRelocated. In the other direction this
service never calls either: stock moves arrive as TaskCompleted (RELOCATE,
REPLENISH) from fulfillment-execution and run through RelocateStock, which
stays the only writer of the ledger.
The reverse edge with slotting-optimization is also Kafka: this service consumes its SlotPlanApproved from
warehouse.slotting-optimization.events into a local forward-slot map (forward_pick_face_plans,
forward_pick_faces) that ReserveStock draws first (ADR 0050); no call is made to
slotting-optimization at reservation time.
inventory-storage ↔ workforce-management — no relationship
Labour planning and inventory truth share no concepts. workforce-management
publishes ShiftPlanCommitted on warehouse.workforce.events, consumed by
Work Planning only. Keeping these two contexts unrelated is the concrete form
of the rule that worker identity must not leak into the system of record.
inventory-storage ← facility-layout — Conformist, wired over Kafka
facility-layout is a Generic subdomain and an Open Host Service for
physical warehouse structure: Site → Area → Zone → Aisle → Bay → Level → Position, LocationType, PlacementRule, LocationSlot. Its own CLAUDE.md
positions the other services — this one included — as downstream
Conformists to whatever it publishes.
This service now conforms to it in code. With LOCATION_LOOKUP_MODE=kafka
(what the warehouse-infra cluster runs), internal/adapters/outbound/facilitycache
consumes warehouse.facility.events — ZoneRegistered,
LocationSlotRegistered, LocationSlotDecommissioned, taken in
facility-layout's own shape with no translation layer — into a local,
in-memory read model of zone hazmat rating and temperature class per location
code (ADR 0013).
StowStock reads that model to enforce ADR 0009's hazmat/temperature
placement rules for classified SKUs. The synchronous
GET /locations/{locationCode}/classification call ADR 0009 first
introduced survives as LOCATION_LOOKUP_MODE=http, the rollback.
What is still not built, and remains the intended shape:
facility-layoutas the source of truth for whether aBinIdis a real, active, correctly-typed slot —StowStockstill only checks that the bin exists in this service's ownLocationRepo;- placement policy beyond hazmat and temperature class (size fit, the
Oversized/HighValue/Fragiletags) — none of it is enforced, and when it is, the policy belongs infacility-layout'sPlacementRulemodel, not here; that would be re-introducing fixed slotting through the back door.
A Bin in this context remains an id, a capacity and an occupancy. Since
ADR 0025 it is registered declaratively over REST (PUT /bins/{binId}, by
inventory control or a simulator), not seeded as infrastructure data — but
nothing checks that id against facility-layout's slot catalogue.
order-management → inventory-storage — Customer/Supplier, synchronous
order-management is a downstream customer of this service's REST Open
Host Service: order allocation reserves stock with POST /reservations, and
cancellation revokes it with DELETE /reservations/{id}. Every call runs
through this service's own invariants; order management gets no write access
to a StockUnit, and the edge is gated on its side by INVENTORY_STORAGE_MODE
(defaulting to a no-network permissive stub). Order intake no longer reads
classification here: order-management keeps its own local copy of
product-master's ProductClassified (its ADR 0036).
Disciplines this map enforces
From warehouse-systems-ddd.md, applied literally in this repository:
- No shared aggregates across contexts. No Go type in this module is imported by any sibling; no sibling type is imported here. Integration is JSON over Kafka and HTTP.
- Same word, different model is allowed. "Location," "Reservation" and "Pick" all mean different things one service over — see the Ubiquitous Language table.
- Model synchronization explicitly. Fan-in across concurrent work
(
OrderConvergence) is a WES concern and is absent here by design; this context has no cross-order coordination concept at all. - Classify strategically before modelling tactically. Core classification is what justifies the domain-purity rules and the quality bar; it is also what justifies not building a facility-layout model here just because it would be convenient.