Skip to main content

Context map

Following the ddd-crew Context Mapping notation: every edge names the upstream (U) and downstream (D) side, the integration pattern(s) on each side, and the technology that carries it. This page is this bounded context's slice of the fleet map and is part of the DDD artifact pack.

Current state, verified against each repository's develop

facility-layout has no outbound dependency on any other service: it calls no one and consumes no other context's events. It is upstream of thirteen backend contexts — inventory-storage, inbound-receiving, dock-scheduling, yard-management, outbound-shipping, slotting-optimization, pick-face-replenishment, task-interleaving, warehouse-planning, wes-work-planning, fulfillment-execution, warehouse-ops-agent and network-inventory-planning — and of its own browser micro-frontend. Consumers that call it synchronously keep a permissive default in their binaries (wes-work-planning, fulfillment-execution), but warehouse-infra switches both to http on develop, so in the cluster those two edges are live. inventory-storage no longer has a permissive mode (its ADR 0042): LOCATION_LOOKUP_MODE is kafka or http.

The map​

Source: internal/adapters/outbound/kafka/publisher.go, internal/adapters/inbound/http/server.go, internal/adapters/inbound/mcp/tools.go, and the consumer files in the table below (each sibling repository's develop).

Arrows point from upstream to downstream — the direction the model flows — not the direction of the network call: a REST consumer initiates the request, but it conforms to this context's model. A solid line is live wiring; a dashed line is wired in code but opt-in or a rollback path; workforce-management is linked invisibly to show Separate Ways. Omitted: the browser micro-frontend (facility-mfe, not a bounded context — see below), e2e test harnesses, and the .dlq topics.

Relationships, with evidence​

#DownstreamU/D patternsTechnologyStatusEvidence
1inventory-storageU: OHS + PL · D: Conformist + ACL (local location-classification cache)Kafka warehouse.facility.events — com.warehouse.wms.facility-layout.zone.ZoneRegistered, com.warehouse.wms.facility-layout.locationslot.LocationSlotRegistered, com.warehouse.wms.facility-layout.locationslot.LocationSlotDecommissioned, com.warehouse.wms.facility-layout.locationslot.LocationSlotHandlingUnitDeclaredLive when LOCATION_LOOKUP_MODE=kafka (process-unique group, replay from the first offset, readiness gated on catch-up)inventory-storage: internal/adapters/outbound/facilitycache/consumer.go; this repo: ADR 0013
2inventory-storageU: OHS + PL · D: ConformistREST GET /locations/{locationCode}/classificationWired, rollback path (LOCATION_LOOKUP_MODE=http + FACILITY_LAYOUT_BASE_URL)inventory-storage: internal/adapters/outbound/facilitylayout/client.go; ADR 0008
3warehouse-planningU: OHS + PL · D: Conformist + ACL (hand-mirrored payload folded into a position/station tally)Kafka warehouse.facility.events — com.warehouse.wms.facility-layout.locationslot.LocationSlotRegistered, com.warehouse.wms.facility-layout.locationslot.LocationSlotDecommissionedLive whenever KAFKA_BROKERS is set (group STORAGE_CAPACITY_CONSUMER_GROUP, default warehouse-planning-storage-capacity)warehouse-planning: internal/adapters/inbound/kafka/storage_capacity_consumer.go, cmd/api/main.go
4wes-work-planningU: OHS + PL · D: ConformistREST GET /distance?from=&to= → metresM, estimated, routeLive (TRAVEL_DISTANCE_MODE=http + FACILITY_LAYOUT_BASE_URL, both set in warehouse-infra helm-values/wes-work-planning.yaml; the binary default is permissive)wes-work-planning: internal/adapters/outbound/traveldistance/client.go
5fulfillment-executionU: OHS + PL · D: ConformistREST GET /locations/{locationCode} — the slot's roleLive (LOCATION_ROLE_MODE=http + FACILITY_LAYOUT_BASE_URL, set in warehouse-infra helm-values/fulfillment-execution.yaml since 2026-10-17; the binary default is still permissive, and an unknown location passes)fulfillment-execution: internal/adapters/outbound/facilitylayout/client.go; ADR 0016
6warehouse-ops-agentU: OHS + PL · D: ConformistMCP (Streamable HTTP) tools list_sites, get_site_layout, get_zone_grid, estimate_travel_distance; REST GET /reports/catalog-growth (+ /freshness) on cmd/facility-reportsLive (FACILITY_LAYOUT_MCP_ENDPOINT, FACILITY_LAYOUT_REPORTS_REST_URL)warehouse-ops-agent: internal/adapters/outbound/mcpclient/facility_layout.go, internal/config/config.go
7own analytics read sidesame bounded context, not a context relationshipKafka warehouse.facility.analytics, group facility-analyticsLivethis repo: internal/adapters/inbound/kafka/analytics_consumer.go; ADR 0010
8workforce-managementSeparate Ways—Deliberately absent — it stops at the process-path boundary and never links an associate to a locationno client or consumer in its code
9network-inventory-planningU: OHS + PL · D: Conformist + ACL (hand-mirrored snake_case payload upserted into its site_capability read model, last-write-wins on capability_revision, kept fresh by the producer's periodic heartbeat, ADR 0041)Kafka warehouse.facility.events — com.warehouse.wms.facility-layout.site.SiteCapabilityChanged, raised by PUT /sites/{siteCode}/transfer-capability (ADR 0035)Live when its KAFKA_BROKERS and SITE_CAPABILITY_CONSUMER_GROUP are set (warehouse-infra sets network-inventory-planning-site-capability)network-inventory-planning: internal/adapters/inbound/kafka/consumers.go (SiteCapabilityConsumer)
10inbound-receivingU: OHS + PL · D: Conformist + ACL (local dock_doors copy)Kafka warehouse.facility.events — ...locationslot.LocationSlotRegistered (only role=Dock with dockFlow Inbound or Both is kept) and ...LocationSlotDecommissionedLive, always on (DOCK_DOOR_CONSUMER_GROUP required; warehouse-infra sets inbound-receiving-dock-doors)inbound-receiving: internal/adapters/inbound/kafka/dock_door_consumer.go
11slotting-optimizationU: OHS + PL · D: Conformist + ACL (local layout copy)Kafka warehouse.facility.events — ...zone.ZoneRegistered, ...LocationSlotRegistered, ...LocationSlotDecommissionedLive (layoutMode: kafka, group slotting-optimization-layout in warehouse-infra)slotting-optimization: internal/adapters/inbound/kafka/layout_consumer.go
12pick-face-replenishmentU: OHS + PL · D: Conformist + ACL (local layout copy)Kafka warehouse.facility.events — ...zone.ZoneRegistered, ...LocationSlotRegistered, ...LocationSlotDecommissionedLive (group pick-face-replenishment-layout in warehouse-infra)pick-face-replenishment: internal/adapters/inbound/kafka/layout_consumer.go
13task-interleavingU: OHS + PL · D: Conformist + ACL (local layout copy)Kafka warehouse.facility.events — ...zone.ZoneRegistered, ...LocationSlotRegistered, ...LocationSlotDecommissioned, ...LocationGeometryUpdatedLive (group task-interleaving-layout in warehouse-infra)task-interleaving: internal/adapters/inbound/kafka/layout_consumer.go
14dock-schedulingU: OHS + PL · D: Conformist + ACL (zone-to-site join and a dock-door view)Kafka warehouse.facility.events — ...zone.ZoneRegistered, ...LocationSlotRegistered (only an explicit role=Dock slot becomes a bookable door), ...LocationSlotDecommissionedLive, always on (FACILITY_CONSUMER_GROUP required)dock-scheduling: internal/adapters/inbound/kafka/facility_consumer.go
15yard-managementU: OHS + PL · D: Conformist + ACL (local zones and locations copies)Kafka warehouse.facility.events — ...zone.ZoneRegistered, ...LocationSlotRegistered (only role=Yard spots and role=Dock doors are kept), ...LocationSlotDecommissionedLive, always on (FACILITY_CONSUMER_GROUP required)yard-management: internal/adapters/inbound/kafka/facility_consumer.go
16outbound-shippingU: OHS + PL · D: Conformist + ACL (layout copy: zoneId, role)Kafka warehouse.facility.events — ...zone.ZoneRegistered, ...LocationSlotRegistered (not LocationSlotDecommissioned)Live, always on (LAYOUT_CONSUMER_GROUP required)outbound-shipping: internal/adapters/inbound/kafka/cpt_layout_consumers.go
—order-management, process-path-management, labor-performance, network-fulfillment, product-masterno relationship—Absent — no client of this context's REST/MCP surface and no consumer of its topics on develop; product-master (SKU master data, the third wms context) neither calls this service nor consumes warehouse.facility.events, and this service consumes nothing from itorg-wide code search for FACILITY_LAYOUT and warehouse.facility.events
—anything this context calls——Deliberately absent — facility-layout has no outbound adapter to another service, everinternal/adapters/outbound/ holds only Postgres, memory, Kafka publishers, telemetry, boot-retry and analytics-store adapters

On warehouse.facility.events, nine of the fifteen event types have no external consumer today: SiteRegistered, SiteRoleChanged, AisleRegistered, LocationTypeRegistered, PlacementRuleDefined, FacilityLayoutImported, AisleGeometryUpdated, FixedStructureRegistered and CrossAisleRegistered. The consumed six are ZoneRegistered, LocationSlotRegistered, LocationSlotDecommissioned, LocationSlotHandlingUnitDeclared (inventory-storage), LocationGeometryUpdated (task-interleaving) and SiteCapabilityChanged (network-inventory-planning).

The console: a live, browser-facing client that is not a context​

Besides the backend consumers above, this service has one live integration outside the backend fleet: facility-mfe, a Module Federation remote owned in this repo's own web/ directory, calling this service's own REST API directly from the browser — the read models (sites, layout, grid, /distance) and the configuration writes (sites, zones, aisles, location types, placement rules, slots, bulk import; ADR 0027). It is composed at runtime by the separate warehouse-console shell repo, per ADR-0011, which adopts the fleet-wide decision recorded in warehouse-ops-agent's ADR-0002.

This is not a bounded-context relationship in the Evans/Vernon sense — warehouse-console has no domain model and owns no aggregate — but it is a real inbound HTTP surface (browser → this service's REST API, through the CORS middleware configured by CORS_ALLOWED_ORIGINS). It is deliberately separate from the "no outbound dependency, ever" property discussed below: a UI client calling this service's own published REST API is the same category of consumer as any other REST client.

facility-layout is explicitly not one of the services warehouse-ops-agent's console-bff fans out to for the cross-cutting Order Lifecycle screen — it has no order reference in its own aggregates. Its role in the console is limited to facility-mfe's own screens over its own data.

What is not built (open)​

Nothing on this page is "planned" in the sense of a scheduled change; these two are the open edges, verified against develop of the owning repos:

  • Event-driven travel input for wes-work-planning. Open. It still reads distance synchronously (cmd/wes/repositories.go, TRAVEL_DISTANCE_MODE=http) and no code on its develop consumes AisleRegistered, AisleGeometryUpdated or CrossAisleRegistered. Partly overtaken: task-interleaving keeps a local layout copy from warehouse.facility.events including LocationGeometryUpdated (row 13), but it does not build a travel graph.
  • Routed cross-zone travel. Open. The travel graph is per zone. Across zones, /distance and estimate_travel_distance return a straight-line (beeline) estimate flagged estimated: true when both slots carry recorded position geometry, and refuse (422 no-route-between-zones) otherwise (internal/application/usecases/estimate_travel_distance.go:38-41; ADR 0017).

The strategic relationship, in context-mapping vocabulary​

Open Host Service + Published Language​

This service defines an Open Host Service: a stable, general-purpose protocol any number of consumers may use, rather than a bilateral contract negotiated per consumer. Its Published Language is the fifteen past-tense domain events (CloudEvents 1.0, com.warehouse.wms.facility-layout.<entity>.<EventName>) plus the REST and MCP surfaces, expressed in its own vocabulary (LocationCode, Zone, Aisle, LocationType, PlacementRule).

Two design choices exist to make that language publishable:

  • LocationSlotRegistered denormalises zoneId and aisleId into the payload. A consumer routing on zone must not have to know how to parse this context's code format. A Published Language that requires the consumer to reimplement the producer's parsing is a leaked internal representation.
  • The EventPublisher port is a single method, Publish(ctx, event) error — the shape a Kafka producer satisfies, which is why adding the broker adapter (ADR 0009) was purely additive.

Conformist (and ACL), downstream​

The consumers are Conformists: they accept this context's model rather than negotiating a shared one. The event consumers additionally keep an anti-corruption layer of their own — inventory-storage folds the events into a zone/location classification cache keyed the way its stow check needs (the SKU side of that check comes from its local copy of product-master's classification, not from here), inbound-receiving into a dock-door table, slotting-optimization, pick-face-replenishment and task-interleaving into their own layout copies, and warehouse-planning folds them into a capacity tally — so none adopts LocationSlot as an internal type. That is the right pattern precisely because this is a Generic Subdomain: there is nothing to differentiate by modelling location differently.

No outbound dependency, ever​

The most important property of this context map is a non-edge: nothing points out of facility-layout into another context. It does not read inventory-storage's stock. It does not know what a Task, an Assignment, a Wave or a Shift is. None of its consumers get write access to its aggregates.

A context that everyone depends on has to be cheap to depend on. No coupling back means no startup ordering constraints, no circular deployment dependencies, and no cascade beyond a plain read failure.

Why this is a Generic Subdomain at all​

The platform's DDD reference lists, among the disciplines to enforce:

Extract generic logic instead of duplicating it. Cartonization is a good example: rather than implementing box-selection logic separately in both WMS (for planning/estimates) and WES (at point of pack), model it as its own Generic Subdomain both contexts call into.

Physical location is the same case in a different costume: needed by the WMS tier for stow validity, needed by the WES tier for travel and capacity, owned by neither. See Subdomain classification and the Core Domain Chart.

Where to go next​

How a new consumer should integrate — which endpoint or event, and the rules it must follow — is on Consuming this service.