claude/great-lovelace-r3bznh #88

Merged
chrisp merged 4 commits from claude/great-lovelace-r3bznh into main 2026-06-12 22:35:36 +00:00
Owner
No description provided.
chrisp added 3 commits 2026-06-12 22:09:40 +00:00
Adds sport-agnostic match data infrastructure:
- matchStatusEnum + season_matches + match_sub_games tables in schema
- externalSeasonId column on sports_seasons for API linkage
- Drizzle migration 0120_tidy_invaders.sql
- season-match model (upsert w/ onConflictDoUpdate, queries by event/season/stage)
- CS2 admin: Swiss rounds read-only section in cs2-setup + new manual swiss-matches route
- 7 unit tests for model (upsert conflict, null stage/round for non-CS2 sports, bulk, sub-games)
- Plan doc committed at docs/plans/match-sync-display.md for cross-session reference

https://claude.ai/code/session_01WUUM7uWzFoSkGcZRhnEKG6
Phase 2 — Match Sync Adapters + Cron Job:
- PandaScoreMatchSyncAdapter (CS2): fetches matches with map-level sub-games, stage detection
- EspnScheduleAdapter (MLB/NBA/MLS/WNBA/NHL): fetches scoreboard with live scores
- syncMatches() orchestrator: resolves participants by externalId+name, bulk-upserts season_matches, syncs playoff bracket results through existing setMatchWinner/processMatchResult pipeline
- POST /admin/jobs/sync-matches cron endpoint (mirrors sync-and-simulate pattern)
- External Season ID field added to sports season create/edit admin forms
- Sync from API button wired in CS2 setup page (enabled when externalSeasonId set)

Phase 3 — Public Tournament & Schedule Display:
- MatchSchedule component: generic match list with live/scheduled/complete status badges, matchday grouping
- Cs2TournamentBracket component: tab layout (Opening/Challengers/Legends/Champions Stage), map scores per match
- /sports-seasons/:sportsSeasonId/tournament public route with 30-second live polling

Phase 4 — Playoff Bracket Auto-Sync:
- externalMatchId column added to playoff_matches table (migration 0121)
- Bracket matches (matchStage=null) auto-synced: matches existing playoff_match rows by externalMatchId then participant IDs, calls full scoring pipeline
- autoCompleteRoundIfDone extracted to scoring-calculator.ts for shared use

All 2365 tests pass; typecheck clean.

https://claude.ai/code/session_01WUUM7uWzFoSkGcZRhnEKG6
fix: address 10 code review issues in match sync system
Some checks failed
🚀 Deploy / 🧪 Test (pull_request) Successful in 2m50s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Failing after 51s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
ac33e9e223
- Fix 1 (CRITICAL): CS2 "Sync from API" button was always 401 because it
  POSTed to /admin/jobs/sync-matches which requires a cron secret header
  that browsers can't send. Added sync-matches intent to cs2-setup action.

- Fix 2 (CRITICAL): loserAdvances was hardcoded false in match-sync/index.ts,
  breaking NBA Play-In scoring. Now calls doesLoserAdvance().

- Fix 3: ESPN score "0" was falsy → stored as null. Non-numeric strings
  like "F/OT" produced NaN. Added parseScore() helper.

- Fix 4: ESPN limit=1000 silently truncated MLB/NBA playoff games. Added
  seasonType param to EspnScheduleAdapter; all *_bracket types pass 3
  (postseason only).

- Fix 5: Cron job was syncing completed seasons unnecessarily. Added
  active status filter.

- Fix 6: hasLiveMatches triggered perpetual 30s polling for unseeded
  brackets. Added participant presence check.

- Fix 7: autoCompleteRoundIfDone was duplicated between bracket.server.ts
  and scoring-calculator.ts. Removed inline copy, imported shared version.

- Fix 8: MatchSchedule date grouping never ran for ESPN sports (no matchday
  field). Removed hasMatchdays gate, always call groupByMatchday with
  stable UTC date key.

- Fix 9: Silent failure when bracket matches exist but no scoring events.
  Added warning log.

- Fix 10: Added 3 tests — zero score preservation, NaN from non-numeric
  score, seasonType in URL.

https://claude.ai/code/session_01WUUM7uWzFoSkGcZRhnEKG6
chrisp added 1 commit 2026-06-12 22:30:05 +00:00
fix: resolve all oxlint errors from CI
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 2m46s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m29s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
0595eafe31
- Remove unused imports (findMatchSubGamesByMatchId, isNull, or, MatchRecord, STAGE_NAMES)
- Replace all != / == with !== / === throughout match-sync and components
- Remove all no-non-null-assertion violations: use Map get-or-initialize
  pattern, remove guarded assertions (playoffMatch.round), use 'as' cast
  for filter-then-map pattern
- Replace .sort() with .toSorted() in 5 locations
- Merge duplicate react-router import in tournament.tsx
- Remove unused LoaderData type alias in tournament.tsx
- Rename unused 'stage' param to '_stage' in Cs2TournamentBracket
- Use ?? [] in pandascore.test.ts to eliminate non-null assertions on subGames

https://claude.ai/code/session_01WUUM7uWzFoSkGcZRhnEKG6
chrisp merged commit f40144e1e2 into main 2026-06-12 22:35:36 +00:00
chrisp deleted branch claude/great-lovelace-r3bznh 2026-06-12 22:35:36 +00:00
chrisp referenced this pull request from a commit 2026-06-12 22:35:38 +00:00
Sign in to join this conversation.
No description provided.