ADR-0001: Monorepo, language stacks and shared protobuf schemas
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after the November 2026 research round
- Tags:
repo,android,linux,protocol
Context
Tether is two products that are useless without each other: an Android app and a Linux daemon/desktop app. They share one wire protocol that will grow for years (notifications in M1, messages/media/files in M2, calls in M3, video/audio/input in M4, relay in M5). A single developer builds both at an aggressive pace with parallel subagents, so coordination overhead must be near zero and a protocol change must be a single commit that updates both sides and their tests.
The target desktops are consumer Debian/Ubuntu-family installs (Linux Mint 22.2 on X11 Cinnamon today, GNOME Wayland preferred going forward). The target phone is a Samsung running One UI 6+ (Android 14+), with Xiaomi later.
Platform facts that shaped the Android baseline:
- Android 14 (API 34) made foreground-service types mandatory and introduced the
connectedDevicetype we rely on (ADR-0005). Supporting API < 34 would mean a second code path for service declaration, permission prompts and CompanionDeviceManager behaviour. - Android 13 (API 33) is where
POST_NOTIFICATIONS, self-managed CDM associations and the “restricted settings” rule for sideloaded apps appeared. Everything we need is stable at 34. - Android 15 (API 35) is the current
targetSdkexpectation and the version that introduced OTP notification redaction, which we must handle (ADR-0005).
Platform facts that shaped the Linux stack:
- The daemon must hold TLS sockets, speak D-Bus, talk to Avahi, BlueZ (M3) and
PipeWire (M3), and later decode H.264/Opus at low latency (M4). It must be
packaged as a single static-ish binary for
.deb. - GTK 4.14 and libadwaita 1.5 are available on the target distribution; Qt would put us in KDE Connect’s territory and look foreign on GNOME/Cinnamon.
Decision
- One repository (
linux-phonelink, product name Tether) containingandroid/,desktop/,proto/,docs/and CI. Releases of the two products are tagged together (vX.Y.Z); protocol compatibility is tracked byprotocol_versioninHello, not by repo layout. proto/tether/v1/*.protois the single source of truth for the wire format. Rust generates code at build time withprost-build+protox(pure Rust, noprotocneeded); Android generates Kotlin with Wire from the same files via a source-set link. No hand-written message types on either side.- Android: Kotlin 2.x, Jetpack Compose with Material 3, kotlinx-coroutines,
manual dependency injection (no Hilt/Dagger until the module count justifies
it), CameraX + ZXing for QR,
minSdk = 34,targetSdk = 35, single:appGradle module for M1 (split into:core,:features:*when the shell helper lands in M4). - Linux: Rust (edition 2021, MSRV 1.85) Cargo workspace with crates
tether-proto(codegen),tether-core(identity, TLS, framing, pairing, discovery, session, capability registry, plugin trait),tetherd(daemon),tether-gtk(binarytether),tether-cli. Core libraries:tokio,rustls0.23 (ring),prost,zbus5 (tokio),gtk4-rs0.9 +libadwaita0.7,rcgen,tracing. - Both sides share test vectors (SAS, QR proof) checked into
docs/reference/protocol.mdand asserted by unit tests in both languages.
Consequences
Positive
- A protocol change is one PR touching
proto/, Rust and Kotlin, reviewable as a whole; CI runs both builds on every change toproto/. minSdk 34removes every legacy branch for services, permissions and CDM.- Rust gives one binary per component, no runtime, and the crates we need for TLS,
D-Bus, GTK and GStreamer (
gst-plugin-gtk4statically linked in M4) exist and are maintained. - Compose and gtk4-rs are both declarative enough that UI iteration stays fast for one person.
Negative / risks
minSdk 34excludes phones that will never get Android 14. Accepted: those phones are also the ones most likely to be OEM-abandoned for the background behaviour we depend on.- Two toolchains in CI (Gradle + Cargo) roughly double CI time and cache complexity. Mitigation: path filters so Android changes do not rebuild Rust and vice versa.
- The monorepo forces one issue tracker and one release cadence; a desktop-only
bugfix still produces a tag that implies an Android release. Mitigation: release
notes state per-product changes; APK and
.debare separate artefacts. - gtk4-rs follows GTK upstream closely; distribution GTK versions lag. We pin the
v4_14/v1_5feature flags to the lowest version we ship on.
Alternatives considered
- Two repositories (
tether-android,tether-linux) with the protocol in a third: three PRs per protocol change and a submodule or package-registry hop for the.protofiles. Rejected for coordination cost at a one-person pace. - Kotlin Multiplatform or Flutter for a shared UI: neither integrates with libadwaita, D-Bus, freedesktop notifications or StatusNotifierItem without a native shim that would be most of the desktop code anyway. Rejected.
- Python daemon (GLib main loop): fastest to prototype, but packaging a Python
daemon with TLS, D-Bus and later real-time video decode into a
.debthat works across Ubuntu releases is painful, and performance for M4 would force a rewrite. Rejected. - Electron/Tauri desktop app: memory footprint and non-native look on GNOME/Cinnamon; Tauri would still need a Rust daemon. Rejected.
- C++/Qt: viable, but KDE Connect already owns that space and our target desktops are GTK-based. Rejected.
- JSON over the wire with hand-written models (KDE Connect’s approach): no schema contract between two languages, drift is found at runtime. Rejected (see ADR-0002).
minSdk 26or29for wider device reach: doubles the service/CDM code paths and the testing matrix for features that are flaky on exactly those devices. Rejected.