ADR 0019: Adopt the fleet REST API guideline
Status
Accepted (2026-11-02). Breaking for REST clients; no CloudEvents type or payload changes. Follows ADR 0006 and ADR 0007 (the outbox the key row now commits with).
Context
The fleet standardised its REST contract (noun routes, idempotent POST/PATCH,
one paging envelope) and enforces it with a Spectral ruleset (.spectral.yaml,
.spectral/functions/restGuideline.js). This service had one verb route, four
unkeyed POSTs and five unbounded or differently-shaped collections.
Decision
Hard cutover, no aliases, no toggles.
- Route.
POST /capacity-plans/{id}/publishbecomesPOST /capacity-plans/{id}/publications(operationIdunchanged, so the MCP and A2A mappings do not move). The old route answers 404/405 (TestRetiredRoutesAreGone). - Idempotency. Every POST requires
Idempotency-Key(1-128 printable ASCII). The key is global and looked up by key alone; the fingerprint is method + path + sha256(body). Missing key: 400idempotency-key-required; malformed: 400idempotency-key-invalid; same key with a different request: 409idempotency-key-reused; a replay carriesIdempotency-Replayed: true. Migration0011_idempotency_keysadds the table; the key row is saved in the sameUnitOfWorkas the aggregate and its outbox rows. 4xx answers are stored and replayed, 5xx are not. PUT takes no key. - Paging.
GET /process-paths,/capacity-plans,/station-standardsand/inbound-labour-standardsanswer{items, nextCursor}withlimit(default 100, max 500) and an opaque keysetcursor; problemsinvalid-limit,invalid-cursor,unknown-query-parameter. The formercapacity_plans,process_paths,standardskeys and the echoedlocationare gone. - Exemptions (
x-pagination-exempt: view):GET /process-capacities(the single effective rate of one process/location/window),GET /process-paths/{id}/capacity(one computed breakdown) andGET /storage-capacity(one site's tally); each is a single computed view, not a collection.
Consequences
capacity_mfe(web/) sends a fresh key per POST and followsnextCursor.cursorandidempotency_keystypes live ininternal/domain/pagecursorandinternal/domain/idempotencybecauseapplication/portsis interfaces-only (arch test).- Other callers (
e2e-tests) update to the new route in their own PRs.