US7: Event Discovery & Filtering#98
Conversation
- Add score fields (player1Score, player2Score) to BracketMatch type - Add tournamentWinner field to BracketResponse - Implement PUT /api/tournaments/:id/matches/:matchId/score endpoint - Add submitMatchScore function to store with validation - Update getTournamentBracket to include tournament winner - Add comprehensive test suite with 14 test cases covering: - Score submission and validation - Bracket advancement and winner determination - Real-time updates - Score history preservation - Edge cases (byes, completed matches) - All 73 tests passing
- Add Replay type to types.ts with all required fields - Create replay storage in store.ts with Maps for replays and replaysByTournament - Implement createReplay, getReplayById, getReplaysByTournament, validateReplayFileSize functions - Create src/routes/replays.ts with POST /api/replays and GET /api/replays/:id - Add GET /api/tournaments/:id/replays endpoint in tournaments.ts - Implement 2GB file size limit validation - Add authentication checks (organizer-only upload) - Ensure organizers can only upload to their own tournaments - Replays accessible publicly without authentication - Add comprehensive test suite with 14 tests covering all edge cases - All 96 tests passing
- Add searchReplays function to store.ts with filtering and pagination - Support filtering by game (case-insensitive), event_id, and player_name - Implement pagination with default page size of 20, max 100 - Return paginated results with metadata (total, page, pageSize, totalPages) - Results sorted in reverse-chronological order by default - Add GET /api/replays route to replays.ts - Handle edge cases for invalid pagination parameters - Performance tested for datasets up to 100 replays (< 500ms) - Add comprehensive test suite with 21 tests - All 117 tests passing
- Add startDate, venue, city optional fields to Tournament interface - Update createTournament to accept new location/date fields - Add searchEvents function to store.ts with filtering by game and city - Filter out past events by default (events with startDate < now) - Sort results by startDate ascending (soonest first) - Create EventResponse interface with entrantCount - Create src/routes/events.ts with GET /api/events endpoint - Add events router to app.ts - Performance optimized for large datasets (< 400ms) - Add comprehensive test suite with 17 tests - All 134 tests passing
Claude automated code reviewSummary This PR implements event discovery and filtering (US7) plus foundational support for replay upload/storage (US4), replay discovery/browsing (US5), and live score tracking (US3). It adds three new test files (event-discovery, replay-upload, replay-discovery), two new route files, and extends the store with replay and event search functionality. The PR also includes a 561-line automation architecture document that appears tangential to the core features. Risk assessment Medium. The replay and event search logic is sound, but the PR bundles unrelated features (US3–US5 plus an extensive automation doc) that should be separate PRs. This mixing complicates review, testing scope, and rollback. No blocking bugs, but the large diff and scope creep warrant caution. Findings
Test coverage
Overall: 40+ tests added, but they test four different features across one PR. Split into separate PRs for cleaner test isolation. Security
No security concerns identified. Suggested follow-ups
Advisory only — a human reviewer still approves the merge. Re-run with |
Implement User Story 7: Event Discovery & Filtering
This PR adds event discovery functionality for finding upcoming tournaments.
Key Features:
Technical Implementation:
Machine Acceptance Criteria Verified:
✓ GET /api/events returns upcoming events only
✓ Filtering by game parameter
✓ Filtering by city parameter
✓ Includes entrant count in response
✓ Case-insensitive filtering
✓ Excludes events with past start dates
Tests: 17/17 passing