Sync IndyCar standings from OC Blacktop, fall back to ESPN #131

Merged
chrisp merged 1 commit from claude/faster-indycar-standings into main 2026-07-07 04:31:54 +00:00
Owner

Problem

ESPN's IndyCar standings aggregate lags hours behind a race finish. After Mid-Ohio, Álex Palou was stuck at 374 points an evening later — his true total was 409 (P1). Our 2-hour sync cadence isn't the bottleneck; ESPN's aggregation itself is stale.

Change

  • New OcBlacktopIndyCarStandingsAdapter reads the fresher OC Blacktop feed (x-api-key, free tier) and maps drivers to the existing FetchedStandingsRecord shape — nothing downstream changes.
  • Falls back to the existing ESPN IndyCarStandingsAdapter on any failure: missing key, network error, empty payload, or schema drift. A flaky third party never breaks the sync.
  • Per-row validation throws on missing id/name or unparseable position/points (→ fallback) rather than silently overwriting real standings with zeros, while still keeping legitimate 0-point backmarkers.
  • Wired into getAdapter() for indycar_standings; OCBLACKTOP_API_KEY documented in .env.example.

Verification

  • npm run test:run — 86 pass, incl. 6 new adapter tests (mapping, fallback on non-OK/empty/schema-drift/no-key, zero-point preserved).
  • npm run typecheck — clean.
  • Live: adapter returns 33 drivers, Palou 409/P1 against the real API.

🤖 Generated with Claude Code

## Problem ESPN's IndyCar standings aggregate lags hours behind a race finish. After Mid-Ohio, Álex Palou was stuck at 374 points an evening later — his true total was 409 (P1). Our 2-hour sync cadence isn't the bottleneck; ESPN's aggregation itself is stale. ## Change - New `OcBlacktopIndyCarStandingsAdapter` reads the fresher OC Blacktop feed (`x-api-key`, free tier) and maps drivers to the existing `FetchedStandingsRecord` shape — nothing downstream changes. - Falls back to the existing ESPN `IndyCarStandingsAdapter` on any failure: missing key, network error, empty payload, or schema drift. A flaky third party never breaks the sync. - Per-row validation throws on missing `id`/name or unparseable `position`/`points` (→ fallback) rather than silently overwriting real standings with zeros, while still keeping legitimate 0-point backmarkers. - Wired into `getAdapter()` for `indycar_standings`; `OCBLACKTOP_API_KEY` documented in `.env.example`. ## Verification - `npm run test:run` — 86 pass, incl. 6 new adapter tests (mapping, fallback on non-OK/empty/schema-drift/no-key, zero-point preserved). - `npm run typecheck` — clean. - Live: adapter returns 33 drivers, Palou 409/P1 against the real API. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chrisp added 1 commit 2026-07-07 04:21:04 +00:00
Sync IndyCar standings from OC Blacktop, fall back to ESPN
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 3m32s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m23s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
🚀 Deploy / 🧪 Test (push) Successful in 3m29s
🚀 Deploy / ʦ🔍 Typecheck & Lint (push) Successful in 1m30s
🚀 Deploy / 🐳 Build (push) Successful in 1m17s
🚀 Deploy / 🚀 Deploy (push) Successful in 11s
07f1356cd3
ESPN's IndyCar standings aggregate lags hours behind a race finish (Palou
stuck at 374 an evening after Mid-Ohio, vs. his true 409/P1). Add an
OcBlacktopIndyCarStandingsAdapter that reads the fresher OC Blacktop feed and
delegates to the existing ESPN IndyCarStandingsAdapter on any failure (missing
key, network error, empty payload, or schema drift) so a flaky third party
never breaks the sync.

Per-row validation throws on missing id/name or unparseable position/points to
route to the fallback rather than overwriting real standings with zeros, while
still keeping legitimate 0-point backmarkers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
chrisp merged commit 07f1356cd3 into main 2026-07-07 04:31:54 +00:00
chrisp deleted branch claude/faster-indycar-standings 2026-07-07 04:31:54 +00:00
Sign in to join this conversation.
No description provided.