Repository navigation
Add opt-in beta historical game insights - #58
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
avatarneil
force-pushed
the
t3code/add-ridiculous-game-stats
branch
from
September 20, 2026 19:07
bb9e361 to
26e6875
Compare
avatarneil
force-pushed
the
t3code/add-ridiculous-game-stats
branch
from
September 20, 2026 19:07
26e6875 to
2c8ceae
Compare
Store historical team games with resumable nflverse imports and daily corrections. Generate verified comparisons across 20 metrics with live snapshots and inspectable receipts. Add an additive archive migration. Seed preview databases with stats:import and configure CRON_SECRET before enabling production imports.
avatarneil
force-pushed
the
t3code/add-ridiculous-game-stats
branch
from
September 20, 2026 23:14
3d8ed78 to
cfb08aa
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-in users can opt into Ridiculous stats (BETA) in the new Settings page. The preference defaults to off and follows the account across devices. Once enabled, game stats offer a “Generate ridiculous stat” button that finds real, unnecessarily specific historical comparisons without an LLM. It covers 20 team metrics across scoring, passing, rushing, turnovers, sacks, penalties, kicking, and punting, with every claim triggered by a measured total from the selected game. Football-context comparisons take priority, with first-since claims ahead of records and ties; pregame and unsupported cases show an honest empty state.
/settingspage and/api/settingsendpoint with an account-owned preference. Hide insights while signed out, opted out, or waiting for settings; preserve the saved preference if a change fails. Label both the setting and insight card BETA.Validation
Live-game coverage
Read explicit ESPN team totals for passing/rushing touchdowns, field goals, punts, and punt yards in addition to the main team box score. Missing totals remain unknown. First-since comparisons allow recent occurrences instead of requiring a three-season gap.
Replayed the same five saved live snapshots against the same archive: all five now produce supported comparisons, versus two previously. This compares identical game states, so live scoring changes do not affect the result.
Letter-count comparisons now appear at most once, after other supported results. All five saved snapshots still produce insights, with no letter-count comparisons leading. Generation took 15–33 ms in these snapshots. Added regression tests for same-season first-since claims, the five-game minimum, actual ESPN live totals, reordered columns, missing values, and pregame exclusion.
Preview verification and production setup
The PR preview is seeded and verified as of September 20, 2026. Its database is separate from production. Sign in and enable Settings → Ridiculous stats (BETA) to try the insights; the default remains off for everyone.
Loaded 28 seasons (1999–2026): 15,096 team-game rows across 7,548 games, including 14,548 completed team box scores. Scheduled games and missing measurements remain null.
Verified the deployed API returns real facts and complete supporting receipts. The sample Steelers–Dolphins game leads with a first-since claim tied to Pittsburgh’s 28 points in that game, with all intervening qualifying games in the receipts.
Verified generation, receipt display, pagination, and another-stat selection in Chromium against the deployed preview and real archive. The preview account-bracket count is unchanged.
Verified all five live games on the updated preview lead with football-context insights. Left a real Denver–Jacksonville insight and its receipts open through a box-score poll: no extra insight request, text replacement, or card-height change. Explicitly requesting another insight still fetches successfully.
Verified the deployed settings flow with two isolated temporary Clerk development accounts: default-off, keyboard-accessible opt-in, reload persistence, independent account preferences, real insight generation, BETA badges, opt-out denial, and private/no-store API responses. Invalid preference bodies and owner mismatches are rejected. No axe violations in the settings panel. Test users and preference rows were removed after verification.
The deployment migration creates
account_settingswith a false default; existing users remain opted out without a backfill.Remaining production setup:
CRON_SECRETof at least 32 characters in Vercel’s Production environment before deploying this change. The daily 10:00 UTC cron backfills missing seasons on its first run, then refreshes the latest two for corrections. Vercel cron does not run on previews.bun run stats:importwith its database environment. Otherwise the first scheduled cron populates it. The command is resumable;--dry-runvalidates without connecting to a database, and--from 2003 --to 2025explicitly refreshes older seasons.Preseason is outside the archive. The README documents source attribution, category definitions, import behavior, and operational setup.