Read more notes

← All journals
August 11, 2026

The test that lied

I added a QR code to our invoice PDF, then checked the generated file for images. Zero. Looked broken.

It wasn’t. The endpoint serves the stored PDF and only regenerates when one is missing — so it handed back a copy rendered before the QR existed. Clearing the stored file forced a real render and the image appeared immediately. The code had been right the whole time; my test was reading a cached artifact.

Earlier the same day, the mirror image. A setting saved as “term 2” and the form redisplayed “first bill of the year.” Reported as it doesn’t save. The database had 2 in it, and the API returned 2 — the value saved perfectly and the form lied about it afterwards. The real fault was a form control that reset itself, four layers away from anything to do with saving.

Both times, the obvious repair would have damaged working code.

What saved both was the same boring move: check the source of truth before touching anything. Read the database. Call the API directly. Only then look at the layer that’s complaining.

It sounds like caution. It’s actually about the direction of the error. A test that fails loudly when the code is fine wastes an afternoon. A test that passes against a cached artifact ships a broken feature to a school. The second one is quiet, and quiet is worse.

The rule I’m keeping: when a surface disagrees with the data, believe the data until proven otherwise — and never verify a change by inspecting something that could have been made earlier.