More Test Code Than Product Code

0.4.0 part one is on main. A map of the codebase, by the numbers.

3 min read | KEIBIDROP Series

Where things stand

The first half of 0.4.0 just merged to main: continuous in-band key rotation with post-quantum forward secrecy, a dedicated QUIC lane so urgent reads never queue behind bulk transfer (now also through the relay), connection migration across network changes, and connects that skip attempts a blocking router would doom. Not released yet; part two is in progress.

The numbers

With this merge the repository crossed a line we care about: it now holds more test Go than product Go.

26,538 lines of product Go across 94 files. 27,107 lines of test Go across 143 files. Ratio 1.02, and the branch that tipped it came in at 1.62 lines of test per line of logic.

Counts are raw lines of tracked Go files, excluding generated protobuf (3,369 lines). The Rust desktop UI is not in these numbers.

The map

Every subsystem, with a link into the source on main:

SubsystemWhat it isLines
pkg/logic/commonorchestration: connect, resilience, QUIC control lane, fold driver, reachability6,100
pkg/filesystemthe FUSE mount: on-demand reads, chunk bitmaps5,222
pkg/sessionsecure channel: handshake, epoch ratchet, entropy fold, health3,284
pkg/transportQUIC and TCP lanes, connection migration1,753
pkg/logic/servicethe gRPC service the peers speak1,457
pkg/discoveryLAN discovery (mDNS)1,141
cmd/kdthe scriptable agent CLI1,121
pkg/identitykeys, keychain storage, incognito1,002
pkg/cryptoprimitives: AEAD, hybrid post-quantum KEM, ratchet KDF969
cmd/clithe interactive terminal CLI798
pkg/queuetransfer queueing725
mobile + rustbridgeFFI bindings for the mobile apps and the Rust desktop UI; mostly mirrored types2,180
pkg/config and the restconfig, shared types, sync tracking1,835

An honest note on that table: the bindings rows are repetitive type plumbing, not logic. The engine proper, everything a security reviewer would want to read, is about 21,000 lines.

The crypto looks small at 969 lines, and that is the point. The primitives are standard constructions; the hard part is the lifecycle around them, which is why the session layer above them is three times their size and where this cycle's race fixes lived.

What "verified" means here

The tests are not decoration. Before the merge, the branch ran day-long soaks between peers in Romania and Singapore: 102 of 102 cycles byte-perfect, zero reconnects. The race conditions it closed each carry a deterministic reproduction, including two windows the Go race detector cannot see: one proven by high-count repetition in the scheduling regime that exposes it, one by a test that wedges the exact interleaving through a seam. The integration suite is self-contained: clone the repo and go test ./tests/... runs the same peers, mounts, and relay the product ships.