16. NetworkOrderSubmitted at SUBMITTED; NetworkOrderAcknowledged only when the order settles (v2)
Status
Accepted (2026-10-06). Resolves the "NetworkOrderAcknowledged timing" design
note that ADR 0015 deliberately
left undecided. Builds on ADR 0001 §5
(the SUBMITTED state), ADR 0003 (outbox)
and ADR 0008 (CloudEvents,
versioning). Amends the event contract only; no REST or MCP contract changes.
Context
ReceiveNetworkDemand published NetworkOrderAcknowledged the moment the
order moved to SUBMITTED, i.e. before ReconcileSubmittedOrders had asked
the network's transaction-status record whether the submission was accepted.
The later SUBMITTED -> ACKNOWLEDGED settle raised no event, and a refused
submission raised NetworkOrderRejected(SUBMISSION_FAILED) for an order that
had already been announced as acknowledged.
In the ubiquitous language an event named "Acknowledged" that fires before
acknowledgement is a lie: ACKNOWLEDGED is defined as a settled commitment,
and AGENTS.md rule 8 releases work only after the settle. The fleet had no
consumer of warehouse.network-fulfillment.events (checked again on 2026-10-06
against every other repository's develop/main: only the topic names appear,
in warehouse-infra documentation), so this was the cheapest moment to fix it.
Decision
-
New fact
NetworkOrderSubmittedis raised in the same atomicSave+Publishscope that moves the order toSUBMITTED(ReceiveNetworkDemand.acknowledge). It is exactly what the oldNetworkOrderAcknowledgedannounced and carries the same payload (networkRef,siteId,localOrderId,receivedAt,at). It is new, therefore v1: typecom.warehouse.wes.network-fulfillment.networkorder.NetworkOrderSubmitted, dataschemaurn:warehouse:network-fulfillment:<events|analytics>:NetworkOrderSubmitted:v1. -
NetworkOrderAcknowledgedis raised only when the order settlesACKNOWLEDGED.ReconcileSubmittedOrders.confirmsaves the aggregate asACKNOWLEDGEDand publishes the event in one atomic scope, before the held order is released. A pending submission raises nothing; a failed one raisesNetworkOrderRejected(SUBMISSION_FAILED)only (never an Acknowledged first). The payload field set is unchanged;atis the settle time andreceivedAtis still the original receipt. -
The changed meaning is a breaking contract change, versioned exactly as the fleet CloudEvents standard (§4) prescribes: a new type with a
.v2suffix and a new dataschema version, published as a new event and never by mutating the old one:type:com.warehouse.wes.network-fulfillment.networkorder.NetworkOrderAcknowledged.v2dataschema:urn:warehouse:network-fulfillment:<events|analytics>:NetworkOrderAcknowledged:v2
On both topics, through the outbox (the outbox persists the encoded v2 bytes and
event_type). Implemented bycloudevents.TypeVersioned(suffix for versions >= 2) and the publisher's per-event version. The unsuffixedNetworkOrderAcknowledgedv1 type is no longer published; v1 messages already on a topic are never rewritten. -
The analytics projector handles all three.
NetworkOrderSubmittedis a recognised type: it is claimed on its CloudEventsid(so redelivery is a skip) and has no report effect.NetworkOrderAcknowledgedv2 and the historic v1 both feed the existing acknowledgement counter and latency (at - receivedAt) with the same payload fields, so replaying the topic from the first offset keeps giving the same numbers for everything published before this change (v1 meant "submitted", and it still counts once, with the same latency). For new orders the counter now moves at the settle and the latency measures receipt -> settle, which is what the report always claimed to measure. -
Not added: a submit -> settle measure (an
ordersSubmittedcounter or a submitted-to-settled latency). It needs a persistedsubmittedAton the aggregate or a new report column plus REST/MCP/OpenAPI surface, which is not trivial or additive in this change.NetworkOrderSubmittedis now on the topic, so it can be added later without a contract change.
Consequences
Easier: event names state facts; consumers can tell "told the network yes"
(Submitted) from "the network confirmed it" (Acknowledged); a refused
submission no longer follows an Acknowledged event.
Harder / to watch:
- Event count per accepted order is now three (
Received,Submitted,Acknowledged.v2) instead of two. - Any external consumer that dispatched on the v1
NetworkOrderAcknowledgedtype stops receiving it. None exists in the fleet (grep of every other repository, 2026-10-06); a future consumer must dispatch on the.v2type (andSubmittedif it wants the earlier fact). - The AsyncAPI mirror in
warehouse-docs(apis/network-fulfillment/asyncapi.yaml) must be re-synced from this repository'sapis/asyncapi.yaml. - The v1 type remains in the projector's dispatch table permanently, because the analytics topic is a replayable read-model source.