ADR 0010: Adopt the fleet REST API guideline
Status
Accepted (2026-11-01).
Context
The fleet REST API guideline (warehouse-docs, "Warehouse REST API Guideline")
is mandatory for every apis/openapi.yaml: URLs name things and never actions,
every POST and PATCH is idempotent, key reuse is 409, and every
collection is a keyset-paged {items, nextCursor} envelope. It is enforced by
the rest-guideline Spectral rule (R1-R8) in the api-lint job. seller-inbound
still had :verb custom methods, answered Idempotency-Key problems with
422, and scoped the key to its route.
Decision
-
Noun routes (R1, R2). The six
:verbcommands become transition resources (guideline 1.3d / 1.4);operationIdis unchanged so MCP and A2A mappings do not move, and status codes and bodies do not change:Old New POST /sellers/{sellerId}:suspendPOST /sellers/{sellerId}/suspensionsPOST /sellers/{sellerId}:reinstatePOST /sellers/{sellerId}/reinstatementsPOST /inbound-plans/{planId}:confirmPOST /inbound-plans/{planId}/confirmationsPOST /inbound-plans/{planId}:cancelPOST /inbound-plans/{planId}/cancellationsPOST /inbound-shipments/{shipmentId}:labelPOST /inbound-shipments/{shipmentId}/labelsPOST /inbound-shipments/{shipmentId}:shipPOST /inbound-shipments/{shipmentId}/dispatchesThe old routes are gone (no alias);
TestRetiredRoutesAreGonepins 404/405. The{sellerAction}/{planAction}/{shipmentAction}dispatch on a:verbsuffix is deleted; each route has its own handler. -
Idempotency (R3-R6, R8). Every
POSTwas already behindRequireIdempotencyKey, whose key row commits in the SAME transaction as the aggregate and its outbox rows (the use case joins it throughTxBinder). The change is the contract: the key is global (migration0003narrows the primary key from(route, key)to(key), keeping the earliest row of any key stored under two routes); the fingerprint is method + path (theroutecolumn) + SHA-256 of the body; a different fingerprint is409 idempotency-key-reused(was422); a missing key is400 idempotency-key-required, a key that is not 1 to 128 printable ASCII characters is400 idempotency-key-invalid; a replay carriesIdempotency-Replayed: true(the first execution never does). 2xx and 4xx are stored and replayed, a 5xx or panic rolls back and is never stored. Update 2026-11-20 (ADR 0018): a 4xx is stored only when its problem type is FINAL or OUTCOME; a RETRYABLE refusal rolls back, key row included, and the same key executes again. The decision text above is the one in force on 2026-11-07. -
Pagination (R7). seller-inbound has no list endpoint; the one flagged GET is exempt (below). No
pagepackage orunknown-query-parametercheck is needed because no collection takeslimit/cursor.
Exemptions
GET /inbound-shipments/{shipmentId}/labelsisx-pagination-exempt: view: it is one composite resource, the label sheet of a single shipment (headershipmentId,state,destinationNodeIdplus the labels derived from the frozen manifest), printed as one unit and bounded by the manifest of one shipment. It is not a collection of independently addressable rows.
Consumers
Inside this repo nothing calls the renamed routes over HTTP (the console remote
is read-only; MCP and A2A call use cases directly). Tests, BDD features,
README and the docs pages use the new routes. Outside: the e2e-tests repo
(seller_inbound_test.go) changes in its own PR.
Consequences
The cutover is breaking by design and deploys together with the fleet REST
cutover set. Clients must send Idempotency-Key on every POST (already
required here), treat 409 idempotency-key-reused as a client bug, and read
Idempotency-Replayed.