warehouse-systems fleet · executive briefing

yard-management

Tracks every truck and trailer in the yard, from gate to door to departure
nine capabilitys23 events out · 16 in17 recorded decisions

This project is a domain-driven design study. It is not associated with, endorsed by or affiliated with any company, and it uses no company's code, data, logos or trademarks. All names, figures and examples are illustrative or synthetic. · November 2026

the short version · read this if nothing else

Yard management turns everything outside the four walls into shared facts, but its best parts are still dark

1

Safety rules secure a trailer before door work and park it only where its load allows.

2

13 published facts keep dock, receiving, shipping and exception teams in sync.

3

Six yard KPIs, from dwell to detention exposure, are built and waiting to be switched on.

The ask

Approve switching on MCP, KPI reports and the sweeps in warehouse-infra, and instrumenting the consumers and relay.

why it exists

Everything outside the four walls is where dwell and detention hide

Owns everything physically on site outside the four walls: who passed the gate (visits), which trailer is where (spot, door or an open move), its load, seal and hold state, the moves hostlers and visiting drivers make, door work at the door, and yard checks…

Today

It checks trucks in at the gate, places trailers, runs hostler moves and door work, and publishes 13 yard facts.

The catch

Only api and relay run on the cluster; MCP, KPI reports and sweeps are built but off, and its consumers have no telemetry.

what it does

Nine capabilities cover a trailer's whole stay on site

Gate visits

Checks tractors, drivers and trailers in and out, with typed rejection reasons.

Carrier gate

A visit from a suspended carrier is rejected at check-in.

Trailer placement and state

Tracks where each trailer sits, its load, seal and holds, and where it may park.

Yard moves

Hostlers claim and complete moves, with leases that expire if work stalls.

Safe door work

A trailer is secured before door work starts and released before it leaves.

Yard checks

Compares expected and actual trailer positions and raises dwell breaches.

who it talks to

Three contexts feed it, five build on what it publishes

LISTENS TO · 16 EVENT TYPESIS HEARD BY · 5 CONTEXTSdock-scheduling9inbound-receiving4facility-layout3dock-scheduling4e2e-tests4exception-management4outbound-shipping3inbound-receiving1yardmanagementbadge = event types on that edge · derived from the CloudEvents types each repo declares
the shared language

Visits, trailers, moves and door work are the yard's core words

THE LANGUAGEOF THE DOMAINYardVisitTrailerYardMoveDoorWork + dock safety…YardCheckInspection + versioned…YardPolicy per siteLocal copies
REST46 operations over 41 paths on :8080
MCPMCP server (cmd/mcp, :8090, Streamable HTTP): 21 tools…
Events23 produced, 16 consumed on Kafka (CloudEvents 1.0): 13…
how it is built

Five programs in one image, talking to siblings only by events

