ADR 0013: the CONSOLIDATED tier and the stored chosen delivery day
Status
Accepted (2026-11-10). Part of the Wave 2 E6 design (a shopper may choose a
later, consolidated delivery day so the network can merge the order with others).
Builds on ADR 0002 (the GroupPromise
snapshot), ADR 0004
(CustomerOrderPlaced :v1, additive evolution only),
ADR 0009 (the window's local time zone) and
ADR 0012 (the
consolidation key). The provider of the tier is delivery-promise (its ADR 0024);
the consumer of the placed tier is order-sourcing (its ADR 0016).
Context
delivery-promise adds a fifth service tier, CONSOLIDATED: an opt-in quote option
whose delivery day is later than the fastest feasible one, leaving the network at
least one local day to merge the order with other orders of the same shopper and
address. It also tells the caller, per option, whether the option actually leaves
that time (consolidationEligible, present only for this tier, never false by
default). The shopper's choice needs no new checkout field: the choice IS the
offerId of the group, and PlaceOrder already copies the tier and the window of
the made promise into the group.
What customer-ordering must change is what it does with the value it receives:
- the tier enum is closed at four values in the aggregate (
Tier.Valid,checkGroup,Restore), in theorder_groups_tier_checkconstraint and in the OpenAPITierschema, so a group promised underCONSOLIDATEDis refused with 422 and the checkout fails after the promise was made; - the order must keep WHICH day the shopper chose and whether the network could honour a merge, to show it later and to hand it downstream.
Decision
- Accept the tier.
customerorder.TiergainsTierConsolidated("CONSOLIDATED");Valid()accepts five values. Migration0008_group_consolidated_choicedrops and re-addsorder_groups_tier_checkwith the five tiers (the down migration restores the four and refuses to run while aCONSOLIDATEDgroup exists, so rolling back never loses a promise). - Store the choice on the group.
GroupPromise(andGroupInput,newGroup,placedGroups,Restore's clone, the Postgres columns) gains two fields:ChosenDeliveryDay string:YYYY-MM-DD, the LOCAL calendar date ofdeliverByLatestin the group'sTimeZone(ADR 0009). Empty when the tier is notCONSOLIDATEDor the zone is unknown or cannot be resolved. It is the day the shopper chose at placement and is NOT recomputed when a laterPromiseRevisedmoves the window: the revised window is on the group already, the day records the choice.ConsolidationEligible *bool: delivery-promise's answer,nilwhen the tier is notCONSOLIDATEDor the promise did not say (unknown, neverfalse). Columns:order_groups.chosen_delivery_day date NULLandorder_groups.consolidation_eligible boolean NULL.
- Invariants.
ChosenDeliveryDayandConsolidationEligibleare only allowed on aCONSOLIDATEDgroup, and the day must be a valid calendar date (ErrValidationonPlace,ErrInvalidSnapshotonRestore). - Terms and derivation.
promising.TermscarriesConsolidationEligible *bool, decoded tolerantly by the delivery-promise gateway (absent or not a boolean = unknown).groupInput()derivesChosenDeliveryDaywith the zone database; the domain only checks the SHAPE of a zone (ADR 0009) and never resolves one, so the derivation lives in the use case. The runtime image shipstzdata. - REST (additive). The
GroupPromiseresponse schema (POST /checkout201,GET /orders/{orderId}, every item ofGET /orders) gains optionalchosenDeliveryDayandconsolidationEligible, omitted when unknown; theTierenum gainsCONSOLIDATED.CheckoutRequestis unchanged: the offer id carries the choice. The generated REST reference is regenerated in the same commit. - CustomerOrderPlaced (additive, same
:v1).groups[].tiercarries the REAL tier (CONSOLIDATED, never mapped);groups[].chosenDeliveryDayandgroups[].consolidationEligibleare optional and omitted when unknown. Reading rule (stated in the asyncapi): an absentconsolidationEligiblemeans unknown or "not a CONSOLIDATED option", neverfalse. order-sourcing must accept the tier BEFORE anyCONSOLIDATEDgroup is placed (activation gate below). - Re-quote keeps the default tiers.
requote()asks delivery-promise for the default quote set, which does not containCONSOLIDATED. A shopper whoseCONSOLIDATEDoffer expired re-quotes through the storefront; the 409offer-not-quotableanswer therefore never offers it. This is an accepted limitation of this slice. - MCP and A2A keep their shape. Their group outputs pass the tier string
through (
CONSOLIDATEDincluded) and, liketimeZonein ADR 0009, do not gain the two new fields; they can add them the same way later. - Out of scope (activation gate Q5). The storefront callers (cart, checkout,
pricing, web) validate exactly four tiers and must accept the fifth before
they ask for it; the incentive amount, the picker copy and the day range shown
to shoppers belong to pricing and the storefront. The network sends no fee.
Nothing here asks delivery-promise for
CONSOLIDATED: it stays invisible until a caller opts in.
Consequences
- A
CONSOLIDATEDpromise can be placed, stored, shown and published. Without a caller that asks for the tier nothing changes: every existing group stays on four tiers, the new columns stayNULL. - Consumers of
CustomerOrderPlacedthat validate the tier strictly must acceptCONSOLIDATEDfirst: order-sourcing'svalidatePromiserejects an unknown tier, and the group would never be sourced. Deploy order: order-sourcing (ADR 0016) and this slice before any storefront asks delivery-promise for the tier. - Rolling the migration back is only possible while no
CONSOLIDATEDgroup exists; the operator must cancel or let such groups close first. - The chosen day is a historical fact of the order, like
tier; the live promise window isdeliverByEarliest/deliverByLatest(andtimeZone).