Retail network · Core domain · EventStorming board

delivery-promise

Quotes delivery windows per speed tier, promises one to each shipment group, holds capacity for it, re-promises when the route breaks, then judges kept or broken.

GitHub ↗ · Documentation ↗ · Architecture check · Briefings

events published
13
commands
16
policies
20
read models
13
hot spots
5

The board, row by row

17 rows, in the order the business story happens: the main path first, then how this context reacts to the others, then the clock. Rows are small stories; read each one left to right.

  • Event
  • Command
  • Actor
  • Aggregate
  • Policy
  • Read model
  • External system
  • Hot spot
  • Opportunity
  1. Quote delivery options for a destination

    A shopper sees what each shipment group can get, per speed tier, with a delivery window. A tier with no feasible route gets no offer, only the reason. The quote calls no other service.

    ActorShopper
    Read modelNode, lane, departure and wave copies
    Read modelStock per listing, net of promises
    Read modelNode grades and tier eligibility
    Read modelCurrent promise policy
    CommandQuoteDeliveryOffersPOST /delivery-quotes
    AggregateOffer
    EventDeliveryOfferQuotedanalytics stream only

    Source: application/usecases/quote.go · domain/offer/offer.go · domain/search/search.go

  2. Count each delivery question answered

    After a quote or a listing-page estimate is answered, one small fact is noted: region, item count and the shortest promised days. It never slows the reply, is off by default, and a lost fact is only counted.

    ActorShopper
    PolicyWhenever a quote or estimate is answered, note one fact after the reply is sent
    CommandRecordQuote / RecordEstimatestarted by the policy
    AggregateFact
    EventDeliveryRequestAnsweredanalytics stream only

    Source: 0032-request-level-promise-coverage-from-a-best-effort-fact.md · application/requestfacts/recorder.go · domain/requestfact/requestfact.go · adapters/inbound/http/request_facts.go

  3. Promise a shipment group

    At checkout a quoted offer becomes a provisional promise and holds one order of room on the node's pickup cutoff. The route is re-checked first; a route no longer feasible is refused as full.

    ActorShopper
    Read modelQuoted offer
    Read modelCurrent promise policy
    CommandMakePromisePOST /promises
    AggregatePromise
    EventPromiseMadeanalytics stream only

    Source: application/usecases/make_promise.go · domain/promise/promise.go · domain/book/book.go

  4. A pickup book fills up

    When a hold uses the last room before a node's pickup cutoff, the book announces it is exhausted. Later quotes find no room there.

    Event · earlierPromiseMade
    PolicyWhenever a hold fills a pickup book, announce that the book is exhausted
    CommandHoldstarted by the policy
    AggregateBook
    EventPromiseBookExhausted
    Systemorder-sourcing
    PolicyKeeps it as book pressure, a penalty when scoring paths

    Source: application/usecases/make_promise.go · domain/book/book.go · domain/book/events.go

  5. Confirm the promise when the order is placed

    Checkout confirms each promise once the order is placed. The hold becomes a confirmed reservation. Confirming twice changes nothing.

    ActorShopper
    CommandConfirmPromisePOST /promises/{promiseId}/confirmations
    AggregatePromise
    EventPromiseConfirmedanalytics stream only

    Source: application/usecases/lifecycle.go · domain/promise/promise_transitions.go

  6. Catch a confirmation that checkout missed

    Normally checkout has confirmed already and nothing happens. A promise still provisional inside its hold is confirmed. If the hold has lapsed, it is only logged, never retried.

    Systemcustomer-ordering
    EventCustomerOrderPlaced
    PolicyWhenever an order is placed, confirm its promises that are still provisional
    CommandConfirmPromisestarted by the policy
    AggregatePromise
    EventPromiseConfirmedanalytics stream only

    Source: application/usecases/projections_fulfillment.go · adapters/inbound/kafka/dispatch.go · ddd/eventstorming.md

  7. Cancel promises when an order is cancelled

    The cancelled groups' confirmed and at-risk promises are cancelled and their room goes back to the book. The same rule runs when an operator cancels one promise by hand.

    Systemcustomer-ordering
    EventCustomerOrderCancelled
    PolicyWhenever an order is cancelled, cancel the promises of its cancelled groups
    CommandCancelPromisestarted by the policy
    AggregatePromise
    EventPromiseCancelledanalytics stream only

    Source: application/usecases/lifecycle.go · application/usecases/projections_fulfillment.go · domain/promise/promise_transitions.go

  8. Release a hold nobody confirmed

    A provisional promise that was not confirmed in time is released and its room returns to the book.

    TimeSweeper
    PolicyEvery sweep, release provisional promises whose hold has lapsed
    CommandReleaseExpiredHoldsstarted by the clock
    AggregatePromise
    EventPromiseReleasedanalytics stream only

    Source: application/usecases/lifecycle_sweeps.go · cmd/api/workers.go · domain/promise/promise_transitions.go

  9. Publish a new promise policy

    An operator publishes the next version of the promise rules: offer and hold lifetimes, capacity share, order deadlines per tier. A published version never changes.

    ActorOperator
    CommandPublishPromisePolicyPOST /promise-policies
    AggregatePolicy
    EventPromisePolicyPublishedanalytics stream only

    Source: application/usecases/lifecycle.go · domain/policy/policy.go · domain/policy/events.go

  10. Keep the node profile copy

    Opening hours, handling time, pickup cutoffs and the throughput cap decide when a node can ship. Node status, lanes, service areas and regions are kept the same way, so quoting never calls out.

    Systemnode-topology
    EventNodeOperationalProfileDeclared
    PolicyWhenever a node declares a profile revision, keep it if it is newer than the one held
    CommandOnNodeProfileDeclaredstarted by the policy
    Read model · kept up to dateNode profiles

    Source: application/usecases/projections.go · adapters/inbound/kafka/dispatch.go

  11. Keep the stock copy

    Quotes sell each owner's declared quantity minus units already promised that the figure may not include yet. Hidden listings and discontinued items ship nothing.

    Systemoffer-availability
    EventListingAvailabilityChanged
    PolicyWhenever a listing's quantity changes, keep it unless it is older than the one held
    CommandOnListingAvailabilityChangedstarted by the policy
    Read model · kept up to dateStock per listing

    Source: application/usecases/projections.go · application/usecases/availability.go · 0017-owner-aware-availability-and-promise-netting.md

  12. Keep the timetable copy

    A promise needs a pickup and legs with room. Departures are kept with their remaining room; delivery waves from last-mile-delivery are kept the same way.

    Systemlinehaul-transportation
    EventDepartureScheduled
    PolicyWhenever a departure is scheduled, keep it with its remaining room
    CommandOnDepartureScheduledstarted by the policy
    Read model · kept up to dateDepartures and their room

    Source: application/usecases/projections_transport.go · adapters/inbound/kafka/dispatch.go

  13. Learn how long lanes really take

    A lane that runs late is quoted from what it really takes. The arrival also tells the late-risk check that the leg is done.

    PolicyWhenever a load arrives, pair it with its departure to measure the transit time
    CommandOnLoadArrivedstarted by the policy
    Read model · kept up to dateMeasured transit times
    Read model · kept up to dateDeparture arrivals

    Source: application/usecases/projections_transport.go · 0014-measured-transit-basis.md

  14. Flag promises on a cancelled departure

    Every confirmed promise whose route uses the cancelled departure is flagged at risk. Cancelled waves, failed or moved bookings, package exceptions, deferred induction and unsourceable groups flag the same way.

    Systemlinehaul-transportation
    EventDepartureCancelled
    PolicyWhenever a departure is cancelled, flag the confirmed promises that ride on it
    CommandFlagAtRiskstarted by the policy
    AggregatePromise
    EventPromiseAtRisk
    Read model · kept up to dateDepartures and their room
    Systemcustomer-ordering
    PolicyRecords the reason in the order's tracking view

    Source: application/usecases/projections_transport.go · application/usecases/risk.go · domain/promise/promise_transitions.go

  15. Spot routes that are running late

    A sweep checks confirmed promises: if a departure on the route is past its expected arrival, the promise is flagged at risk before the customer is let down. The flag is never cleared if the load arrives later.

    TimeSweeper
    PolicyEvery sweep, flag confirmed promises whose route has a departure running late
    Read modelDeparture arrivals
    Read modelMeasured transit times
    CommandFlagPredictedLatestarted by the clock
    AggregatePromise
    EventPromiseAtRisk
    Systemcustomer-ordering
    PolicyRecords the reason in the order's tracking view

    Source: application/usecases/late_risk.go · 0021-a-sweep-flags-promises-whose-locked-path-is-running-late.md

  16. Re-promise a later date, or give up

    The promise searches again for the same group, at its tier or slower, and moves later only. When nothing works it says so once, and the sweep keeps retrying.

    Event · earlierPromiseAtRisk
    PolicyWhenever a promise is at risk, search again and move it later if any route works
    CommandReviseAtRiskstarted by the policy
    AggregatePromise
    EventPromiseRevised
    EventPromiseUnkeepable
    Systemcustomer-ordering
    PolicyShows the new window, or cancels the group if unkeepable
    Systemorder-sourcing
    PolicyApplies the new window to the assignment

    Source: application/usecases/risk.go · domain/promise/promise_transitions.go

  17. Judge the promise: kept or broken

    Once the lock, the shipped packages and the deliveries are all known, the group is judged. On time is kept. Late, or a package lost or returned, is broken.

    Systemshipping-and-tracking
    EventPackageDelivered
    PolicyWhenever the last package is delivered, or one is lost or returned, judge the group
    Read modelLocked assignment
    Read modelShipped packages
    CommandJudgestarted by the policy
    AggregatePromise
    EventPromiseKept
    EventPromiseBroken
    Read model · kept up to datePackage outcomes
    Systemcustomer-ordering
    PolicyRecords the verdict and minutes late in the tracking view
    Systemnode-performance
    PolicyRecords the outcome against the node's score

    Source: application/usecases/judge.go · application/usecases/projections_fulfillment.go · domain/promise/promise_transitions.go

Hot spots and opportunities

Open questions and known gaps, each taken from a decision record or a document in the repository, never invented. Opportunities are improvements the documentation already names.

Opportunities

This board is a reconstruction from the code and documentation of delivery-promise at origin/develop, not a workshop output. Roles are the ones the documentation names. How the boards were made.