DRIVERS · INBOUNDOUTBOUND · ADAPTERSREST API :808046 operations over 41 pathsMCP tools :8090MCP server (cmd/mcp, :8090…Kafka consumer · 16 eventscarrier.CarrierRegisteredcarrier.CarrierReinstatedDOMAIN COREYardVisitTrailerYardMoveDoorWork + dock safety…PostgreSQLPostgres OLTPKafka producer · 23 eventsInspectionCompletedinspection.InspectionFailedTransactional outboxrelay · DLQ on x-dlq-*commands inevents inevents outstorage / infra
event traffic · CloudEvents 1.0 on Kafka

13 yard facts keep four teams in sync, plus 10 analytics-only

CONSUMED · BY SOURCE · 16PUBLISHED · BY ENTITY · 23dock-scheduling 9inbound-receiving 4facility-layout 312 trailer5 yardmove3 yardvisit2 inspection1 yardcheck
how we know it is healthy

OTel and a check-in counter cover requests, not consumers or relay

Fleet observability standard (ADR 0017): all five binaries export traces and metrics over OTLP/gRPC (lazy, non-blocking) plus Go runtime metrics…

What we watch

  • A 5xx never leaks its cause: the problem detail is generic, the real error only in logs; method/path are sanitised against log injection (logsafe.go)
  • Readiness is the single best health signal: a 503 dependency-unavailable problem names the failing dependency (postgres, kafka, analytics)

What stops a bad change

  • make check (fmt-check vet build lint test) and check-all (+ coverage 90% domain+application, arch-test, bdd) before every push…
  • CI: lint, guide-lint, complexity, file-length, test (90% gate), bdd, integration, mutation-fast (90/65), api-lint, vuln, docs-api-drift, helm-lint…
by the numbers

17 decisions, 7 migrations and 15 feature files back it

17
Architecture decisions
#16 of 45 in the fleet
7
DB migrations
#15 of 45 in the fleet
15
BDD feature files
#19 of 45 in the fleet
23
Events published
#1 of 45 in the fleet

Ranked against all 45 briefed repositories (dot = one repository, highest on the left).

One-command workflows (make)

buildvetfmtfmt-checklinttestcoverageintegrationbddarch-testmutationmutation-fullvulncheck
what comes next

Next we find consumers, light up what is built and see inside the relay

NOW1Find consumers for thepublished safety factsFind consumers for thepublished-but-unconsumed safetyfacts — TrailerSecured,TrailerSecuringReleased (ADR0013) and InspectionCompleted(ADR 0015) have no consumeryet; exception-management isthe planned consumer ofInspectionFailed, not…NEXT2Switch on MCP,analytics and thesweeps in infraSwitch MCP, the analytics readside (projector + reports) andthe dwell/move-lease sweeps onin warehouse-infra — all built,all dark on the k3s clustertodayLATER3Raise the mutation gatefrom 90/65 toward 99/99Raise the mutation gate(.gremlins.yaml 90% efficacy /65% mutant-coverage; yardcheckmeasured 94.74% / 70.37%)toward the fleet 99/99 standardLATER4Instrument theconsumers and theoutbox relayInstrument the consumers andthe outbox relay: they have nospans or metrics of their ownand the trace stops at theoutbox insert (observabilitypage, ADR 0017)
what could go wrong · and what we do about it

Our biggest risk is that a wedged consumer or relay goes unseen

Telemetry misses consumers, relay and the outbox

Telemetry covers HTTP requests and one gate check-in counter only: a wedged consumer…

→

Readiness names the failing dependency; outbox SQL, DLQ topics and freshness are the signals today.

Analytics and the MCP server are switched off

Only api and relay run on the cluster; the KPI/reports surface and the 21-tool MCP server are switched off in infra…

→

Switch on MCP, the projector, reports and the sweeps in warehouse-infra.

Auth is off by decision, even on 11 MCP write tools

REST and the MCP surface (11 write tools) are unauthenticated BY DECISION (fleet-wide, README study-project disclaimer)

→

No mitigation on the roadmap yet: this one needs an owner.

the decision we need

Approve switching on MCP, KPI reports and the sweeps in warehouse-infra, and instrumenting the consumers and relay.

WHAT ISIt checks trucks in at the gate,places trailers, runs hostler movesand door work, and publishes 13 yardfacts.THE CATCHOnly api and relay run on thecluster; MCP, KPI reports and sweepsare built but off, and its consumershave no telemetry.WHAT COULD BEOperators see the yard misbehavebefore trucks wait, and dwell,detention and door use show up aslive KPIs.
Why it matters

Yard management turns everything outside the four walls into shared facts, but its best parts are still dark

appendix · for the engineers in the room

The fine print: how it is put together

StyleHexagonal / Ports & Adapters; WMS-tier Supporting bounded context of the yard domain (yard instance of warehouse-docs holds the single-source model)…
Layoutcmd/{api,mcp,relay,yard-projector,yard-reports} — five binaries in one image (entrypoint ./api): api :8080 (REST + the three Kafka consumers: dock-scheduling, facility-layout…
StoragePostgres OLTP (7 root migrations: yard-management, idempotency_keys, standard_identifiers, dock_safety_interlock, hazmat_and_reefer_placement…
Testingtable-driven -race unit tests; 90% coverage gate on domain+application (make check-all); 15 godog BDD feature files…
REST46 operations over 41 paths on :8080: /visits (+/{id}, /check-outs), /visit-rejections, /trailers (+/{id}, /classifications, /holds, /hold-releases…
Go 1.27.4chi v5 routerpgx/v5 + pgxpool Postgresgolang-migratesegmentio/kafka-goCloudEvents sdk-go v2official MCP Go SDK v1.8.0OpenTelemetry Go SDK v1.47.0testcontainers-goHelm chart