Skip to main content

Bounded context canvas

Synced from outbound-shipping

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, filled from the code and the ADRs.

Source: docs/adr/0001 to 0006, internal/domain/*, internal/application/usecases/*, apis/openapi.yaml, apis/asyncapi.yaml.

Name​

outbound-shipping: the WMS context that gets manifested packages onto the right load, proves what left on which trailer and tells the fleet an order shipped.

Purpose​

Own the last mile inside the building: staging, the outbound load, the physical ship-confirm and the bill of lading. Before it existed nothing owned "what left on which truck" and an order's last state was Released.

Strategic classification​

AspectValue
DomainWarehouse management (WMS), outbound
SubdomainSupporting (reasoning)
Business modelCost reducer and revenue protector: fewer missed cutoffs, an accurate "shipped" fact
EvolutionCustom-built (the bill of lading leans Product) (chart)

Domain roles​

RoleWhere
Execution contextscans move packages through staged, loaded and shipped
Specification-litethe load plan is derived from the cutoff schedule, not authored here
Auditthe bill of lading and the once-only missed-load fact
Gateway for downstreamShipmentConfirmed and PackageMissedLoad on warehouse.outbound-shipping.events are a published language for order-management, exception-management and network-fulfillment (consumer built on its develop, not yet running)
Analysis (small)the load board and the adherence report

Inbound communication​

MessageFromTypeCollaborator relationshipPolicy / effect
PackageManifestedfulfillment-executioneventCustomer/Supplierplan or join the open load, expect the package
PackageDivertedfulfillment-executioneventCustomer/Suppliershort-ship the package with reason DIVERTED
CPTScheduleChangedprocess-path-managementeventConformistreplace the site's cutoff schedule copy
ZoneRegistered, LocationSlotRegisteredfacility-layouteventConformistfill the staging-location copy
DockAppointmentBookeddock-schedulingeventCustomer/Supplierassign the door of an outbound appointment naming the cutoff; keep carrier and SCAC
TrailerDockedyard-managementeventCustomer/Supplierattach the trailer and start loading
DoorWorkCompletedyard-managementeventCustomer/Supplierrecord the completion (no state change in v1)
TrailerDepartedyard-managementeventCustomer/Suppliership-confirm a CLOSED load, or flag a departure while loading
Stage, load, unload scansdock operatorsREST commandpackage moves
Close, reopen, cancel, voiddock supervisorsREST commandload and document decisions
Missed-load sweepa schedulerREST commandflag missed packages
Reads and adherence reportany clientREST query
loads_at_risk, missed_loads, audit_load (L2), get_closure_checklistagentsMCP query (read-only)

Outbound communication​

MessageToTypeRelationship
ShipmentConfirmedorder-management (implemented), network-fulfillment (built on its develop, not yet running)eventOpen Host Service and Published Language
PackageMissedLoadorder-management, exception-management (both implemented)eventOHS and PL
LoadingStarted, LoadClosed, LoadReopenedyard-management (intended, not implemented)eventOHS and PL
LoadPlanned, LoadDoorAssigned, LoadCancelled, PackageStaged, PackageLoaded, PackageUnloaded, BillOfLadingIssued, BillOfLadingVoidedno integration consumer; own projector via the analytics twinevent

Ubiquitous language​

See Ubiquitous language. Key terms: outbound load, cutoff key, shipping package, staging, short-ship, ship-confirm, bill of lading, missed load.

Business decisions​

  • One open load per (site, cpt, operating date, ship method), planned from the first manifested package.
  • Loading starts only from a physical docking at the load's door; there is no REST route to start it.
  • A load closes only when every package is loaded or short-shipped with a reason.
  • Ship-confirm follows the trailer's departure and needs a seal; a departure while the load is LOADING never confirms (ADR 0002).
  • A bill of lading is issued once per confirmed load and only with the yard's seal; voiding it does not undo the shipment.
  • PackageMissedLoad is raised at most once per package.
  • A manifest without a site or cutoff correlation plans nothing (ADR 0003).

Assumptions​

  • fulfillment-execution will populate site_id on PackageManifested; until it does, no load is planned in a real flow (its AsyncAPI says the field is omitted for now).
  • yard-management records and publishes a seal on TrailerDeparted.
  • A dock appointment carries the carrier; the bill of lading refuses an empty one.
  • The platform runs one Kafka broker; topics are auto-created.
  • Access control is the network boundary: REST and MCP are unauthenticated.

Verification metrics​

Load adherence (loads_closed / loads_total per cutoff and date), packages missed, loads at risk, the age of the oldest unpublished outbox row (see Observability).

Open questions​

  • Who calls POST /missed-load-sweeps and when: nothing in the repository schedules it.
  • Who consumes LoadingStarted, LoadClosed and LoadReopened: yard-management declares no handler.
  • When network-fulfillment's ShipmentConfirmed consumer, built on its develop (its PR 165), is deployed: the running pod predates it (ADR 0004).
  • Whether the process-path-management, facility-layout and fulfillment-execution payloads should be pinned like the yard and dock-scheduling ones (ADR 0007 lists the first and last as follow-ups). The dock-scheduling pin itself is done and was refreshed in PR 18.