0005: The tower in Go, behind a written interface
Decided 2026-11-02. Changes the plan's "Swift, not Go" (docs/plans/2026-11-01-dumb-tv-and-linux.md).
Why #
The reason for Swift was that the server shares its models, formats and
parsing with the apps. What the server shares with them, though, is a small
protocol (/v1/admin, /v1/hello, the R2 mirror's format), not the models:
the tower stores settings as opaque property-list values and never looks
inside, except for the three-way merge. Meanwhile the Swift tower costs a
long compile, a Swift toolchain on every build machine, and a large image.
Decision #
- The interface is written down first (
docs/api/: prose and OpenAPI), and is the contract. Clients keep their Swift types; they depend on the interface, not on the tower's language. - The Go tower lives in
tower/and opens the samestation.sqlite(same schema, same migrations, values as wrapped binary plists), so a station can move from the Swift tower to the Go one, and back, without a migration. - Port in order of the clients' needs: settings, devices and invites (done), the R2 mirror (done), On Demand (done: catalog, shelves, posters, details, subtitles, fetch jobs), then error reports, On Demand, the planes feed. No mixed set-up (decided 2026-11-03): the end state is the whole server in Go, jobs, On Demand catalog builders and the MCP control room included. Until a piece is ported a station keeps running the Swift tower; the two are never run side by side against one database or one R2 bucket.
- Bonjour is advertised from Go (
brutella/dnssd), with the same service type and TXT record, so noavahi-publishchild process. - Clients keep working with the tower down, as before (ADR 0001): that doesn't change, since it comes from their own copy of the settings and the R2 mirror.
Consequences #
- Two implementations of the merge (Swift client, Go tower) must agree; the Go tests are the Swift tests ported case for case, plus the cases the Swift ones don't have.
- The synced-keys list is duplicated until the Swift side exports it.
Phin Tech docs
Rabbit Ears Manager in the store →