ADR 0012: adopt the fleet REST API guideline
Status
Accepted (2026-11-01).
Context
The fleet REST API guideline (warehouse-docs, rules R1 to R8) is mandatory for every apis/openapi.yaml: URLs name
nouns, every POST and PATCH is idempotent (Idempotency-Key, 409 idempotency-key-reused, Idempotency-Replayed),
and every collection is paged with limit + cursor and answers {items, nextCursor}.
Decision
- Ruleset.
.spectral.yamlcarries therest-guidelinerule (.spectral/functions/restGuideline.js); theapi-lintjob runs it with--fail-severity=warn. - Routes. No rename: both operations are already nouns (
GET /scorecards/{nodeId},GET /scorecards). - Idempotency. The service is read-only (ADR 0002, A21): there is no POST, PATCH, PUT or DELETE, so there is no
middleware, no key table and no
409 idempotency-key-reused. The guideline's key rules apply the day a write route exists; it then needs the middleware, joined to the unit of work. - Pagination.
GET /scorecardstakesgrade,window,limit(1 to 500, default 100) and the opaquecursor(base64url JSON{s,i}frominternal/adapters/inbound/http/page, copied from the fleet reference). The keyset is thescorecardId, which is unique, so the sort key and the id are the same value; the repositories and the use case are unchanged and the HTTP adapter wraps and unwraps the cursor.afteris retired. - Problems.
400 invalid-limit(absent is 100; empty, repeated, non-integer or out of 1..500 is refused),400 invalid-cursor,400 unknown-query-parameter(any parameter other thangrade,window,limit,cursor, e.g. a retiredafter,offset,nextToken).422 validation-failedstays for a missing or unknowngradeand an unknownwindow.malformed-request-queryremains for a NUL character. - Exemptions. None:
GET /scorecards/{nodeId}is an item, not a collection. - MCP and A2A keep their own tool schemas (
afteris the scorecardId there); they call the same use case.
Consequences
Breaking for the one paged consumer: the console remote (web/src/api.ts, in this PR) sends cursor instead of
after. Deploy with the REST cutover set.