Skip to content

API v2 program epic: /api/v2 contract reset on Huma, bounded bridge, v1 retirement at 1.0 #135

Open

Description

@Quick104

Program decision (supersedes the original proposal, preserved below)

Silo 1.0 ships /api/v2 as the first stable native API, implemented with Huma v2 on the
existing chi router. /api/v1 is a frozen alpha contract: carried through exactly one published
pre-1.0 bridge release, then retired — the 1.0 main API listener serves a 410 Gone tombstone
(client_upgrade_required, Cache-Control: no-store) for the whole /api/v1 namespace. The
database schema resets at 1.0 with a squashed baseline; the bridge is the mandatory upgrade
waypoint (0.x → bridge → 1.0).

This replaces the original incremental-v1 / generated-native-client proposal:

  • v2 major with a hard cutover, not additive-only v1 evolution;
  • web uses generated TypeScript types from the committed OpenAPI 3.1 artifact; Apple and
    Android keep handwritten lenient models proven against vendored fixtures with a SOURCE
    commit pin (no Swift/Kotlin codegen);
  • deterministic operation registration, committed byte-reproducible spec, semantic-diff CI;
  • no compatibility shims except the one bounded bridge release;
  • Postgres is the only per-user store at 1.0 (SQLite userdb retired; the bridge keeps the
    one-way import).

Durable architecture: docs/architecture/api-contract.md and the draft administrator guide
docs/update-to-1.0.md, landed by PR #880. This issue and its child issues are the durable
program state; each phase ends with a checkpoint comment here.

v1 feature freeze

Declared as of Phase 0: /api/v1 receives critical bridge fixes only; all new contract work
targets v2. Scope-freeze exceptions (already-approved v1 work allowed to finish): none
recorded yet — maintainer to confirm.

Phases and child issues

Phase Scope Issue
0 Program setup: durable docs, policy updates, this epic PR #880
1 Exhaustive route/consumer inventory, migration ledger, tier-1 catalogs #881
2 Contract foundation: Huma mount, wire rules, error adapter, OpenAPI CI, fixtures #882
3 Client harnesses (web/Apple/Android) + pilot slice #883
4 Section-by-section vertical migration (one PR per section; section issues from the Phase 1 ledger) #884
5 Bridge release #885
6 1.0 cutover and lock #886
7 Post-cutover cleanup #887
Schema 1.0 hygiene + migration reset (parallel workstream) #888

Phase gates are as recorded in the program plan and docs/architecture/api-contract.md
("Release gates"): no phase N+1 work starts before phase N's gate is demonstrated. Work may
stack on unmerged branches; merging is a maintainer call.

Schema workstream (parallel)

Tracked in #888. First PR: dead-table drops — #879. Two items are blocked on maintainer
decisions
(library-restriction layers; per-user policy override columns on users) and are
not implemented until recorded here.

