ADR 0014: lane cost declaration (cents, planner-declared)
Status
Accepted (2026-11-05).
Context
The retail network's cost model is ordinal, not monetary: order-sourcing
scores a candidate path with AssignmentCost = legs + crossRegionPenalty + scorecardPenalty + bookPressurePenalty, a proxy that cannot be compared with a
financial figure. The network roadmap (feature F7, money-denominated
cost-to-serve) calls for money on the model's seams so the proxy can become a
sum of cents. The lane is the first seam: a planner already knows what moving
one package across a lane on one departure costs them, and model.yaml is
silent about that number (the model gap recorded as A43 in ADR 0002).
Two alternatives were weighed. Deriving the cost from measured linehaul
invoices here: refused, this context owns declarations, not measurements, and
the declared-then-measured philosophy (ADR 0001 D3) keeps a declaration a fact
that is never re-derived. Waiting for linehaul-transportation to publish
measured cost per departure: refused for the same reason — the consumer needs
a number now, and a later measured event can supersede or calibrate it without
this contract changing shape.
Decision
- A declared field on the Lane aggregate.
costPerUnitCents, anint64of integer cents: the planner's declared marginal cost of moving ONE package-unit across this lane on one departure. Default 0. Range 0 to 10000000 inclusive (shared.Invalid/ 422validation-failedoutside it). No currency field: the study network is single-currency, so the currency is an ecosystem constant, not a field. - The command.
DeclareLaneCost(POST /lanes/{laneId}/cost-declarations,Idempotency-Keymandatory) is valid on an OPEN lane only; a CLOSED lane is refused with the existing illegal-transition sentinel. Every declaration bumps the lane version and publishesLaneCostDeclared{laneId, costPerUnitCents, declaredAt}(CloudEvents catalogue ADR 0004), subject and Kafka key thelaneId. A newer declaration supersedes the previous value; each declaration is a fact. - Zero versus undeclared.
0is a legal declaration and means zero declared marginal cost. A lane that was never declared on also reads0, but publishes nothing. A consumer therefore cannot tell the two apart from the number alone: an undeclared lane contributes0to a money sum AND leaves the consumer's estimate incomplete. What incomplete means is the consumer's decision (fall back to the ordinal penalty, flag the estimate); this context only promises the distinction is knowable — no event was published for that lane. - Consumed by order-sourcing.
order-sourcingbuilds its local lane view from this event and folds the declared cents into its money-denominatedAssignmentCost(F7). Consumers keep the latest declaration perlaneId; CloudEventstimeorders retries, the lane version orders intent. - Excluded. Currency modelling (single-currency study; a second currency
would be a new ADR and a
:v2dataschema) and per-mode nuance: a lane has exactly one mode (GROUNDorAIR), so one number per lane is one number per mode; an air-versus-ground crossover rule is a consumer policy, not a topology fact.
Consequences
- The REST lane reads (
GET /lanes,POST /lanes) and the MCPlist_lanestool carrycostPerUnitCents; migration 0005 adds the column with the same range check, and legacy rows read0(undeclared). - order-sourcing can price a path in cents the moment a planner declares, with the incompleteness rule above as its only caveat.
- A declared cost is not a quote and not an invoice: it is stable until the next declaration, and nobody may re-derive it from anything.
- If the network ever needs measured cost per departure, that is a new event from the measuring context, superseding nothing here.