ADR 0017: Fleet REST API guideline cutover
Status
Accepted (2026-11-01). Follows ADR 0002
(version guards, If-Match) and adopts the fleet REST API guideline
(.spectral.yaml ruleset, linted in CI).
Update 2026-11-19 (pointer; the Decision text below is unchanged): decision 2's
"a replay returns the stored response" holds for every 2xx and for the refusals
classed FINAL or OUTCOME. A refusal classed RETRYABLE is no longer stored:
its key is released and a retry executes again
(ADR 0027).
Context
The fleet standardises its REST surfaces: noun resources for state
transitions, an idempotency key on every POST, one status for key reuse, and
keyset paging for collections. inbound-receiving had verb sub-routes
(/cancel, /check-in, /close), keys on creating POSTs only, 422 for
key reuse and an unpaged GET /docks.
Decision
- Noun transition routes (hard cutover, no aliases):
POST /asns/{asnNumber}/cancellations,POST /appointments/{appointmentId}/check-ins,POST /appointments/{appointmentId}/cancellations,POST /receipts/{receiptId}/closures. - Every
POSTis keyed.Idempotency-Keyis 1-128 printable ASCII (400 idempotency-key-required/400 idempotency-key-invalid). A replay returns the stored response withIdempotency-Replayed: true; the same key with a different request is409 idempotency-key-reused(was422). The key row commits in the same Postgres transaction as the aggregates and the outbox rows. - Keyset paging.
GET /asns,/appointments,/receiptsand/docksreturn{items, nextCursor}takinglimit(1-500) and an opaquecursor;400 invalid-limit,400 invalid-cursor, and400 unknown-query-parameterfor any undeclared parameter.GET /asns/{asnNumber}/cartonsis exempt as aview: one ASN's bounded, versioned (ETag) snapshot. - The MCP
list_dockstool follows the pages and still returns every door.
Consequences
Breaking for REST callers (warehouse-floor-client, e2e-tests, the web/
remote, which is updated here). Event contracts are unchanged.