← Weekly essays

599 tests pass, and the resolver still gets 6 wrong

#ai-agents#data#automation#solo-founder

A dense field of small identical dim tiles on the left, and on the right a block of fifty dots where forty-four glow amber and six are empty dashed outlines

My test suite said 599 passing. The first time someone who didn't know my answers graded the same code, it got 6 of 50 wrong. Both numbers are true, and the distance between them showed me what a green suite can prove and what it never will.

The code is a resolver in Binderdex, my trading card collection and price app. It reads incoming news stories about cards and matches each one to the right card in a catalog, the master list of every card the app knows, so a story can be linked to the card it's about. It had been running in production for weeks, and I hadn't found a single bug. What bothered me was the structure of my confidence. The tests checked the code against fixtures, which are hand-written inputs paired with the outputs I expect, and the fixtures encoded assumptions I'd made. If those assumptions were wrong, the suite would faithfully reproduce my wrongness 599 times, in green.

A review I'm not allowed to grade

So I built a calibration exercise, which is a different thing from one more test. A fresh operator sits down with 50 matches the resolver made, each with the evidence behind it, and never sees the ground truth, meaning the answer key of correct matches. They approve or reject every match while a clock runs. If all 50 come out right in under 10 minutes, the resolver passes, and anything less is a fail.

The resolver scored 44 out of 50.

CONSISTENCY graded against fixtures I wrote 599 unit tests, all passing The code does what the spec says measure the gap CORRECTNESS graded by someone blind to my answers Truth-blind calibration, 44 of 50 The spec matches reality measures
The tests prove the code does what the spec says. The calibration checks whether what the spec says is correct.

Six confident wrong answers

None of the six failures was a crash or a parse error. They were confident wrong matches. A news story about a promotional card, a special version handed out at events, got matched to the regular version from the main set. A reprint announcement got matched to the original printing. The resolver had evidence for each one, and the evidence was internally consistent. It was pointing at the wrong card, in a way that looks right to anyone who isn't paying close attention.

Unit tests are structurally blind to this failure. A unit test says that a given input should produce a given output, and if the expected output is wrong, the test passes for as long as the code reproduces it. That makes it a consistency check. It tells me the code matches the spec, and it has no opinion on whether the spec matches the world.

Why 50 more fixtures would change nothing

I could have answered the six misses with more tests: write 50 new fixtures, cover the edge cases, ship 649 passing. That is the same trap with a bigger number on it. Every fixture I write encodes my own judgment, and my judgment is the thing under test.

The calibration works because the operator doesn't know what I think the right answer is. They look at the evidence fresh and decide. When they agree with the resolver, I get independent confirmation. When they disagree, I get a signal that no test I wrote myself could ever send.

Built so I can't cheat

The exercise runs entirely offline, with no database connection, no network and no production reads. It starts from a corpus of 100 stories whose correct cards I confirmed by hand, frozen and hashed so they can't quietly change, plus a catalog snapshot that is hashed and tied to that corpus. A generator picks the 50 candidates so they cover as much variety as possible, spread across the card games the app covers, the different ways the resolver matches, and the different kinds of link between a story and a card, such as a story that features a card versus one that only mentions it.

The operator sees candidate metadata and resolver evidence. Their decisions, timing data and the card each decision picked download as strict JSON, and a separate verifier script rebuilds the hidden answer key from the corpus to check every decision. The truth is frozen before the pack exists, and I can't see the operator's decisions until the verifier has already scored them. The only way to pass is to be right.

The misses were the deliverable

I built the calibration expecting a gate that would say ship or block. The 44 turned out to be more useful than a clean pass, because the six failures gave me a map. Each one pointed at a class of ambiguity the resolver wasn't handling: promotional variants, reprints across sets, and cards with near-identical names in different games. I had never written that list down. It surfaced through someone disagreeing with my system, which introspection had never produced.

The exercise now runs on every resolver change. It costs about 10 minutes of a fresh operator's time, which is cheaper than the hour I'd spend wondering whether a new matcher broke something I can't name.

Two questions hiding in "does it work"

Nothing here is a failure of testing. "Does the code work" has two layers, and most of us measure only the first. Consistency asks whether the code does what the spec says, and unit tests answer that well. Correctness asks whether the spec says what reality is, and only a grader who can't see your answers can settle it.

If you build anything that makes automated decisions about identity, matching or classification, find your own 44 out of 50. The 599 told me my code agreed with me. The 44 told me how often I was right, and the bugs live in the space between those two numbers.