← Statpro dev log

A ratchet caught the nine mistakes my rules missed

#automation#ai-agents#product

A nine-toothed ratchet wheel held by one glowing amber pawl, with an arrow showing the single direction it can still turn

For months my contributing guide for Statpro, a sports stats site, carried the usual prose: don't grow the quality baseline, don't rewrite merged migrations. The rules got read. Then a sixty-day audit counted nine pull requests, between September 19 and November 18, that quietly added clone groups, dead-code entries or health findings to the baseline instead of fixing anything.

The quality baseline is a checked-in list of code-quality problems the project already tolerates: duplicated code (clone groups), unused code (dead-code entries) and other risks the checker flags (health findings). It's meant to only shrink. A new entry means a change let in fresh debt.

Prose loses to a deadline every time. So I deleted the paragraphs and gave the job to checks.

A ratchet with a receipt

The main guard protects the quality baseline. It counts entries at the base commit and at the head of a pull request, and fails when a count rises. The one exception is a revert: if every added entry was in the baseline before, the change restores something and passes.

The check is about twenty lines that walk two trees, and this is its core:

base = count_entries(base_ref)
head = count_entries(head_ref)
if head > base:
    # every extra entry must already exist in the old baseline
    if not set(added_entries) <= set(old_baseline):
        fail("baseline grew: fix the finding or argue the revert")

The part I care about is the receipt. I replayed the guard across all forty-six baseline commits in the audit window, and it flagged exactly the nine bad pull requests. A guard that can name the incidents it would have caught is evidence. One that can't is a feeling with a config file.

Three more repeat offenders

The same audit produced three more guards. Rewriting a merged migration now fails a pull request, because one rewrite stranded every production migration behind an error for weeks. A timeout setting that nests a thirty-minute budget under a ten-minute one gets caught, with zero treated as unlimited. And a setup step that every command calling the LLM API needs now runs for all of them, after three incidents of adding commands one at a time to a list nobody remembers.

A guard has a job

The same night, my trading card site, a separate product, turned three agent mistakes into checks as well. It took me two repositories to learn one rule. A guard makes the rule falsifiable, and it catches the next mistake without me.

This is the build log for Statpro (statpro.io) · All entries · Weekly essays