ADR 0010: adopt the fleet REST API guideline
Status
Accepted (2026-11-01). Supersedes the idempotency parts of
ADR 0002 A24 (route-scoped key, reuse as 422) and of
ADR 0005 (the Idempotency-Key section).
Context
The fleet standardised its REST contracts: URLs name things (no :custom-method suffix, no verb
segment), every POST and PATCH is idempotent with one key semantics, a key reused with another request
is 409, the replay header is Idempotency-Replayed, and every collection is paginated with keyset
{items,nextCursor}. This service had one colon route and a route-scoped key reused as 422.
Decision
- Route.
POST /labels/{labelRef}:voidbecomesPOST /labels/{labelRef}/voids(transition noun "void -> voids").operationId: voidLabel, the 200 status and the body do not change. The old route is gone (TestRetiredRoutesAreGone), no alias. - Idempotency. All three POSTs (
/labels,/labels/{labelRef}/voids,/journeys/{trackingNumber}/scans) stay behind the transactional middleware; there is no PATCH and no unkeyed write.- The key is global: migration
0002_idempotency_key_globalmakeskeythe primary key (rows that shared a key across routes keep the oldest; they live 24 h). - Fingerprint = method + path + SHA-256 of the body. Same key, different fingerprint:
409idempotency-key-reused(was 422validation-failed). - Missing key:
400 idempotency-key-required; not 1-128 printable ASCII:400 idempotency-key-invalid(was 422). - A replay carries
Idempotency-Replayed: true; the first execution never does. - The key row, the aggregate change and the outbox rows still commit in one transaction; 5xx and
concurrent-updateare not stored.
- The key is global: migration
- Pagination. The service has no collection GET (
GET /journeys/{trackingNumber}is one resource whosescansarray is part of it), so nothing is paginated and nox-pagination-exemptis declared. - Lint.
.spectral.yamlruns therest-guidelinerule (spectral lint apis/openapi.yaml --fail-severity=warn).
Consequences
- Breaking for callers of the void route and for anything that read 422 as key reuse. vendor-connectivity (POST /labels) is unaffected except for the new problem types. No other repo was found calling the void route.
- Must deploy together with the REST cutover set of the fleet.
Addendum 2026-11-19: which refusals are stored
"5xx and concurrent-update are not stored" under "Idempotency" above is superseded by
ADR 0020: every problem type has a replay class on its
catalogue entry, and a refusal is stored (and replayed with Idempotency-Replayed: true) only when the class
is FINAL or OUTCOME. The fingerprint, the status of the key problems and the replay header are unchanged.