Skip to content

[tech-debt] Make OpenAPI spec authoritative + CI route-contract drift check #8546

Closed

Description

@Git-on-my-level

Problem

The client/server contract is maintained by hand in 5+ places with no codegen. docs/api-reference/openapi.json exists but is docs-only — no client is generated from it and nothing verifies it matches the actual FastAPI routes. Result: silent drift between the spec, the server, and every hand-rolled client.

Evidence

  • Hand-rolled clients: desktop/macos/Desktop/Sources/APIClient.swift (5,263 lines), web/app/src/lib/api.ts (2,251), 31 files under app/lib/backend/http/, plus a separate Windows TS client.
  • openapi.json is under docs/ and not wired to client generation.

Scope of this PR (one coherent change — backend side, make the spec authoritative)

  • Generate the OpenAPI spec from the live FastAPI app (single source of truth) instead of a hand-maintained file.
  • Add a CI check that fails if the committed spec drifts from the actual routes.
  • Document the spec as the contract clients must conform to.

Acceptance criteria

  • The committed OpenAPI spec is produced from the app and verified in CI.
  • A route added/changed without updating the spec fails CI.

Out of scope

  • Generating the Swift/Dart/TS clients from the spec (follow-up). This PR makes the contract real and drift-proof on the server side first, which is the cheap high-value step.

Part of a tech-debt / agent-friendliness audit. Filed via Claude Code.

Activity

  1. added
    backend
    docs-tooling
    on Jun 29, 2026
  2. added a commit that references this issue on Jun 29, 2026
    e46fdd8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backenddocs-toolingrefactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions