Repository navigation
feat: round-recap script + fix stuck-LIVE knockout poller gap - #141
Merged
Merged
Conversation
added 2 commits
July 12, 2026 10:54
Generalizes scripts/r32-recap.ts to any knockout round (R32/R16/QF/SF/FINAL, default QF) and folds in the standings block from scripts/challenge-progress.ts, so one run prints that round's scorelines, the next round's now-set matchups, and Knockout Challenge standings/progress. Read-only ops helper for drafting the per-round update email; reused for the remaining rounds (QF tonight, then SF, Final). Run: DATABASE_URL=... npx tsx scripts/round-recap.ts [ROUND]
The score poller's shouldPollNow() only fetched when a match's scheduledAt fell within [now-155min, now+5min]. A knockout match whose full-time result lands after that window closes (extra time + shootout, long stoppages, or a lagging FT status from the feed) was stranded LIVE forever: the window closed before the finalizing poll ever ran, so the FINAL status was never fetched. Observed live — QF match 100 froze at its last in-play snapshot (2-1, LIVE) when its window closed ~2h35m after kickoff, and every poll since returned skipped:"no match in live window". Add a backstop: keep polling any scored match (bronze 103 excluded — never finalized via the API) that has kicked off but isn't FINAL yet, for a generous grace period after kickoff. Self-terminating once the match flips to FINAL.
dommango
marked this pull request as ready for review
July 12, 2026 17:08
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.
Two related changes that came out of prepping the post-quarterfinals update email.
1.
scripts/round-recap.ts— generalized recap for the update emailRead-only ops helper for drafting the per-round Knockout Challenge update email. Generalizes
scripts/r32-recap.tsto any knockout round and folds in the standings block fromscripts/challenge-progress.ts, so one run prints all three sections:Match/Result,⚡ PENALTIESflag; skips non-FINAL.resolveBracket(officialResults).Additive; existing
r32-recap.ts/challenge-progress.tsuntouched. Reused for SF + Final.2.
lib/sports/poll.ts— fix knockout matches stranded LIVE past their windowshouldPollNow()only polled when a match'sscheduledAtwas within[now-155min, now+5min]. A knockout match whose full-time result lands after that window closes (extra time + shootout, long stoppages, or a lagging FT status) was strandedLIVEforever — the window closed before the finalizing poll ran, soFINALwas never fetched.Observed live: QF match 100 froze at its in-play snapshot (2-1,
LIVE) when its window closed ~2h35m after kickoff; every poll since returnedskipped: "no match in live window", so scores + SF seeding stalled for ~13h.Fix: add a backstop — keep polling any scored match (bronze 103 excluded; never finalized via the API) that has kicked off but isn't
FINALyet, for a generous grace period after kickoff. Self-terminating once it flips toFINAL.Verification
npm run typecheckclean for changed files;npx vitest run lib/sports lib/pool→ 416 passed.round-recap.ts QFagainst prod: all four QF final, SF = France v Spain / England v Argentina, standings recomputed (avg 22.9 → 25.9 after QF points applied).🤖 Generated with Claude Code