ADR 0008: Adopt the fleet REST API guideline
Status
Accepted (2026-11-01).
Context
The fleet REST API guideline (R1-R8: noun routes, idempotent POST/PATCH, 409 idempotency-key-reused,
Idempotency-Replayed, keyset paging with {items, nextCursor}) is mandatory for every apis/openapi.yaml
and is enforced by a Spectral rule in the api-lint job. This context is read-only
(ADR 0001): it has no POST and no PATCH, and its two list
GETs are the only operations the guideline touches.
Decision
- Ruleset.
.spectral/functions/restGuideline.jsand therest-guidelinerule in.spectral.yaml;spectral lint apis/openapi.yaml --ruleset .spectral.yaml --fail-severity=warnexits 0. - Routes. No route is renamed:
/products,/products/{catalogItemId}and/categoriesare already plural nouns. NoIdempotency-Keyexists because no route writes; this is stated rather than assumed (nothing to wrap, no key store, noIdempotency-Replayed). GET /productsis paged withlimit(1-500, default 100, was 1-100 default 20) andcursor, and answers{items, facets, categorySuggestions, nextCursor}(was{hits, facets, categorySuggestions, next}).nextCursoris absent on the last page.facetsandcategorySuggestionsare the search-style siblings the guideline allows (STANDARD 3.3).- Cursor format (assumption). The cursor stays the domain's own keyset
search.Cursor(sort, matching mode, rank/price/title,catalogItemIdtiebreak; ADR 0002), still opaque base64url JSON. The fleetpagepackage is copied underinternal/adapters/inbound/http/pageand suppliesLimit,Unknown, the envelope errors and the problem mapping; itsPositionencoding is not used because relevance ranking needs the rank and the mode in the cursor. The query orders by (sort key,catalogItemId). - Problems.
400 invalid-limit(empty, repeated, not an integer, outside 1-500),400 invalid-cursor(repeated, undecodable, or a cursor of another sort or matching mode; was422),400 unknown-query-parameter(any undeclared parameter, so the retiredafter,offsetandnextTokenfail loudly). Filter errors (sort, prices,inStock,q) stay422 validation-failed. - Exemption.
GET /categoriescarriesx-pagination-exempt: view: it is one versioned CategoryView tree with purchasable counts rolled up, a single composite resource that is meaningless in slices. - A2A. The
search_productsskill keeps its own tool schema (after,hits,next, in-band422); only itslimitbound follows the domain (1-500).TestParity_TheAgentExposesExactlyWhatRESTExposesmaps the envelope names and pins the one deliberate difference (paging problems). - Consumers in this repo. The rebuild source clients (
internal/adapters/outbound/sources) sendcursor(wasafter) and readnextCursor(wasnextforGET /item-pricesandGET /product-contents) until it is absent.GET /categoriesof product-content is read as a single tree, unchanged.
Consequences
- Breaking for every reader of
GET /products(storefront-bff):cursorinstead ofafter,itemsinstead ofhits,nextCursorinstead ofnext. The REST cutover set deploys together. - No Schemathesis job exists in this repo, so no
schemathesis.tomlis needed.