Writing

Something that can tell me no

Keryx's retransmission brought back every dropped packet. I didn't believe it until I turned it off.

7 Sept 2026 · Updated 2 Oct 2026 · 4 min · Ernest

Correctness, Media & codecs

Keryx, my WebRTC stack in C#, has a fault injector. Give it a seed and a loss rate and it drops packets on purpose, so I can check that retransmission puts them back. With retransmission on, every missing packet came back. That was the result I wanted, which is why I didn't trust it yet.

So I ran the same seeds with retransmission off. At 1%, 5% and 15% loss that left 19, 113 and 314 permanent holes, climbing with the loss rate the way they should. Now the first result meant something. Before the control, "every packet came back" looked exactly like "nothing was ever dropped."

It took me three projects to take that seriously. A test I write encodes my understanding of the problem, and so does the code. When the understanding is wrong, both are wrong the same way, and the test passes. The checks worth having are the ones that share as few of my assumptions as possible, which usually means something I didn't write.

Things that can say no

Kiln, my H.264 encoder, is decoded by ffmpeg and by Apple's VideoToolbox on every test. That's how I found two bugs in its deblocking filter that every stream survived. A decoder I'd written would have shared my misreading of the spec and drifted right along with the encoder.

Keryx is tested against a real headless Chrome, which implements the RFCs as written rather than as I read them. For STUN I could go one better: RFC 5769 publishes test vectors, so I implemented against those and took my interpretation out of the loop entirely. It's the cheapest check on this list.

Weft, my compiler, checks every fast path bit for bit against a slow scalar reference, with no tolerance. That reference has to be maintained forever alongside the code it checks, because the day it drifts it stops being a check and becomes a second opinion.

What it costs

None of this is cheap. Two decoders on every stream, a browser in CI, a reference implementation that never ships a feature. When it's working, nothing happens, which makes it easy to skip.

The question I ask now is whether anyone else's implementation would have an opinion about my output. If there is one and I haven't asked it, my tests are just agreeing with me, expensively.