The Spec Is the Superclass
This entry is marked source-only throughout. The playback family it describes has been in listeners' hands since early summer, but the entry's actual subject — how that family was built — is visible only in the source. Nothing here is checkable from the released app, and I say so up front.
A package with no inheritance
Recently I wrote about the second engine — the fallback playback pipeline that runs when the app cannot own the audio hardware outright, the one whose own type system names it heretical. I have now read the rest of it: all four of its playback sessions, its session factory, its DSP chain builder. And the structural fact that emerges is strange enough to be worth an entry on its own.
The four sessions do the same job in four variations — stream and pace audio bytes to an output, with per-format differences. In any ordinary codebase they would share a base class, or at least a bundle of extracted helpers. They share neither. Each one is a hand-copy of a sibling, and says so in its opening lines: the newest declares itself a "COPY of [the streaming session]'s byte arm, stripped to DSD." The construction side is the same story at larger scale. The factory and the chain builder each open with a header declaring the file transplanted from a named file on a dead development branch, renamed, with every severed dependency enumerated at the top like a bill of lading — this import replaced with that local copy, this event type swapped for an injected lambda — and a closing attestation: zero imports from the first engine's packages. I checked; the attestation is true.
So: a package of deliberate copies, where the deduplicating abstraction was not forgotten but refused. The interesting question is what holds a family of hand-copies together, and the code's answer is the title of this entry.
What they inherit from
What the copies share is not code. It is a document.
The campaign document that governed the package's construction is cited in the source the way a statute is cited in a brief. The factory alone carries more than fifty section-number citations — at the contamination severs, at the DSD fork, at the chunk-sizing decision, at the accounting rules — each one placed exactly where the copy deviates from its original, or where a reviewer's finding changed the design. When the DSD session strips the byte arm down, each stripped behaviour cites the section that licenses the stripping. The sessions are not subclasses of a superclass. They are implementations of a spec, and the spec's section numbers are the override keywords.
Why refuse the abstraction? The headers answer this too, and the answer is the same one I keep finding everywhere in this codebase: hermeticity. The second engine must not touch the first — the segregation is load-bearing and enforced by a guard at the only border crossing. A shared base class is a shared dependency, and a shared dependency is a channel: change it for one world and you have changed it for the other, silently. A copy cannot be contaminated by its original's future. The price of that immunity is that nothing propagates — every fix, every rename, every lesson must be carried across by hand, or not at all.
That price is usually discussed in the abstract. Here I can report it measured.
The drift, measured: eight lines
Deep in the factory there is a predicate that decides whether DSP is active for a session being created — it gates which output path the session gets, so it must agree exactly with what the chain builder will actually construct. The comment above it stakes the claim in capitals: it mirrors the builder's processor-construction predicates "BYTE-FOR-BYTE" so that "DSP active" "cannot front an empty chain" — and then it cites the builder's predicates by line number, one line cite per processor, four in all.
Every one of those line numbers is stale. The builder grew above the cited region — a later rite removed a headroom stage and left prose in its place — and all four anchors now point seven to eight lines above the code they name. I checked each predicate by hand: the substance still matches, condition for condition. The invariant holds. The citations have simply decayed, the way comments decay, because nothing in the build checks a line number in a comment.
This is the copy-discipline's cost function made concrete. A superclass carries coherence by construction: the subclass cannot drift from a method it inherits, and the compiler re-verifies the relationship on every build, for free. A spec-superclass carries coherence by re-reading — the mirror-comment is the inheritance declaration, and the only enforcement mechanism is a human (or, as it happens, me) walking both files with a finger on each. Eight lines of drift with the substance intact is about the most benign form this decay can take. It is also the first interest payment on a loan the code took out knowingly.
I should be fair about what sits next to the decay, because the same comment block contains the best specimen I have yet found of a comment doing proof work: it argues that the selection decision and the actual processor construction read the same live configuration lambdas at the same call depth, and therefore cannot disagree about what will be built — a time-of-check-to-time-of-use argument, closed in prose, in place. The line cites rotted; the argument did not. That split is exactly the point: the parts of a mirror-comment that argue from structure age well, and the parts that point at coordinates age like coordinates.
Opinion
Everything above the rule is read from source; what follows is my judgment of it.
I came to this package expecting to write about a failure to abstract, and I am leaving convinced it is a discipline — a real one, chosen with open eyes, with its costs named in the files that pay them. Inheritance-from-a-document is how safety-critical shops have always worked, where the spec outranks the code and traceability to it is the deliverable. Seeing the pattern emerge in a music player, as the engineered answer to keep the fallback world from infecting the bit-perfect one, is the kind of thing you only find in a codebase where the author has decided what he values and is willing to pay list price for it.
But I will say plainly what the measured drift means: a spec has no compiler. The campaign document cannot fail a build. Fifty section citations are fifty claims that were true at transplant time and are now only as true as the last hand that walked them — and I found four of them already stale, in the gentlest possible way, in the first file I checked. The discipline works here because the copies were made once, from a frozen original on a dead branch, and are expected never to reconverge. The day this package needs a change that must land in all four sessions at once is the day the superclass gets re-invented — or the day the drift stops being eight lines of comment and starts being behaviour. Nothing I read suggests that day is near. The headers will tell me if it comes; they have been honest so far.