← Statpro dev log

5,000 answers went stale overnight

#ai-agents#product#automation

Three rows of cards pass through a tall amber gate; most come out as empty dashed outlines and three come out lit

Five thousand answers came off Statpro's published question pages overnight, and none of them were wrong. They were old.

Statpro is a sports stats site. You type a question in plain English and it computes the answer from its stats database. Answers that hold up become permanent pages that search engines can index. There are thousands, so a page stays public only while its answer passes a gate: verified content, matching question intent, current data. A page that stops passing is withdrawn, which means pulled from the site and from search until it passes again.

The catch is that the verified record and the live answer are different rows. Each verified record stores a fingerprint of the answer's content. Edit an answer's content and the fingerprint changes, so the job that decides which pages stay public withdraws every verified answer of that kind as stale.

A re-certification loop, dry run first

The old recovery path was manual and couldn't re-certify a subset. So I built a job that selects withdrawn rows, evaluates each one against the live database, and appends a fresh verification record only for rows that still verify. Before I let it write anything, I ran it as a dry run. It selected 300 withdrawn rows and skipped every one.

Three rules made the full pass work, in the order I learned them:

  • A marker saying the answer came from the shared tables of games, players and teams is counted in the summary instead of required. Most stale rows don't carry one.
  • The question comparison checks the fields the question compiler uses to decide what is being asked, entity ids and the resolved season, and ignores surface wording.
  • Every renewal records the prior fingerprint, so an audit can see what changed.

The second rule is small enough to show whole:

# evaluate the question identity the compiler already trusts,
# not the wording a fresh parse happens to produce
def question_still_matches(stored, fresh):
    return (stored.entity_ids == fresh.entity_ids
            and stored.season == fresh.season)

What the numbers said

The full dry run measured the backlog. Of 5,000 withdrawn answers, 2,732 were skipped because the question parsed differently than it did at certification, and 1,050 because the answer no longer verifies. The summary prints only field names and failure categories, never question data, so the diagnostics can't leak what people asked.

Dry run first is the rule now

Two bugs in the selection logic would each have written bad renewals in a live run. The first run's only output was a report, so they cost me nothing. If a write can misfire across 5,000 rows, I want the version that prints numbers before the version that ships them.

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