Skip to main content

Delivery Promise

Delivery Promise is the bounded context of the retail network that tells a shopper, before and at purchase, the date a package will arrive, and makes that date true by construction. It is a domain-driven design study; every name is synthetic (see the disclaimer in the README).

  • Area: Network (retail network, commerce tier). The service belongs to the retail network, not to the warehouse-systems fleet; the fleet reaches the network only through the vendor-connectivity Vendor API.
  • Subdomain class: Core (reasoning).
  • Repository: IQVO/delivery-promise, Go, three binaries (cmd/api, cmd/mcp, cmd/a2a), a Module Federation remote in web/.

The business problem​

A retailer that shows an early date sells more; one that shows an early date and then misses it loses trust and pays for the failure. The context shows the earliest date the network can actually keep, and keeps it. Three things make that hard:

  1. The network does not own the buildings that ship. A vendor declares operating hours, cutoffs and handling time (node-topology), and the network measures how well it keeps them (node-performance). The promise uses both.
  2. The date depends on a chain of capacities owned elsewhere: a pickup departure at the node, scheduled middle-mile departures (linehaul-transportation) and a delivery wave at a delivery station (last-mile-delivery). Each has a cutoff and a finite capacity.
  3. Promising is not assigning. The node that proves a date feasible now (the witness) need not be the node that ships; order-sourcing decides that later.

What it owns​

AggregateRoleWhere
DeliveryOfferA short-lived quote per shipment group and tier, with its witness path, basis (SCHEDULED, MEASURED or NOMINAL), an optional calibrated confidence and policyVersion. States QUOTED, EXPIRED, CONSUMED.internal/domain/offer
PromiseThe commitment for one shipment group of an order. PROVISIONAL holds capacity until the hold expires, CONFIRMED once the order is placed, then AT_RISK, KEPT, BROKEN, RELEASED or CANCELLED. Carries terms, witness path, revisions and the judgement.internal/domain/promise
PromiseBookThe promise-side capacity ledger of one (node, pickup departure) cutoff: provisional + confirmed <= share. Opened lazily by the first hold, closed at the cutoff.internal/domain/book
PromisePolicyVersioned tier deadlines, offer and hold TTLs, packages per order, capacity share. Version 0 is the built-in default.internal/domain/policy

It also owns the search (internal/domain/search): the earliest-arrival witness path over the local read models, the ScorecardHandicap of a node and the shipment grouping of a cart.

What it does not own​

Not hereOwner
Choosing the node that actually ships, and moving it until the vendor acceptsorder-sourcing
Registering nodes, lanes, service areas and regionsnode-topology
Scheduling departures and booking packageslinehaul-transportation
Delivery waves, routes and attemptslast-mile-delivery
Grading nodesnode-performance (this context only applies the grade)
Listings and available quantitiesoffer-availability
The shopper, the ship-to address and the ordercustomer-ordering (it holds the PII; this context promises to a destination postal prefix only)
Notifying the customer of a revised datecustomer-ordering
Anything inside a vendor's buildingthe vendor

Every input of the search is a local read model (rm_* tables) kept from events; the service makes no synchronous call to any sibling and reads no warehouse.* topic.

Main capabilities​

  • Quote delivery offers per tier (SAME_DAY, NEXT_DAY, TWO_DAY, STANDARD) for a cart and a destination prefix; "no offer" comes with the constraint that blocked it.
  • Promise a chosen offer: consume it, create the PROVISIONAL promise and hold capacity on the witness book in one transaction; confirm it when the order is placed; cancel it on request (checkout compensation) or when the order is cancelled.
  • Keep the promise: flag it at risk when a departure, wave or package fails, re-promise it from the current network state (never earlier than before) and judge it KEPT or BROKEN (cause LATE, LOST or RETURNED) on delivery.
  • Publish thirteen event types (six integration, seven analytics) through a transactional outbox, and consume 39 event types from eight producers.
  • Expose a REST API, a read-only MCP server (six tools), a read-only A2A agent (two skills) and a console remote (web/, four read-only screens).
  • Operate as a stateful consumer, sweeper and relay in one pod, on real Postgres and Kafka only.
If you want toPage
understand the layers, binaries and data storesArchitecture
run it locallyQuickstart
know every settingConfiguration
operate or debug itRuntime, Runbook, Observability, Troubleshooting
test or extend itTesting
see who talks to itIntegration, Context map
call itAPI reference, Events, MCP tools
learn the modelUbiquitous language, Use cases, DDD artifacts
see why decisions were takenADR index
Disclaimer

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.