warehouse-systems fleet · executive briefing

delivery-promise

Tells shoppers when their order will arrive, and only promises dates it can keep
eight capabilitys12 events out · 45 in27 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

Delivery promise quotes only dates backed by real capacity, then judges every promise kept or broken

1

Every quoted date rests on a real path: a cutoff, a departure with room and a delivery wave.

2

Capacity is held as a promise from quote to order, and released if the hold expires.

3

Every promise ends judged kept or broken with a cause, and MCP and A2A surfaces let agents read it.

The ask

Publish promise-accuracy SLOs, kept versus broken per tier and node, as Prometheus metrics.

why it exists

A delivery date is a promise, and broken promises cost trust

Core subdomain of the retail network (commerce tier). It quotes a delivery date per shipment group and tier only from a feasible witness path (node cutoff, scheduled departures with room, a delivery wave with stops left), holds that capacity as a promise until the order is placed or the hold expires, and then judges every promise kept or broken with cause LATE, LOST or RETURNED…

Today

It quotes per tier from a feasible path, holds capacity until the order is placed, then judges each promise.

The catch

Its read models rest on 39 sibling event types from eight contexts; upstream drift can silently stale data and misquote dates.

what it does

It quotes, holds, revises and judges every delivery promise

Tiered quoting

Quotes same-day to standard tiers, plus a consolidated tier on a chosen day.

Feasible-path quotes

Builds quotes only from cutoffs, departures with room and open delivery waves.

Promise lifecycle

Holds a promise, confirms it at order, and tracks it through to the end.

Capacity booking

Books capacity per node and departure cutoff, with a capacity band on offers.

Versioned promise policies

Sets tier deadlines, hold times and capacity shares as versioned policy.

Promise judgement

Marks each promise kept, or broken as late, lost or returned.

who it talks to

Eight contexts feed it, three build on what it publishes

LISTENS TO · 39 EVENT TYPESIS HEARD BY · 3 CONTEXTSnode-topology9linehaul-transportation7offer-availability6shipping-and-tracking6last-mile-delivery4order-sourcing3+2 more contextscustomer-ordering5node-performance2order-sourcing2deliverypromisebadge = event types on that edge · derived from the CloudEvents types each repo declares
the shared language

Offers become promises, held against books of real capacity

