I didn't find this one through an incident. I found it by graphing a team knowledge base. One cluster held about ten write-ups from completely different parts of the product, and the only thing they had in common was how they failed: something got verified, the verification passed, and the bug was still there. Every time, the check shared something with the thing it was checking.
What a check can share
A check inherits the blind spots of whatever it's testing when it shares any of these:
- State. The same machine, the same timezone, the same cached login, the same
.env. - A code path. The same query, serializer or helper that holds the bug.
- Authority. A role that's allowed to do everything, so every permission check comes back true.
- A data source. SQL checking SQL, one report checking another built from the same tables.
If it shares one of those, a green result tells you nothing. That's worse than no check at all, because it makes you confident.
- the same machine or timezone
- the same query or helper
- a role that can do everything
- the same tables or report
Passes whether the bug is there or not
- runs in production's environment
- reads where the user looks
- uses the least-privileged role
- compares against another source
Can actually go red
What it looks like
Some shapes I've seen it take:
- Date code that works on your laptop because your laptop is in the right timezone. Production runs in UTC, and the bug only shows up there.
- Permission tests that only run as the super admin. Rename a permission and the tests still pass, because that role can do anything.
- Checking money totals in the database when the bug is in the PDF the customer gets. The database will always agree with itself.
- An upload that returns success while the service meant to pick the file up has quietly died.
- A nightly job that finishes "successfully" while producing nothing for some of the records it should have covered.
- Two systems that hold the same number, disagree for weeks, and never notice, because neither one reads the other.
In the end, a person usually caught these by comparing against something independent: the vendor's own portal, the real invoice, a report review.
What I do now
For anything involving money, permissions or reported numbers, I name the independent check before shipping and write it down next to the code.
- Ask what the check shares with the thing it checks. If it shares nothing, it's a real check. If it shares something, keep it as a smoke test, but don't trust it.
- Check where the user looks. The rendered PDF, not the row. The file in the destination bucket, not the upload's exit code.
- Test as the least-privileged role that matters, with at least one assertion that depends on an explicit grant.
- Copy production's environment locally. Set
TZ=UTCin every.envif production runs in UTC, and do the same for anything else production pins. - When two systems hold the same number, compare them on a schedule.
- Treat silence as a failure until proven otherwise. Assert the count you expect, not just that nothing errored.
Before trusting a green check, I ask what would have made it red. If I can't think of a realistic answer, it isn't checking anything.