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.
Following the ddd-crew Bounded Context Canvas v5.
Every message row maps to a real route, MCP tool, port call or Kafka topic
in the code on develop.
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
Source: internal/adapters/inbound/http/server.go, internal/adapters/inbound/mcp/,
internal/adapters/inbound/kafka/ and internal/adapters/inbound/poller/poller.go
(the Inbound Communication table below maps each arrow to its route, tool or topic).
Outbound
Source: the Inbound Communication and Outbound Communication tables of this
page, which map to internal/adapters/inbound/{http,kafka,mcp,poller} 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
Network Fulfillment (network-fulfillment, CloudEvents subdomain wes).
Purpose
To be the one place where the fleet meets an external retail fulfillment
network. Since ADR 0009 the counterpart is the fleet's own retail-network
service; the original learning target was a large retailer's vendor platform
API. The context:
- receives the network's demand by polling;
- answers it inside the network's 24-hour window, acknowledged in full or
rejected in full, using
order-management's feasibility verdict; - reconciles each asynchronous submission before it releases any work;
- confirms shipment when it is told one happened;
- computes the throughput-constrained quantity it would advertise
(
CapabilityOffer).
The network's vocabulary never reaches the rest of the fleet, and no ship-to PII enters this context at all.
Strategic Classification
| Axis | Verdict |
|---|---|
| Domain | Supporting Subdomain (ADR 0001). See core-domain-chart.md. |
| Business Model | Revenue-channel enabler: it lets the building's fulfillment capability be sold through an external network without any other context knowing the network exists. |
| Evolution | Custom-built (the ACL and the acknowledgement protocol). CapabilityOffer is Genesis → Custom. The counterpart's API is a Product that this context conforms to. |
Domain Roles
| Role | Applies? | Evidence |
|---|---|---|
| Gateway / Anti-Corruption Layer | Yes, primary | The network vocabulary stops at internal/adapters/outbound/retailnetwork/. ports.NetworkGateway and contract.* are expressed in our terms, and NetworkOrder.SKUQuantities() is the only shape sent to order-management. |
| Execution (protocol) | Yes, narrow | Owns the answer, the 24h clock (acknowledgeBy, the sweep, RejectOverdueOrders) and reconciliation. It does not own the fulfillment work, which belongs to order-management. |
| Analysis | Yes, always on | RecomputeCapabilityOffers derives advertised availability from inventory, the CPT schedule and path capacity (wired at boot; CAPABILITY_OFFER_ENABLED is only a boot guard, ADR 0025). |
| Published Language / Open Host | Partly | Publishes 6 CloudEvents types on warehouse.network-fulfillment.events (documented in apis/asyncapi.yaml). No other fleet context was found consuming them. Read-only REST and MCP are exposed for operators and agents. |
Inbound Communication
| Collaborator | Message | Type | Channel | Relationship |
|---|---|---|---|---|
External network (retail-network; stub by default, live opt-in, ADR 0026) | Inbound demand (contract.InboundDemand) | Query (poll) | ports.NetworkGateway.PollDemand, driven by internal/adapters/inbound/poller | Conformist (we are downstream) |
| Operator / upstream caller | Confirm shipment | Command | REST POST /network-orders/{networkRef}/shipment-confirmation (ADR 0014) | Open Host (unauthenticated) |
Operators, web/ remote in warehouse-console | List unanswered orders | Query | REST GET /network-orders | Open Host |
| Operators | Get one order | Query | REST GET /network-orders/{networkRef} | Open Host |
Operators, web/ remote | Inbound leg health | Query | REST GET /inbound-status | Open Host |
| Operators | Capability offers | Query | REST GET /capability-offers | Open Host |
| Kubernetes / Prometheus | Liveness, readiness, metrics | Query | REST GET /healthz, GET /readyz, GET /metrics | — |
| MCP clients (AI agents) | Get / list network orders | Query | MCP get_network_order, list_network_orders, resource network-order://network-fulfillment/{networkRef} | Open Host (read-only) |
| MCP clients | List capability offers | Query | MCP list_capability_offers | Open Host (read-only) |
| MCP clients | Acknowledgement report | Query | MCP get_acknowledgement_report (when REPORTS_BASE_URL is set) | Open Host (read-only) |
| Report consumers | Acknowledgement & Translation report | Query | REST (cmd/netfulfil-reports) GET /reports/acknowledgement, GET /reports/acknowledgement/freshness | Open Host |
process-path-management | Path catalogue + CPT schedule | Event | Kafka warehouse.process-path-management.events: com.warehouse.wes.process-path-management.processpath.ProcessPathCreated, ...processpath.ProcessPathUpdated, ...processpath.ProcessPathDeactivated, com.warehouse.wes.process-path-management.cptschedule.CPTScheduleChanged | Conformist (always-on cache) |
wes-work-planning | Remaining path capacity | Event | Kafka warehouse.work-planning.events: com.warehouse.wes.work-planning.workpool.PathCapacityChanged | Conformist (always-on cache) |
| Itself (analytics projector) | Own events, for the report | Event | Kafka warehouse.network-fulfillment.analytics: ...networkorder.NetworkOrderReceived, ...NetworkOrderSubmitted, ...NetworkOrderAcknowledged.v2 (and the historic ...NetworkOrderAcknowledged v1), ...NetworkOrderRejected | Internal |
Outbound Communication
| Collaborator | Message | Type | Channel | Relationship |
|---|---|---|---|---|
order-management | Raise held order + feasibility verdict | Command | REST POST /orders (releaseOnAllocation: false, allowPartialShipment: false, requiredShipBy) | Customer/Supplier (we are the Customer; OM ADR 0020) |
order-management | Release held order | Command | REST POST /orders/{id}/releases | Customer/Supplier |
order-management | Cancel held order | Command | REST DELETE /orders/{id} (also the orphaned-hold sweep, which reads 404 and 409/422 as answers) | Customer/Supplier |
inventory-storage | Usable quantity per SKU | Query | REST GET /inventory/{sku}/usable (always on) | Conformist to its Open Host |
| External network | Acknowledge / reject in full | Command | ports.NetworkGateway.SubmitAcknowledgement(ref, accepted) (stub) | Conformist |
| External network | Transaction status | Query | ports.NetworkGateway.SubmissionStatus(ref) (stub) | Conformist |
| External network | Shipment confirmation | Command | ports.NetworkGateway.SubmitShipmentConfirmation(ref) (stub) | Conformist |
| External network | Node operational profile | Command | ports.NetworkGateway.DeclareNodeProfile(profile) from DeclareNodeProfiles (live mode; ADR 0027 part 1; the stub records it and sends nothing) | Conformist |
| External network | Inventory feed | Command | ports.NetworkGateway.SubmitInventoryFeed(feed) from FeedInventory (live mode; ADR 0027 part 2; replaces SubmitAvailability; the stub sends nothing) | Conformist |
| External network | Label | Command / Query | RequestLabel, called by ConfirmNetworkOrderShipment | Conformist |
| Any subscriber | NetworkOrderReceived, NetworkOrderSubmitted, NetworkOrderAcknowledged (v2, .v2 type), NetworkOrderRejected, NetworkOrderShipmentConfirmed, AcknowledgementDeadlineAtRisk, OrphanedHoldCancelled | Event | Kafka warehouse.network-fulfillment.events, type com.warehouse.wes.network-fulfillment.networkorder.<Event> (published through the outbox relay, always on) | Open Host / Published Language |
| Analytics projector | The same 7 events (it ignores NetworkOrderShipmentConfirmed, AcknowledgementDeadlineAtRisk and OrphanedHoldCancelled) | Event | Kafka warehouse.network-fulfillment.analytics | Internal |
Full message details: domain-events.md. Relationship evidence: context-map.md.
Ubiquitous Language
Full glossary: ubiquitous-language.md. Top terms:
NetworkOrder, NetworkRef, NetworkProductId (≠ SKU),
LocalOrderId, requiredShipBy, acknowledgeBy, held order,
Submitted (accepted-for-processing, not yet a commitment),
CapabilityOffer with Basis PHYSICAL / THROUGHPUT_CONSTRAINED,
RejectionReason.
Business Decisions
- Answer once, in full or not at all.
SubmitandRejectare each allowed only once (ErrAlreadyAnswered). There is no partial acknowledgement, and the held order is raised withallowPartialShipment: false. - One unknown product rejects the whole order inside the window, and
the refusal is recorded (
ReceiveUntranslatable,RejectionReasonUntranslatableSKU), not dropped. - Feasibility is asked, never computed. A null
promiseDatefromPOST /ordersis the verdict "not feasible" (ADR 0001 §7). - Hold, submit, reconcile, then release. Work reaches the floor only
after
SubmissionStatusreportsSUCCESS(ReconcileSubmittedOrders).FAILUREcancels the hold and rejects (SUBMISSION_FAILED). - Free the hold first. Every rejection path cancels the held order
before it mutates the aggregate, and records the outcome in the same save
as the rejection. A hold nobody decided is cancelled by a backstop sweep
(
SweepOrphanedHolds) onceacknowledgeBy + ORPHAN_HOLD_GRACEhas passed, becauseorder-managementhas no timeout of its own and a second TTL there would race the clock this context owns (ADR 0024). A hold found already released is not cancelled and is never retried. - A missed deadline is reported, then refused, and never answered
late. The sweep only publishes
AcknowledgementDeadlineAtRisk.RejectOverdueOrdersrejects withACKNOWLEDGEMENT_DEADLINE_MISSED. - Correlation is a persisted mapping (
local_order_id, recorded when the hold is raised; the hold's outcome ishold_outcome, guarded byCHECKconstraints). It is never a string convention, and that is why shipment confirmation is an explicit call (ADR 0014), not aPackageManifestedjoin. - Advertise what the floor can move.
advertisedQuantityismin(physical, throughputFeasible)and is never above physical (ErrAdvertisedExceedsPhysical). If capacity is unknown, the offer falls back to physical. NETWORK_MODEdefaults tostub.liverefuses to boot until an adapter exists, and the chosen mode is logged and exposed on/inbound-status.
Assumptions
order-managementremains the single authority on promises, and its ADR 0020 hold contract (releaseOnAllocation, ship-complete) stays stable.- The counterpart's inbound model stays poll-only, and its submissions stay asynchronous with a transaction-status query.
- A curated
PRODUCT_TRANSLATION_FILEis present wherever demand should be accepted. Without it, every order is rejected. - Single site:
RecomputeCapabilityOfferstargets oneSITE_ID, the same simplification asorder-managementADR 0014. - The always-on caches can fully replay their topics within
WaitReadyTimeout(60s each) at boot.
Verification Metrics
GET /inbound-status:failedpoll count,unansweredandoverduecounts. An overdue order is a missed external SLA.- The
AcknowledgementDeadlineAtRiskrate, and rejections split byRejectionReason. - Acknowledgement report: average acknowledgement latency, received vs
acknowledged, and rejections by cause (
acknowledgement_rollup, includingordersRejectedSubmissionFailed). - Share of
THROUGHPUT_CONSTRAINEDoffers per recompute pass (logged asthroughput_constrained). circuit_breaker_stategauge for theorder-managementdependency.network_fulfillment.orphaned_holds.sweptbyoutcome, and anyOrphanedHoldCancelledevent: a hold that leaked and had to be swept.network_fulfillment.node_profile.declarationsbyoutcomeandnetwork_fulfillment.node_profile.revisionbysite(live mode, ADR 0027): a site stuck in askipped_*orfailedoutcome has no current profile on the network.- Engineering gates: arch-go hexagonal tests, 90% coverage, gremlins on
./internal/domain/networkorder.
Open Questions
- Decided 2026-10-25:
CapabilityOfferis submitted outward byFeedInventory(ADR 0027 part 2), in live mode only, as one feed per site built from the persisted offers. The liveretail-networkadapter landed with ADR 0026. - Decided 2026-10-06: Submitted at SUBMITTED, Acknowledged only on settle
(ADR 0016).
NetworkOrderSubmittedis raised when the order goesSUBMITTED;NetworkOrderAcknowledgedis raised only when reconciliation settles itACKNOWLEDGED, published as the.v2type and dataschema. No fleet consumer exists, and the projector still replays historic v1 messages with the same report numbers. - Decided 2026-10-17: the orphaned hold is recorded and swept (ADR 0024,
gap OM-0020). The hold id is stored on the order as soon as
RaiseHeldOrderreturns, andSweepOrphanedHoldscancels a hold nobody decided onceacknowledgeBy + ORPHAN_HOLD_GRACEhas passed (OrphanedHoldCancelled), soRejectOverdueOrders' cancel now has a hold to find. What stays open by design: a hold never named because the process stopped between order-management's commit and the id being saved (only when the window closes before a re-delivery repeats the raise), aSUBMITTEDorder whose network status staysPENDING, and anACKNOWLEDGEDorder whose release failed (not a cancel case; release it by hand, see the runbook). - Decided 2026-10-06: cycle time gates eligibility (ADR 0017). A path is
eligible for a cutoff only if
CycleTimeP95 <= cutoff - now; a missing or zero cycle time stays eligible (fail-open); capacity is not scaled. - Decided 2026-10-30: the next feasible cutoff (ADR 0031). When no path can make the next cutoff, the offer is computed against the first one a path can make, up to 7 days ahead; only none in that bound is a zero.
- Contract drift (fixed 2026-10-06, ADR 0015). CORS now allows
GET/POST/OPTIONS,ErrConfirmBeforeAcknowledgemaps to a 409,apis/openapi.yamldocumentsGET /capability-offersand the shipment-confirmationPOST, and the acknowledgement report countsSUBMISSION_FAILEDrejections.