Skip to main content

Domain Message Flow

Built, released at v0.1.3, applied to k3s (reduced footprint); MCP and A2A built, not deployed

Built on develop (merged 2026-11-08) in IQVO/dock-scheduling, released at v0.1.3 (first release v0.1.0 on 2026-11-09; applied to the k3s cluster on 2026-11-10 at v0.1.2 in a reduced footprint, and the image pinned to the v0.1.3 commit a1a029c in warehouse-infra since 2026-11-16, checked 2026-12-02): dock-scheduling runs its API only (it relays inline); yard-management runs its API and relay. The MCP server (18 tools on develop 096db0a, 14 in v0.1.3) is registered in warehouse-infra but switched off until the cluster has room; the A2A agent (two skills) is built on develop (2026-12-02), not released and not deployed (the chart carries it off by default and warehouse-infra has no a2a block); the analytics projectors, report services and sweeps are registered but switched off, so the KPI reports of yard-management ADR 0011 are released, not yet served. The page still derives from yard/model/model.yaml; where the as-built service differs, the model and this page say so (see the as-built notes).

Following ddd-crew Domain Message Flow Modelling. Participants are contexts and actors. Every arrow is a message from model.yaml, prefixed cmd:, qry: or evt:. Events are written entity.EventName; the full type is com.warehouse.wms.<producer>.<entity>.<EventName> (see Domain Events). Route parameters are written without braces. Events marked analytics only go to warehouse.dock-scheduling.analytics and have no named consumer; the diagrams show them as notes.

1. Booking, rescheduling and cancelling​

Derived from: model.yaml → contexts[dock-scheduling].inbound, .aggregates[DockAppointment].invariants, .publishes[*].consumers.

Omitted: the three branches are shown in sequence for width; a real carrier reschedules or cancels one appointment, not all three in a row. A reschedule is allowed only from BOOKED, a cancel from BOOKED or CHECKED_IN (otherwise ErrIllegalTransition, 409). inbound-receiving also consumes DockAppointmentRescheduled as built (its appointments copy, ADR 0019); outbound-shipping reads DockAppointmentBooked. A dock planner may also reschedule and cancel. The Err... to HTTP status mapping is decision D-10: 409 for conflicts, 422 for value rules.

2. From the gate to the released door​

Derived from: model.yaml → contexts[dock-scheduling].policies[ArrivalFromGate, ActualDoorWins, CompleteOnDoorRelease, OutOfOrderYardFacts], .publishes, contexts[yard-management].publishes[VisitCheckedIn, TrailerDocked, TrailerUndocked].

Omitted: the yard's own steps between the three events (moves, door work), which belong to yard-management. A yard fact for an unknown, terminal, CANCELLED or NO_SHOW appointment is ignored and counted; a late VisitCheckedIn for a COMPLETED appointment is ignored. One appointment covers exactly one trailer (decision X3). A release applied to a BOOKED appointment completes it without a DockAppointmentCheckedIn; the adherence report counts it as ON_TIME and the metric dock_scheduling_implicit_arrivals_total counts it (decision X6).

3. A late ETA and a no-show​

Derived from: model.yaml → contexts[dock-scheduling].policies[EtaRisk, NoShowSweep], .inbound, .publishes[DockAppointmentNoShow], contexts[yard-management].policies[NoShowFreesHolding], fleet_changes.

Omitted: the sweep is idempotent, so a second run marks nothing new. The routing of the case inside exception-management is that context's and is not in the model beyond "open problem cases ... and DockAppointmentNoShow". A carrier that missed its window books a new appointment: NO_SHOW is terminal (decision D-9).

4. A door closure and a cancelled ASN​

Derived from: model.yaml → contexts[dock-scheduling].aggregates[DockCalendar].invariants, .policies[CancelWhenAllAsnsCancelled], .publishes, .consumes.

Omitted: DoorOperatingHoursDeclared (analytics only) and DeclareOperatingHours, which is refused with ErrHoursConflictWithAppointments when it would leave an active appointment outside the hours (decision D-8); the phase-2 pickup policy (PickupFromCutoffs), which is described on Domain Events. The refusal that lists the appointment ids is the model's only help for a planner closing a door; ListAppointments takes filters (for example atRisk), which are in the OpenAPI contract.

5. A delegated reschedule: the ops agent proposes, a person approves, the A2A skill reschedules​

As built on develop (read 2026-12-02; dock-scheduling ADR 0015 and 0016, warehouse-ops-agent ADR 0035). Unlike the four flows above these messages are not rows of the model: they are the agent surfaces of the service. This is the one write an agent reaches on this context, a delegation over A2A after a human approval, with the attribution on the raised fact; the reads before it go over MCP. Neither surface is deployed today (mcp.enabled: false, no a2a block, no endpoint set on the agent).

Source: dock-scheduling docs/adr/0015-a2a-inbound-adapter.md and 0016-agent-planning-and-attribution.md, internal/adapters/inbound/a2a/server.go, write.go and skills.go, internal/adapters/inbound/mcp/tools_read.go (096db0a); warehouse-ops-agent docs/docs/adr/0035-yard-and-dock-slice.md, cmd/agent/yard_dock.go, internal/application/usecases/reschedule_outlook.go (abc8472).

Omitted: the Agent Card fetch (/.well-known/agent-card.json), the idempotency replay (the same idempotencyKey replays the stored answer), the analytics twin of the event, the api's relay hop (cmd/a2a starts no relay: the event leaves through the outbox and the relay of cmd/api), and the agent's own LLM steps (the slot choice is code, the model only words the answer). The two L2 tools of the MCP server (propose_reschedule_plan, propose_late_arrival_actions) and their apply_reschedule_plan are a planner's flow over MCP, not drawn; see Use Cases.