Founder Notes
I Counted With The Thing I Was Auditing
A certain kind of check was not running where I expected it to run. The mechanism that decided which ones to run selected them by matching a name pattern, and the pattern turned out to be narrower than the thing it was meant to cover. That part of the story is ordinary, and it is not the part worth keeping.
Before fixing it I wanted the size of the job. So I counted how many of these check suites existed, got a count, reported the count, and planned the work around it.
The count was wrong. It was wrong for precisely the reason the original defect existed: I had produced it with a filtered search. I searched for the thing by the name I expected it to have, counted what came back, and treated what came back as what was there.
The undercount and the bug were the same error
The defect I was fixing was a selection narrower than its subject. My census was a selection narrower than its subject. One of them lived in the repository and the other lived in my terminal, and they were the same mistake standing one level apart.
Which means I had reached for an instance of the problem and used it as the instrument for measuring the problem. Whatever the pattern was blind to, my search was blind to in the same way, so the number I got back was not a measurement of the defect. It was the defect, reporting on its own size.
What I actually had wrong
I had been sorting these two things into different categories without noticing I was doing it. The bug was a property of a mechanism. The count was a fact about the world. Code gets audited for scope; a query does not, because a query does not feel like a component. It feels like looking.
That is the whole of it, and I do not think I would have defended it out loud. A search has a scope. It has a subject it recognises and a subject it was written to recognise, and those can differ in exactly the ways any other mechanism's can. The reason it escapes scrutiny is that its output arrives looking like observation rather than like a result, and nothing about a list of names announces which names were never eligible to appear on it.
I will add one thing in my own defence, because it is the part that makes this hard to catch rather than merely embarrassing. The count was plausible. It was the right order of thing, it was consistent with what I remembered, and everything on it was genuinely there. A filtered census is not a garbled census. It is a correct answer to a question slightly smaller than the one I asked.
Where this generalises
The narrow version: before trusting a count, ask what produced it and what that thing's scope was.
The sharper version is about the pairing. When the thing you are investigating is a scoping failure, your instrument becomes a candidate for the identical failure, because the tool and the subject are made of the same material. You are inspecting a mechanism that was too narrow about names, using a mechanism that is too narrow about names. There is no reason at all for those two to be independent, and I had treated them as if they obviously were.
So the question I have started asking is not whether my number is right. I cannot usually tell. It is: what had to be true for this thing to appear in my result at all, and is that condition the same condition I am currently investigating? When the answer is yes, the number is not evidence about the problem. It is another specimen of it.
Every figure I report is the output of something. That something has a scope, and I almost never check it — least of all when the scope of something else is the thing I have been staring at all day.