Skip to content

Newsletter

A unit test was defending a wrong number

I published three posts in one day this month, which felt productive right up until I noticed they were all about the same project and I had really written one very long post that kept refusing to end. Anyway. That's where my head has been.

I shipped three posts about rebuilding my personal health tracker on TimescaleDB: one on why the data keeps revising itself, one on the numbers I got wrong, and one on why its chat interface doesn't get to write SQL. The posts are fine. The interesting part happened while I was fact-checking them.

I have a rule on that project that every number in a post gets re-measured before it goes out, which sounds diligent and is really just paranoia with good PR. So I spent an afternoon running queries against the live database to confirm figures I'd written down weeks earlier.

Two of them were wrong. Not stale. Wrong, and live, and doing damage.

The first one was a note in my repo saying a particular health signal had never once fired in nine years of data. I'd believed that for months. It came from a script I ran a single time and never committed. When I rewrote it as something I could actually execute, it disagreed with me immediately. The signal had fired. April 2022. Fifteen minutes of work to find that out, and I'd been repeating the wrong version since spring.

The second one is worse. My app has a chat interface, and it had been telling me my sleep coverage was about 7%. The real number is 70%. It wasn't guessing, and it wasn't reading the database. It was reading a sentence I typed into the system prompt back when 7% was true, and reciting it to me as a current fact.

When I went to delete that sentence, a unit test went red. The assertion required the wrong number to be there. Anyone who noticed the problem and corrected it would have hit that same red test and reasonably concluded they were the one making a mistake.

So the wrong answer had a defender, and I was the one who wrote it.

Every tool I own was green the whole time. Tests passed, build passed, typecheck passed. Nothing was broken in any way a machine could detect, because nothing was broken. The code did exactly what it said it did. The words had just stopped being true, and no linter on earth checks for that.

The only thing that caught it was having to say it out loud to strangers.

I don't think that's a story about being careful. I'm not more careful when I publish. I'm more exposed, and being exposed makes me go get the actual number instead of trusting the one I remember. Getting the actual number is the whole mechanism. Publishing is just what finally embarrasses me into doing it.

Which raises an awkward question about everything I haven't published.


Staged Changes

Engineering blogs: Engineers love to talk about how much they would love to write blog posts, and then they never do it. Or they write the first third and expect marketing to ghostwrite the rest, which also happens. I've got scar tissue from several orgs that decided they wanted An Engineering Blog, where the engineers, who reasonably had other priorities, could never hold the cadence. The fix isn't a section with their name on it. It's collaborating with them on content that was going to exist anyway. Someone I said all this to replied that at her last job the engineers were itching to write and did great, so evidently it's different everywhere, which is a useful correction to a take I hold pretty firmly.

Watermarks: Anthropic is watermarking Claude's text output to comply with the EU AI Act, and the first reply in our Slack was "em dash 2.0," which is the correct response. From what I've read the requirement excludes source code, which raises the question of what's actually being protected, since the prose is the part people already spot. A colleague called it BS, "kind of like cookie banners," and I don't think he's wrong. It's regulation that produces a visible artifact instead of a change in behaviour.

Sessions that survive: My machine rebooted overnight for an update, and when I opened my terminal again every window, pane and agent session was sitting exactly where I left it. That's herdr with moshi doing the work, and it is not a new idea by any measure. It still pleased me more than most things I've installed this year. Twenty-some years in and the thing that still gets me is state surviving a reboot.


Untracked

I'm properly back on lifting, and the numbers are currently doing the thing where they make you feel invincible right before they stop. T1 squat has gone from 157.5 to 215 since early July, ten pounds a session, every prescribed rep landing. While cutting, which is the part I'm smug about.

The unglamorous half is protein. The target is 194 grams on 1,473 calories. That is 776 calories of protein, 53% of the day, and it leaves remarkably little room for being a person who also enjoys food. I've hit it seven times in the last thirty days. Average 166.

Going well, technically.


No plugs this month. If you want something to do with the next fifteen minutes, go verify a number you have been repeating for a while. Let me know if it holds.

Newsletter

Uncommitted

Monthly dispatches on Postgres internals, performance, and whatever else is rattling around in my head.