Skip to content

fly: hand-authored Sprites API contract + emulator-coverage check - #815

Merged
lex00 merged 1 commit into
mainfrom
feat/808-sprites-contract
Jul 12, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/808-sprites-contract

Conversation

@lex00

@lex00 lex00 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Part of #808 (T3).

Why

The Fly Machines API ships an OpenAPI (docs.machines.dev) the fly surface generates + drift-checks against (T1, #813). The Sprites API (api.sprites.dev) ships no machine-readable spec at any conventional path, so there's nothing to diff automatically. This adds the manual stand-in.

What

  • sprites-contract.ts — SPRITES_CONTRACT: the exact 6 endpoints the fly sprite activities depend on (one per activity), plus normalizing helpers ({cp}≡{cid}, WS→GET). Provenance (sprites.dev, no OpenAPI) and bump policy documented.
  • sprites-contract.test.ts (runs in CI):
    • covers every sprite activity; methods/paths well-formed;
    • normalization maps WS→GET and collapses param names;
    • drift anchor — every contract path segment must appear in the sprites.ts source, so a changed activity endpoint forces a contract update in the same change.
  • sprites-contract.docker.integration.test.ts (docker-gated): boots the pinned spritzer, reads /_spritzer/health, asserts contract ⊆ implemented paths — the real fidelity check, since spritzer tracks the live Sprites API. Skipped in CI unless SPRITES_DOCKER=1 (same gating as the other spritzer docker test).

Validation

  • Contract unit test: 5 green (incl. drift anchor).
  • Docker coverage test: run locally against the live spritzer image — contract fully covered.
  • Full fly suite green (180 passed, 1 skipped); fly lexicon builds.

#808 status after this

… T3)

The Fly Machines API ships an OpenAPI the fly surface drift-checks against; the
Sprites API (api.sprites.dev) ships none. This adds the manual stand-in: the
exact endpoint set the fly sprite activities depend on, maintained by hand.

- sprites-contract.ts: SPRITES_CONTRACT (6 endpoints, one per sprite activity)
  with param-name-normalizing helpers. Provenance + bump policy documented.
- sprites-contract.test.ts (CI): asserts the contract covers every sprite
  activity, normalization maps WS→GET and {cp}≡{cid}, and — the drift anchor —
  every contract path segment appears in the sprites.ts source, so a changed
  activity endpoint forces a contract update in the same change.
- sprites-contract.docker.integration.test.ts (docker-gated): boots the pinned
  spritzer, reads /_spritzer/health, and asserts the contract ⊆ implemented
  paths — the real fidelity check, since spritzer tracks the live Sprites API.

Verified locally against the live spritzer image: contract fully covered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant