Lab Note 001 · SportStrata

The bug that never threw an error

For weeks, a college football scoreboard showed about a quarter of the real games. Nothing failed, nothing logged, nobody was told. Here's how that happens in a well-built system, and the nightly monitor I built so it can't happen quietly again.

October 12, 2026 · Zohn Wheeler · ~6 min read

The symptom

SportStrata is a sports analytics site I build and run solo. Its college football scores page listed roughly 25 games on a Saturday. A real Saturday has up to 99.

The cause was one missing query parameter. ESPN's scoreboard endpoint needs groups=80 to return every FBS game. Without it, you get a smaller, ranked-leaning default set. The response is perfectly well-formed JSON with real games and real scores. It's just not all of them.

When I added the parameter and checked it against live data in a real browser, 99 events rendered, including 74 unranked-versus-unranked games that had been invisible: the ones nobody notices are missing until a fan of that team goes looking.

Why nothing caught it

It would be easy to call this carelessness. It's actually the predictable result of a good decision.

SportStrata sits on undocumented upstream APIs (ESPN, Sleeper, the MLB Stats API) reached through edge proxies. Those APIs change without notice, so every client parser is written to degrade gracefully: every field read carries a fallback.

const abbr   = home?.team?.abbreviation || '?';
const detail = status?.type?.shortDetail || '';

That's the right call for users. An upstream rename should show a ?, not a blank page or a stack trace. But it means an upstream change never throws, and neither does a request that quietly returns a subset. Unit tests pass, because the parser handles the data it's given correctly. Nothing logs an error, because nothing errored. Uptime is 100%.

Graceful degradation turns failures into wrong answers. If you build for it, you also have to build something that notices the wrong answers.

Two failure classes, one monitor

Looking back through the project's decision log, the data bugs fell into two classes:

  1. Upstream drift. A field the client reads gets renamed or removed, or the proxy starts receiving an HTML block page from a WAF instead of JSON. That last one had already happened once.
  2. Silent subsets. The response is valid but incomplete. The groups=80 bug is the canonical case, and no field-presence check can catch it. Every field is present; there just aren't enough rows.

So I designed an upstream contract monitor: a zero-dependency Node script that runs nightly in GitHub Actions against the production site, through the same /api/* proxies real users hit.

The honest limit, written down first

Most of this project's historical data bugs were the client misreading a stable API from day one. A contract that encodes what the code reads would have encoded those same wrong assumptions. The monitor only catches the subset class through count invariants, and it doesn't replace testing the rendered page. I put that at the top of the design doc so nobody (including me) would oversell what it does.

How a contract works

Each contract mirrors one real client call. It hits the same route with the same query params the client sends, because that's the only way a count check can catch a missing-param bug. It lists every field path the client's parser actually reads, taken from the parser source rather than from memory.

{
  id: 'nfl-scoreboard',
  route: d => `/api/nfl?path=/scoreboard&dates=${d.yyyymmdd}`,
  mirrors: 'js/nfl.js fetchNFLScoreboard',
  paths: [
    'events[].id',
    'events[].status.type.state',
    'events[].competitions[0].competitors[].team.abbreviation',
    'events[].competitions[0].competitors[].score',
  ],
  invariants: [ minCount('events', 8) ],
}

On top of the field paths sits a small invariant library:

InvariantCatches
isJson() (every route)HTML block pages, reported as "likely WAF block" instead of a confusing missing-field error
minCount(path, n)Silent subsets: the groups=80 class
exactCount(path, n)Incomplete standings (32 NFL teams, 30 MLB teams)
numeric(path)Scores and stats that stop parsing as numbers

The thresholds are deliberately loose floors, not expected values. The college football floor is 40 games on a full-slate Saturday: comfortably above the ~25 the bug produced, and comfortably below a real slate.

Season awareness without calendar code

Sports data is seasonal, and a monitor that alarms every offseason gets muted within a week. The obvious fix is to teach the script each sport's calendar. I'd already been burned by exactly that: a second copy of season logic that drifted from the first.

So the script owns no calendar. For each sport, it walks backward from yesterday, up to 10 days, until it finds a date with at least one final game. That's the probe date, and every date-dependent contract runs against it. Finals carry nearly every field the client reads, and past dates make the result independent of what time the job runs. If no final exists in 10 days, the sport reports SKIPPED — offseason instead of failing. If the scoreboard is unreachable on every date tried, that's a failure, not an offseason. "Reachable with no games" and "down" must never look the same.

The review that saved me from my own alarms

The first version passed against production. Then a whole-branch review went looking for predictable false alarms and found three, each confirmed against live data:

The same pass added a 20-second timeout on every request and isolated each sport so one crashing can't stop the others from reporting. An earlier review had caught that "completed game" meant more than "Final": rain-shortened and tied games use other states, so the check now uses MLB's coded game states instead of display strings.

Alerting that cleans up after itself

The script exits 0 for pass, 1 for warnings and 2 for failure. On a failure the workflow goes red, and it opens or updates one GitHub issue per failing route, labeled contract-drift, with the failing paths and the raw status and content type. When the route recovers, the issue closes itself. A broken contract (bad path syntax) exits 2 immediately: a broken monitor must never look like a passing one.

A full run makes about 25 sequential requests, well under the site's own 120-per-minute rate limit on the proxies it's testing.

What I'd tell another team

← All Lab Notes SportStrata on GitHub ↗ Hiring? Start here →