Execution inputs still open (maintainer)

  1. Named reviewers per surface and the final release-gate owner.
  2. Bridge identity: the pre-1.0 server version carrying both APIs; first v2-only client versions.
  3. Scope-freeze exception list (default: none).
  4. Release-candidate comparison environment.
  5. Third-party coordination beyond the public migration guide (default: none).
  6. Performance budgets: material-regression thresholds for the named hot-path list (needed
    before any v2 hot-path measurement is used).
  7. Structured-body read timeout for Huma operations (current 30 s server read timeout is the
    baseline; Huma's 5 s default is not accepted implicitly).
  8. The two schema decisions listed in Schema workstream: 1.0 hygiene and migration reset (umbrella) #888.

Cross-repo coordination

Where a Phase 4 section is consumed by Apple or Android, a linked issue is filed in
silo-apple / silo-android covering fixture sync, SOURCE pin, and conformance tests; the
link (or n/a) is recorded here per section. Ordinary server CI never fetches client repos.


Original proposal (superseded 2026-09-01 by the program decision above)

Problem

Our entire first-party API lives under a single hardcoded /api/v1 prefix with no machine-readable contract. The contract is maintained by convention across four codebases:

  • web/src/api/types.ts — a ~3,900-line hand-written TypeScript mirror of Go handler structs
  • silo-android and silo-apple — their own hand-maintained model layers
  • Go handlers — request/response structs defined inline per handler file, no shared DTO package

A renamed Go field breaks three clients silently; nothing detects it before runtime. As the API surface grows (~558 handlers across ~81 files in internal/api/handlers/), this is our biggest versioning risk — not the absence of a /v2.

What we already have (and should keep)

The codebase already follows most of the best practices for our deployment model (self-hosted servers, clients that update independently in both directions of version skew):

  • URL version prefix: everything mounted under /api/v1 (internal/api/router.go)
  • Deprecation flow: Deprecation/Sunset/Link headers on superseded routes (internal/api/handlers/legacy_read_routes.go, July 2026 sunset)
  • Capability negotiation: GET /notifications/capability, { "enabled": false } stubs on AI endpoints — clients feature-detect rather than version-detect

For self-hosted software (Plex/Jellyfin/Home Assistant model), URL version bumps are nearly useless because the fleet can never be forced forward. The consensus approach is additive-only evolution within v1 + capability probing, reserving /api/v2 for a contract reset we hopefully never need.

Proposal

  1. Write a breaking-change policy doc in docs/architecture/: additive-only within v1 (no field renames/removals/type changes/status-code repurposing), removal only via the existing Deprecation/Sunset header flow, capability endpoints for new features.
  2. Expose server version + API revision via /api/v1/health or a /system/info endpoint (today health returns only status/server_name/server_id) for diagnostics and last-resort client gating.
  3. Adopt huma v2 incrementally so the contract becomes a generated artifact instead of a convention:
    • Mounts on our existing chi router via the humachi adapter — auth/profile/rate-limit middleware unchanged
    • Handlers become typed func(ctx, *Input) (*Output, error); validation + OpenAPI 3.1 generated from struct tags
    • Migration is per route group: new surfaces (e.g. notifications) start on huma, old handlers convert opportunistically — no big-bang
  4. Generate clients from the spec: openapi-typescript for web (replacing hand-written types.ts over time), Apple's swift-openapi-generator for silo-apple, openapi-generator (kotlinx-serialization) for silo-android.
  5. CI breaking-change detection: dump the OpenAPI spec at build time and diff against main (e.g. oasdiff) so contract breaks fail CI instead of surfacing in client crash reports.

Alternatives considered

Option Verdict
goa (design-first DSL) ❌ Wants to own the whole transport layer — would mean rewriting all ~558 chi handlers and adapting our middleware into its interceptor model, for a contract we can get incrementally with huma. Can't help jellycompat/ABS compat (those must match someone else's wire format). Great greenfield, poor retrofit.
oapi-codegen (spec-first, chi-native) ⚠️ Strongest alternative. Pick this over huma only if we want spec-first governance (API changes reviewed as YAML diffs before code). Cost: someone must hand-author an accurate spec for the existing 558 endpoints, and every future endpoint starts with YAML.
ogen ❌ Excellent codegen but generates its own server — doesn't slot into chi incrementally.
swaggo/swag (comment annotations) ❌ Zero handler changes, but comments aren't runtime-enforced — the spec drifts exactly like types.ts does today.
fuego / swaggest-rest (code-first) ❌ Same idea as huma, younger/smaller communities, no compensating advantage.
ConnectRPC / gRPC + protobuf ❌ for now. Best-in-class generated TS/Kotlin/Swift clients and we already use protobuf in the plugin SDK, but adopting it is the v2 contract reset, and it fits poorly for HLS/streaming/image endpoints. File under "if v2 ever becomes unavoidable."
tygo + CI type diff (minimal) ⚠️ Cheap fix for web-client drift only; does nothing for Android/Apple, captures types but not endpoints/params/status codes.

Scope notes

  • The jellycompat and Audiobookshelf compat servers are out of scope — they implement third-party wire contracts and are versioned by emulated upstream version strings.
  • This interacts with the planned router decomposition (docs/superpowers/plans/improve/005-router-decomposition.md); huma adoption per route group could ride along with that work.
  • Client-visible changes will need coordinated follow-up in silo-android and silo-apple once generated types are available.

Open questions

  1. Do the Android/Apple teams want generated Kotlin/Swift models, or would they keep hand-writing them regardless? (Determines how much of the OpenAPI investment pays off.)
  2. Code-first (huma, Go is source of truth) vs spec-first (oapi-codegen, YAML is source of truth) — does anyone want design review to happen in the spec?
  3. Migration policy: "new endpoints must use huma, old ones convert opportunistically" vs scheduled conversion sprints?

Research and drafting by Claude Code (analysis of router/middleware/client coupling, tooling comparison); reviewed and filed by @Quick.

Activity

  1. added
    v1.0
    on Jun 12, 2026
  2. added this to the v1 milestone on Jun 12, 2026
  3. added
    v1.0-proposed
    v1.0
    and removed
    v1.0
    v1.0-proposed
    on Jun 13, 2026
  4. moved this from Todo to No status in Silo v1.0.0on Jun 22, 2026
  5. 25 remaining items

  6. moved this to In Progress in Silo v1.0.0on Sep 19, 2026
  7. added
    triaged
    and removed
    triaged
    on Sep 20, 2026
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

    api-v2epicv1.0

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions