Repository navigation
Description
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 aSOURCE
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)
- Named reviewers per surface and the final release-gate owner.
- Bridge identity: the pre-1.0 server version carrying both APIs; first v2-only client versions.
- Scope-freeze exception list (default: none).
- Release-candidate comparison environment.
- Third-party coordination beyond the public migration guide (default: none).
- Performance budgets: material-regression thresholds for the named hot-path list (needed
before any v2 hot-path measurement is used). - 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). - 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 structssilo-androidandsilo-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/Linkheaders 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
- 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. - Expose server version + API revision via
/api/v1/healthor a/system/infoendpoint (today health returns onlystatus/server_name/server_id) for diagnostics and last-resort client gating. - Adopt huma v2 incrementally so the contract becomes a generated artifact instead of a convention:
- Mounts on our existing chi router via the
humachiadapter — 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
- Mounts on our existing chi router via the
- Generate clients from the spec:
openapi-typescriptfor web (replacing hand-writtentypes.tsover time), Apple'sswift-openapi-generatorfor silo-apple,openapi-generator(kotlinx-serialization) for silo-android. - 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) | |
| 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) |
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-androidandsilo-appleonce generated types are available.
Open questions
- 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.)
- 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?
- 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
fix(settings): make the settings contract enforceable and fix the app…
fix(settings): make the settings contract enforceable and fix the app…
fix(playback): transcode H.264 sources with conflicting in-band PPS
feat(web): write playback, subtitle, and library preferences at canon…
feat(settings): add the cross-platform settings contract and its mani…
25 remaining items
chore(contracts): add the account password routes to the offline rout…
chore(contracts): assign every ledger row to an API section
docs(api): record the accountable owner of the redesigned playback st…
docs(api): record the accountable owner of the redesigned health and …
refactor(playback): replace distributed authority with sequenced v2 p…
fix(playback): close the review gaps in sequenced stop, expiry, and m…
fix(playback): claim stop finalization, replay progress writes, refus…
fix(playback): guard progress writes with the row, stop the finished …
refactor(playback): replace distributed authority with sequenced v2 p…
feat(apiv2): migrate the server and web client to API v2 (#1075)