THE LANGUAGEOF THE DOMAINDeliveryOfferPromisePromiseBookPromisePolicyWitness PathTierCapacity BandCutoff
REST15 operations over 14 paths on :8080
MCPRead-only MCP server (cmd/mcp, :8090…
A2ARead-only A2A agent (cmd/a2a, :8093): skills promise_status…
how it is built

Every input is a local read model rebuilt from consumed events

DRIVERS · INBOUNDOUTBOUND · ADAPTERSREST API :808015 operations over 14 pathsMCP tools :8090Read-only MCP server…Kafka consumer · 45 eventspromise.PromiseRevisedpromise.PromiseKeptDOMAIN COREDeliveryOfferPromisePromiseBookPromisePolicyPostgreSQLPostgreSQL via pgx with…Kafka producer · 12 eventspromise.PromiseAtRiskpromise.PromiseRevisedTransactional outboxrelay · DLQ on x-dlq-*commands inevents inevents outstorage / infra
event traffic · CloudEvents 1.0 on Kafka

39 sibling facts in, twelve promise facts out

CONSUMED · BY SOURCE · 45PUBLISHED · BY ENTITY · 12node-topology 9linehaul-transportation 7delivery-promise 6offer-availability 6shipping-and-tracking 6last-mile-delivery 4order-sourcing 3customer-ordering 29 promise1 deliveryoffer1 promisebook1 promisepolicy
how we know it is healthy

Outcome counters show how well we promise, but queue health is dark

OpenTelemetry SDK -> OTLP/gRPC Collector (Jaeger traces, Prometheus metrics); JSON logs on stdout shipped by Alloy to Loki

What we watch

  • W3C traceparent + baggage propagation installed globally in every binary
  • Business counters promising.promises.made (outcome, reason), deliverypromise.predicted_late.flagged…
  • http.server.request.duration histogram (5 ms-10 s buckets) on all REST/MCP/A2A binaries

What stops a bad change

  • Coverage gate 90% over internal/domain + application + analytics (make coverage)
  • make check = fmt-check + vet + build + lint + test; check-all adds coverage + arch-test + bdd
  • internal/architecture fitness tests fail the build on layering violations
by the numbers

27 recorded decisions shape how a date gets promised

27
Architecture decisions
#11 of 45 in the fleet
10
DB migrations
#9 of 45 in the fleet
9
BDD feature files
#36 of 45 in the fleet
12
Events published
#7 of 45 in the fleet

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

One-command workflows (make)

helpbuildvetfmtfmt-checklinttestcoverageintegrationbddarch-testmutationmutation-fullvuln
what comes next

Next: measure accuracy, keep quotes fast, rehearse sold-out capacity

NOW1Publishpromise-accuracySLOsPublish promise-accuracySLOs from the analyticsread side (kept/brokenratio per tier and node)as Prometheus metrics:today they are RESTreports under /reports/*and observability.md …NEXT2Keep witnesssearch fast asquotes growRebalance the witnesssearch cost: quotingscans availabilityacross eight readmodels; add caching orpre-ranked tiercandidate sets if quotelatency growsNEXT3Rehearse sold-outcapacity in a gamedayExercisePromiseBookExhausteddownstream behaviourwith order-sourcing andcustomer-ordering in afleet-level game dayLATER4Raise the mutationgate to the 99/99standardRaise the mutation gatefrom efficacy 87 /mutant-coverage 94 tothe 99/99 fleet standard(.gremlins.yaml:51-52)LATER5Add queue-healthinstrumentsAdd queue-healthinstruments:observability.md statesthere is no instrumentfor outbox depth,consumer lag, sweepcounts or DLQ volume
what could go wrong · and what we do about it

Upstream drift could quietly turn good quotes into wrong dates

Upstream payload drift can stale read models

39 sibling event types across eight producer contexts (plus 6 own events re-read by the analytics projector): any upstream payload…

→

Spectral lint of the AsyncAPI contract and integration tests against real Kafka guard the inputs.

Hot capacity books can serialise holds

Capacity contention on hot PromiseBooks (one node cutoff) can serialise holds…

→

Run a fleet-level game day on PromiseBookExhausted with order-sourcing and customer-ordering.

Analytics re-reads double the Kafka traffic

The analytics projector re-reading its own topics doubles Kafka traffic for the context and couples analytics freshness to relay health

→

Outbox backlog and relay passes are watched through runbook SQL and logs.

No authentication, by decision; replicas not load-tested

Every REST, MCP and A2A endpoint is unauthenticated by decision (fleet-wide auth revert…

→

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

the decision we need

Publish promise-accuracy SLOs, kept versus broken per tier and node, as Prometheus metrics.

WHAT ISIt quotes per tier from a feasiblepath, holds capacity until the orderis placed, then judges each promise.THE CATCHIts read models rest on 39 siblingevent types from eight contexts;upstream drift can silently staledata and misquote dates.WHAT COULD BELeaders see promise accuracy by tierand node, quotes stay fast as volumegrows, and sold-out capacity isrehearsed.
Why it matters

Delivery promise quotes only dates backed by real capacity, then judges every promise kept or broken

appendix · for the engineers in the room

The fine print: how it is put together

StyleHexagonal / ports-and-adapters, event-carried state: every input is a local read model rebuilt from consumed events; layering enforced by fitness tests
Layoutcmd/api (REST + Kafka consumers + sweeper + outbox relay), cmd/mcp, cmd/a2a, cmd/dp-projector (analytics writer), cmd/dp-reports (read-only reports)…
StoragePostgreSQL via pgx with embedded migrations (10 operational + 1 analytical) and pgtx UnitOfWork…
TestingUnit + integration with testcontainers Postgres/Kafka, godog BDD (9 feature files: calibration, capacity_rules, consolidated, keeping, lifecycle_rules, promises, quote_rules, quoting…
REST15 operations over 14 paths on :8080: /delivery-quotes, /delivery-estimates, /delivery-offers/{offerId}, /promises…
Go 1.27.4chi v5pgx v5 / PostgreSQLsegmentio kafka-goMCP Go SDKa2a-goCloudEvents 1.0OpenTelemetrygodog BDDtestcontainersReact/Vite MFE consoleDocker