reports
Read-only analytics reports (ADR 0018), served by cmd/dp-reports from the separate analytical database the projector feeds from this context's own events. Days are UTC calendar days; from and to are inclusive dates.
Introduction
REST contract of the delivery-promise bounded context (Core, commerce tier) of the retail network, derived from retail-network-docs model/model.yaml (contexts[delivery-promise].rest) and the FINAL cross-context decisions (contracts-delta E7, E8, E9; gap register G8, G9, G19, G21, G22). The quote route is an Open Host Service for the storefront and an in-organization Customer/Supplier contract for customer-ordering; POST /promises, POST /promises/{promiseId}/confirmations and POST /promises/{promiseId}/cancellations (checkout compensation) are called only by customer-ordering inside checkout. The promise hot path makes no synchronous call to any other context: every input is an event-fed local read model. No authentication, consistent with the fleet. No personal data appears in any schema: the destination is a postal prefix, never an address. Errors are RFC 9457 application/problem+json whose `type` is https://retailnetwork.example/problems/<slug>. Shared slugs: not-found (404), illegal-transition (409), concurrent-update (409), validation-failed (422). Model slugs (kebab-case of the Err name): offer-not-quotable, promise-capacity-exhausted, book-closed, promise-hold-expired, promise-closed, revision-moves-earlier (409); group-spans-nodes, invalid-promise-terms, nominal-basis-not-allowed-for-tier (422). Infrastructure slugs: malformed-request, idempotency-key-required, idempotency-key-invalid (400), idempotency-key-reused (409), resource-not-found (404), internal-error (500). Every POST requires Idempotency-Key (fleet REST API guideline); a repeat with the same key, method, path and body replays the first response for 24 hours with the Idempotency-Replayed header when that response is final: a 2xx, or a refusal the same request cannot pass later. A refusal that depends on state that can change is not stored: the key is released and the same request retried under the same key runs again (a different body under a released key is a new request, not idempotency-key-reused). The problem types that release the key (RETRYABLE): not-found, promise-capacity-exhausted, book-closed, offer-not-quotable, illegal-transition, concurrent-update, group-spans-nodes, revision-moves-earlier. A 5xx is never stored. The one exception is the safe POST /delivery-estimates, which stores nothing: it needs no key and ignores one that is sent (ADR 0019). The read-only analytics reports (tag reports, ADR 0018) are served by cmd/dp-reports on its own port (per-path server) from the separate analytical database; their range errors are invalid-report-range (400).
Cancel a confirmed promise on request (CancelPromise)
Called by customer-ordering to compensate a checkout whose later group failed to confirm: the promises already CONFIRMED are cancelled so their capacity is given back. No request body. A CONFIRMED or AT_RISK promise becomes CANCELLED (cancelReason CANCELLED_ON_REQUEST), the confirmed hold goes back to its PromiseBook and PromiseCancelled goes to the analytics topic, in one transaction. Idempotent: cancelling an already CANCELLED promise is a no-op returning 200 with the same view. A PROVISIONAL, KEPT, BROKEN or RELEASED promise is refused with illegal-transition (409); a provisional hold is never cancelled, it lapses by itself (ReleaseExpiredHolds).
Confirm a provisional promise for a placed order (ConfirmPromise)
Called by customer-ordering inside checkout, before the order is placed (E7). PROVISIONAL becomes CONFIRMED and the book hold moves from provisional to confirmed, in one transaction; PromiseConfirmed goes to the analytics topic. Idempotent: confirming an already CONFIRMED promise with the same orderId and groupNo is a no-op returning 200. A hold past holdExpiresAt is refused with promise-hold-expired (409), and a RELEASED or otherwise closed promise with promise-closed (409): checkout then re-quotes and no order is placed.
DeliveryEstimates
DeliveryEstimates
DeliveryOffers
DeliveryOffers
Estimate delivery options for up to 50 items of a listing page (nothing is stored)
A computation over the request body for product listing pages (search results, many items per view). Each item is searched as a single-line group with exactly the quote search of POST /delivery-quotes (the same local read models, OwnerChoice of ADR 0017, netting, scorecard handicap and the SCHEDULED, MEASURED or NOMINAL basis), and each estimate lists the best option per requested tier that a one-line quote would offer, or the OfferConstraint that blocks the tier. The shared inputs are loaded once per request, not per item. The operation is SAFE: it stores nothing (no offer, no outbox event, no hold, no Idempotency-Key row) and an estimate is ADVISORY: it carries no offer id, cannot back POST /promises and never reserves capacity; a quote on the product page or at checkout is what the shopper promises against. An unknown catalogItemId is not an error: it is the ITEM_QUANTITY_NOT_AVAILABLE constraint. The Idempotency-Key is not required and, if sent, it is ignored (a safe request is idempotent by effect, as the guideline treats PUT and DELETE). Makes no synchronous call.
Get the current promise policy
Returns the highest published version, or the built-in default (policyVersion v0) when none has been published.
Get one delivery offer
Returns the offer in any state (QUOTED, EXPIRED or CONSUMED) with its witness path, basis and policy version. Offers are kept for a retention period after they expire.
Window width, exact-day, revision and unkeepable figures of the promises made, per day and tier
Per UTC day of PromiseMade (its CloudEvents time) and per tier. windowMinutes is the mean / p50 / p90 of deliverByLatest - deliverByEarliest in minutes; exactDayShare is the share of promises whose window starts and ends on the same LOCAL calendar day in the window's timeZone (ADR 0011); a window without a loadable zone is read in UTC and also counted in zoneUnknown. revisedShare is the share with at least one PromiseRevised; unkeepableCount counts those with a PromiseUnkeepable (both at any time). Days without a promise are omitted. Served by cmd/dp-reports (ADR 0018).
Kept rate of the judged promises, per day, tier and basis
Per UTC day of judgement (the CloudEvents time of PromiseKept / PromiseBroken), per tier and per basis of the promise AS MADE (UNKNOWN while its PromiseMade is not projected). judged = kept + broken; keptRate = kept / judged; brokenByCause splits broken by the PromiseBroken cause (LATE, LOST, RETURNED); lateByMinutes is the continuous p50 / p90 of lateByMinutes over the broken LATE promises, null when there is none. Days without a judgement are omitted. Served by cmd/dp-reports (ADR 0018).
Get one promise with its terms, witness path, revisions and judgement
Returns the promise with its terms, witness path, revisions and judgement. A promise is never deleted; terminal states stay readable.
Offers quoted against promises made, per day and tier, and promise coverage per region
Per UTC day and tier, offersQuoted counts DeliveryOfferQuoted and promisesMade counts PromiseMade of that day (each by its own CloudEvents time); conversion = promisesMade / offersQuoted, null when no offer was quoted that day and tier. Same-day counts, not an offer-to-promise cohort. Days with neither are omitted. promiseCoverage (ADR 0030) adds, per UTC day, the offers quoted per region (the first two characters of the destination postal prefix; the ten regions with most requests, the rest folded into other) with the cumulative counts and shares of those promised within 1, 2, 3 and 5 days; it is a sibling of days, not a field of each tier row. Each region row carries two families of fields. The OFFERS-based fields (requests, answeredWithPromise, answeredWithinDays) count offers quoted. The REQUEST-based fields (requestsAnswered, requestsWithPromise, requestsWithinDays, requestShare; ADR 0032) count the quote and estimate requests the service answered, including those answered with no promise; they are best effort (a bounded loss is tolerated) and exist only from the day the request fact was switched on, so earlier days and a service with the fact off report 0 and a null share. Served by cmd/dp-reports (ADR 0018).
How far the analytics projection is behind
asOf is the CloudEvents time of the newest event the projector applied; lagSeconds is now minus asOf, never negative. Both are null until the first event. One endpoint for every report, which all read the same projection. Served by cmd/dp-reports (ADR 0018).
List the promise books of one node for one date
One book per pickup cutoff of the node whose cutoff falls on the date (node local time).
List the promises of one customer order
Returns every promise confirmed for the order, one per shipment group.
Make a provisional promise for one shipment group from a quoted offer
MakePromise. Consumes the offer (CONSUMED), creates the promise in PROVISIONAL with holdExpiresAt, and holds capacity on the witness PromiseBook (nodeId:pickupDepartureId), opening the book lazily on the first hold, in ONE transaction (documented exception to one aggregate per transaction, G22). A retry with the same Idempotency-Key and body replays the stored answer when it is final (a promise made, or a refusal the request cannot pass later); a refusal that capacity, a concurrent request or a fact not known yet can still change releases the key, so the retry under the same key runs again. Errors: not-found (404); offer-not-quotable, promise-capacity-exhausted, book-closed, concurrent-update (409); group-spans-nodes, invalid-promise-terms, nominal-basis-not-allowed-for-tier, validation-failed (422); idempotency-key-required (400); idempotency-key-reused (409).
PromiseBooks
PromiseBooks
PromisePolicy
PromisePolicy
Promises
Promises
Publish a new promise policy version (PublishPromisePolicy)
Stores the next policy version (strictly increasing) and publishes PromisePolicyPublished on the analytics topic. Offers and promises made afterwards record the new policyVersion.
Quote delivery offers per tier for a destination and a set of lines
Runs the PromisePolicy search over local read models. The cart is first split into shipment groups (ShipmentGrouping: one node for the whole cart when one can cover every line, otherwise the fewest groups). Returns one QUOTED offer per (group, requested tier) that has a feasible witness path, and an OfferConstraint for every (group, tier) that has none. 'No offer' is a normal 200 answer. A tier whose order deadline in the destination region has passed is reported PAST_ORDER_DEADLINE. Each offer is persisted with a TTL so checkout can honour it. The Idempotency-Key is required; a repeat inside the offers' TTL returns the same offers. Makes no synchronous call.
reports
reports