warehouse-systems fleet · executive briefing

customer-ordering

Turns a shopper's cart into an order they can track and cancel
nine capabilitys3 events out · 21 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

Customer ordering is the shopper's front door, and it only places orders whose delivery dates are confirmed

1

Every order is placed only after each shipment group has a confirmed delivery promise.

2

Shoppers see status and tracking built from 21 event types out of three other contexts.

3

Cancellation and compensation unwind partial checkouts instead of leaving half-placed orders.

The ask

Add a circuit breaker to the delivery-promise call so checkout degrades predictably instead of stopping.

why it exists

Shoppers trust an order only when its delivery date is real

Generic subdomain of the retail network (commerce tier) and the shopper's front door. At checkout it groups the cart into shipment groups, obtains a delivery promise for each group from delivery-promise synchronously (re-quote, make, confirm), and only then places the order with the shopper and ship-to address (or a pickup point, ADR 0016) - synthetic PII held only here…

Today

It groups the cart, secures a delivery promise per group, places the order and builds tracking from upstream events.

The catch

Placement stops if delivery-promise is down, and it alone holds shopper addresses with no PII policy yet.

what it does

From cart to tracked parcel, one context keeps the shopper's view

Shopper management

Registers shoppers, finds them by email and keeps saved addresses.

Checkout orchestration

Secures a delivery promise per shipment group, re-quoting if it drifts.

Order placement and history

Places orders to an address or pickup point; shoppers list and open them.

Order status rollup

Rolls group status up to the order from promise, sourcing and shipping.

Tracking view

Shows delivery windows, packages, scans and ETAs for each shipment group.

Customer cancellation

Lets shoppers cancel while a group is unlocked; sourcing accepts or refuses.

who it talks to

Three contexts feed it, two build on what it publishes

LISTENS TO · 21 EVENT TYPESIS HEARD BY · 2 CONTEXTSshipping-and-tracking11delivery-promise5order-sourcing5delivery-promise2order-sourcing2customerorderingbadge = event types on that edge · derived from the CloudEvents types each repo declares
the shared language

Orders split into shipment groups, each with its own promise

THE LANGUAGEOF THE DOMAINCustomerOrderShipment GroupShopperShip-To AddressTracking ViewConsolidation KeyDelivery WindowCancellation
REST14 operations over 12 paths on :8080
MCPRead-only MCP server (cmd/mcp, :8090…
A2ARead-only A2A agent (cmd/a2a, :8093, JSON-RPC over HTTP…
how it is built

A hexagonal core whose only outbound call goes to delivery-promise

DRIVERS · INBOUNDOUTBOUND · ADAPTERSREST API :808014 operations over 12 pathsMCP tools :8090Read-only MCP server…Kafka consumer · 21 eventspromise.PromiseAtRiskpromise.PromiseRevisedDOMAIN CORECustomerOrderShipment GroupShopperShip-To AddressPostgreSQLPostgreSQL via pgx with 12…Kafka producer · 3 eventsCustomerOrderPlacedCustomerOrderCancelledTransactional outboxrelay · DLQ on x-dlq-*commands inevents inevents outstorage / infra
event traffic · CloudEvents 1.0 on Kafka

21 incoming facts keep tracking honest; three go out

CONSUMED · BY SOURCE · 21PUBLISHED · BY ENTITY · 3shipping-and-tracking 11delivery-promise 5order-sourcing 52 customerorder1 orderPromiseAtRiskPromiseRevisedPromiseKeptPromiseBrokenPromiseUnkeepableFulfillmentLockedFulfillmentShippedFulfillmentUnsourceableFulfillmentCancelledCustomerOrderPlacedCustomerOrderCancelledShopperNoticeDecided
how we know it is healthy

Order metrics and fitness tests show checkout, 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 counter ordering.orders.placed (outcome placed|rejected, reason slug when rejected) recorded once per checkout attempt in cmd/api
  • http.server.request.duration histogram on all REST/MCP/A2A binaries

What stops a bad change

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

17 recorded decisions and 12 migrations shape the order model

17
Architecture decisions
#16 of 45 in the fleet
12
DB migrations
#7 of 45 in the fleet
12
BDD feature files
#29 of 45 in the fleet
3
Events published
#26 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: harden checkout, measure the funnel, settle the PII story

NOW1Putcheckout-funnelSLOs on theAdd checkout-funnel SLOmetrics: onlyordering.orders.placedexists (outcome/reason);re-quote,confirm-failure andcompensation rates arenot instruments …NEXT2Add a circuitbreaker to thepromise callAdd a circuit breaker onthe synchronousdelivery-promise call: aper-call 5 s timeoutexists(DELIVERY_PROMISE_TIMEOUT)but a breaker is notevidenced in …NEXT3Write the PIIpolicy before realdataDefine the PII storybefore real data:retention, erasure andencryption policy forshopper addresses (notevidenced indocs/docs/ddd/bounded-context-canvas.md;synthetic today)LATER4Add consumer-lag,outbox-depth andDLQ metricsAdd queue-healthmetrics:observability.md statesthere is noconsumer-lag,outbox-depth or DLQmetricLATER5Raise the mutationgate to the 99/99standardRaise the mutation gatefrom efficacy 98 /mutant-coverage 98 tothe 99/99 fleet standard(.gremlins.yaml:30-31)
what could go wrong · and what we do about it

One synchronous call can stop every order from being placed

A delivery-promise outage stops order placement

Checkout availability depends on a synchronous delivery-promise call: its outage stops order placement end to end

→

A 5 s per-call timeout exists; a circuit breaker is the next step.

It is the single holder of shopper PII

Shopper and address PII is custody-sensitive even when synthetic; the context is the single holder and a future breach surface

→

Define retention, erasure and encryption policy for shopper addresses before any real data.

Tracking relies on 21 upstream event types

21 consumed event types from three contexts plus a compensation path: tracking-view correctness depends on every upstream contract…

→

Integration suites run consumed events against real Postgres and Kafka in testcontainers.

No authentication, including the ship-to address endpoint

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

Add a circuit breaker to the delivery-promise call so checkout degrades predictably instead of stopping.

WHAT ISIt groups the cart, secures adelivery promise per group, placesthe order and builds tracking fromupstream events.THE CATCHPlacement stops if delivery-promiseis down, and it alone holds shopperaddresses with no PII policy yet.WHAT COULD BECheckout that bends instead ofbreaking, funnel and queue health onthe dashboard, and a clear PIIpolicy before real data.
Why it matters

Customer ordering is the shopper's front door, and it only places orders whose delivery dates are confirmed

appendix · for the engineers in the room

The fine print: how it is put together

StyleHexagonal / ports-and-adapters with DDD aggregates (CustomerOrder, Shopper, ShipTo); the only outbound HTTP is the synchronous delivery-promise client; layering enforced by fitness tests
Layoutcmd/api (REST + three Kafka consumers + outbox relay + compensation in one process), cmd/mcp (:8090), cmd/a2a (:8093, Agent Card at /.well-known/agent-card.json)…
StoragePostgreSQL via pgx with 12 embedded migrations (incl. compensation cancels, pickup destination, notification_policies), transactional outbox…
TestingUnit + integration with testcontainers Postgres/Kafka, godog BDD (12 feature files) over features/*.feature, MCP tool-registry golden file, architecture fitness tests (incl…
REST14 operations over 12 paths on :8080: /checkout, /orders, /orders/{orderId}, /orders/{orderId}/tracking, /orders/{orderId}/cancellations…
Go 1.27.4chi v5pgx v5 / PostgreSQLMCP Go SDKa2a-gosegmentio kafka-goCloudEvents 1.0golang-migrateOpenTelemetrygodog BDDtestcontainersReact/Vite MFE console