ADR 0010: Adopt the fleet REST API guideline
Status
Accepted (2026-11-01). Follows ADR 0002 (A17 polling pages
and the Idempotency-Key store), and applies the fleet REST API guideline to the Vendor API.
Context
The fleet agreed one REST guideline: noun routes (no :verb custom methods), an
Idempotency-Key on every POST and PATCH with one global key space, 409 for key reuse, an
Idempotency-Replayed response header, and {items, nextCursor} keyset pagination on every
collection GET. The Vendor API predated it.
Decision
- Routes.
POST /vendors/{vendorId}:suspendbecomesPOST /vendors/{vendorId}/suspensionsandPOST /vendors/{vendorId}:reinstatebecomesPOST /vendors/{vendorId}/reinstatements. The old routes are gone (hard cutover, no alias);TestRetiredRoutesAreGonepins it.operationIds are unchanged, so the MCP and A2A mappings do not move. - Idempotency. Every POST is behind the middleware. The key is global: migration
0003_idempotency_key_globalmakeskeythe primary key ofidempotency_keys(existing rows stay valid; a duplicated key keeps its oldest row). A stored record is matched by key, then compared by fingerprint (method + path + SHA-256 of the body). Same fingerprint replays the first response withIdempotency-Replayed: true(the retired spellingIdempotent-Replayedis gone); any other 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. The key row commits in the same Postgres transaction as the aggregate change and the outbox rows. A 4xx is stored, a 5xx rolls back and is not. - Pagination.
GET /vendor/purchase-orders,GET /vendor/inbound-shipmentsandGET /vendor/nodestakelimit(1 to 500, default 100) andcursorand answer{items, nextCursor}; the cursor is the base64url(sortKey, id)of the last row (internal/adapters/inbound/http/page) and the queries order by(sortKey, id)in Postgres and in memory.nextToken, the per-resource keys (purchaseOrders,inboundShipments,nodes) and the old REST size bounds (50/200) are retired.invalid-limit,invalid-cursorandunknown-query-parameterare400problems. The MCP tools keep their own schemas (one page and a tool-levelnextToken,limit1 to 500, default 50) and are not changed beyond the larger bound. - Exemption.
GET /vendor/nodes/{nodeId}/scorecardisx-pagination-exempt: view: it is one scorecard resource per node whose representation holds one entry per rolling window (a fixed, small set). - Spectral.
.spectral.yamlcarries the fleetrest-guidelinerule;spectral lint apis/openapi.yaml --fail-severity=warnmust exit 0.
Consequences
Breaking for every Vendor API client: it must deploy together with the REST cutover set. Callers known outside this repository: network-fulfillment (suspension and reinstatement routes, purchase-order poll). The domain, the events and the Kafka contracts do not change.
Addendum 2026-11-18: replay classes
The replay of refusals is now decided by ADR 0015: a 2xx and a FINAL or OUTCOME refusal are stored and replayed, a RETRYABLE refusal and a 5xx are not and release the key. The text above is the decision as it was taken.