US4: Replay Upload & Storage#96
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
Claude automated code reviewSummary This PR implements US4 (Replay Upload & Storage) with endpoints for uploading replays with metadata, retrieving replays by ID, and listing tournament replays. It adds comprehensive test coverage (14 tests) plus a large new automation documentation file (561 lines). The implementation includes 2GB file-size validation and organizer-only authorization. However, the diff is truncated and the automation document appears unrelated to US4's core functionality. Risk assessment Medium — The replay upload logic is straightforward and well-tested, but the PR introduces an unrelated 561-line automation architecture document that should be split into a separate PR, and score-tracking tests appear to test US3 features (not US4). Findings
Test coverage 14 replay-specific tests are well-written and cover: upload with metadata (201), organizer-only access (403), file-size limits (413), missing fields (400), tournament existence (404), organizer ownership (403), retrieval by ID, public access, listing by tournament, metadata preservation, and timestamp validation. However, Security
No security concerns identified. Suggested follow-ups
Advisory only — a human reviewer still approves the merge. Re-run with |
Implement User Story 4: Replay Upload & Storage
This PR adds replay upload and storage functionality for tournament organizers.
Key Features:
Technical Implementation:
Machine Acceptance Criteria Verified:
✓ POST /api/replays creates a replay and returns HTTP 201
✓ GET /api/replays/:id returns replay metadata
✓ 2GB file size limit enforced with 413 status
✓ Organizer-only access with proper authentication
Tests: 14/14 passing