Repository navigation
Description
Part of #1645.
Scope
Through a gateway, an iOS lease that names a mode, or takes one from a baseline, goes only to a worker that serves that mode. When no worker serves it, the lease fails at once with MODE_UNAVAILABLE. A worker that refuses on a stale view is skipped and the others are tried. simlock catalog through a gateway shows the fleet's served modes.
If this goes wrong, a full lease through a gateway is refused while another worker serves full, or it reaches a slim-only worker and fails there.
Technical spec
Commit 1cd9315.
Rows
Behaviours: B6, B7, B8
Interfaces: I6, I7
Existing code: X11, X12, X13, X14, X15 (the routing page), X17
Facts
| # | Fact | Source |
|---|---|---|
| F1 | A request naming a baseline is checked first, and the rest of the table runs over the fitting holders with the request narrowed by withBaseline, so its mode is the baseline's |
src/gateway/routing/serviceability.ts:115-122, src/gateway/routing/request-match.ts:54-65 |
| F2 | A relayed code in CANNOT_SERVE_CODES before a progress push refreshes that worker's catalog and admits the request again without it |
src/gateway/fleet-dispatch.ts:450-455 |
| F3 | select takes its views from fleet-dispatch, so only a stage (not assess) keeps a worker from being picked |
src/gateway/fleet-dispatch.ts:201-216 |
Modules touched
src/gateway/routing/ (request-match.ts (servesMode), serviceability.ts, stages/can-serve.ts, pipeline.ts, AGENTS.md), src/gateway/ (fleet-dispatch.ts, fleet-refusals.ts, aggregate.ts, AGENTS.md), src/contract/ (lease-schemas.ts, protocol.ts), src/cli/commands/list.ts:62-84 and ui/src/model/waiting.ts:82-104 (the reason's text), src/gateway/test-support.ts (a catalog with modes), docs/internal/flows/device-selection.md, and the website pages gateway/routing.mdx, gateway/fleet-console.mdx (the refusal table). Searches: CANNOT_SERVE, RejectionCode, WorkerReasonCode, gatewayWaitingReasonSchema, assessLeading, canServe, addCatalogEntry, slimCategories in src/gateway.
Rules in play
- ADR 0082 §4: route by the catalog field, refuse at once, a relayed refusal is "cannot serve".
- ADR 0009 §4 and §5: the new row sits after the
NO_DRIVERrow; the new code joins the "cannot serve" codes. src/gateway/routing/AGENTS.md: "can-serveandassessask the same helpers in the same order" (servesModein both); stages stay pure.src/contract/AGENTS.md(Protocol version): I7's enum values bumpmaxby one in this PR.- Documentation rule 9: the website pages above change in this PR.
Tests
Seam: gateway assess and select over worker views (model: src/gateway/routing/serviceability.test.ts, src/gateway/fleet-routing-ranges-and-except.test.ts), the gateway dispatcher with fake links (model: src/gateway/fleet-coordinator-walk.test.ts) and the merged catalog (model: src/gateway/aggregate-catalog.test.ts).
- B6: an iOS lease through a gateway is routed by mode:
--mode fullwith one slim-only worker (I6); slim-only plus both (second picked); slim-only plus nomodesfield (second picked);--mode slimwith one full-only worker (I6, slim wording); no mode with only a slim-only worker (routed); full baseline on a slim-only worker (I6, baseline wording); slim-only first in id order plus both (no dispatch to the first);explaingivesmode-unavailable;--physicalto a slim-only worker (routed) - B7: a worker's relayed
MODE_UNAVAILABLEbefore a progress push: stale slim-only view plus a worker serving both (granted on the second); the stale slim-only worker alone (the worker's I2) - B8: the merged iOS catalog: two slim-only workers (
["slim"]); slim-only and full-only (["full","slim"]); slim-only and one with no field (absent)
Done when
pnpm test:changedpasses, with every Tests line above as a test.pnpm checkpasses, the protocol-bump check included:maxis one above the valuemainholds when this lands.- The website build passes:
pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjs. gateway/routing.mdxlists theMODE_UNAVAILABLErow in its refusal table.
Out of scope
- The worker's key, refusal and catalog field: A worker refuses the iOS modes it does not serve (ios.modes, MODE_UNAVAILABLE) #1651.
Depends on
- A worker refuses the iOS modes it does not serve (ios.modes, MODE_UNAVAILABLE) #1651
- Through a gateway, a plain lease that only phones-only workers could serve gets the phones-only refusal #1599
Written by an agent.
Activity