feat(contests): complete Contests bug fix drive - #57
RsbhThakur wants to merge 31 commits into
Conversation
… team display names - Fix Redis activity log trimming to keep the latest 50 entries using lTrim(key, -50, -1) instead of truncating newest items - Add defensive JSON parsing with filter in SSE stream reconnection to prevent stream termination on corrupted log strings - Query User directly in cfSyncWorker for 1v1/solo display names with getDisplayName fallback and pizza badge formatting - Remove raw console.error calls in createRoomContestAction and createBracketContestAction per CONTRIBUTING.md - Fix React exhaustive-deps lint warning in ManageTeamModal - Add comprehensive end-to-end integration test suite covering room creation, Codeforces URLs, double elimination brackets, spectator controls, team codes, and activity log queues
… logging - Align CreateRoomModal client-side start time buffer check with casual 1v1 1-minute minimum buffer - Log Accepted verdict and specific Codeforces not-found verdicts in room activity feed - Add immediate error logging to activity feed when sync API call fails - Include type: 'sync.failed' and problemId in early cfSyncWorker rejections so events pass stream schema validation
… time quick-adds - Replace vertically stacked details dropdowns with tabbed ContestProblemWorkspace (Statement, Code Runner) in Blitz and Arena rooms - Add plain prop support to ContestProblemContent and ContestCodeRunner for embedded layout - Update start time quick-add minutes to [2, 3, 5, 10] for casual 1v1 and [deadlineMinutes + 2, ...] for tournaments to eliminate minute truncation false rejections
…and e2e test suite - Add problem card selection to ArenaRoomClient so competitors can switch the active problem in ContestProblemWorkspace - Replace hardcoded hex colors in ContestProblemContent.module.scss with CSS theme variables and add fallback notice with Codeforces link when statementHtml is missing - Expand contests-bugfix-drive-e2e.test.ts to 19 tests verifying start time buffer checks, room presentation utilities, and bracket math end-to-end
|
what is up with the Code Runner and problem statement, I just expected yall to provide a button to open the already implemented Code Runner, which already carries the problem part |
…capacity, and improve duration input UX
It was implemented by @Priyangshu-Mandal, so not much idea, but prompting up to an LLM it seems that the current implementation seems fine only. but tell if any changes are required: 1. Existing
|
…e window, and harden presentation utilities
- Sort activity feed entries by descending timestamp before rendering - Make toast notifications fully opaque to prevent text bleeding - Differentiate selected open problems from locked ones in the Arena grid - Add scrolling wrappers to Arena center stage to keep page layout fixed
…n fine-tuned mode, and restrict bulk problems to valid ratings
- Rename "Bracket (Knockout)" to "Bracket" across the UI (presets, wizard, create room modal). - Fix "Remove Preset" button overflow in PresetManager UI. - Correct spectator mode logic to align UI selection properly with backend values. - Refactor and organize internal tournament wizard components and routes. - Prevent redundant "Match Preset" selection when creating a Bracket room from a parent preset. - Fix backend validation error by defaulting un-preset brackets to "custom" presetId. - Fix Zod validation crash for bulk tournaments by stripping empty strings from fineTunedProblems. - Hide "Display Name" inputs when registering as a solo player in any format, seamlessly defaulting to CF handle. - Rearrange Bracket Settings layout to position Elimination Type and Seeding options before problem selection.
- Revert mock AC verdict in cfSyncWorker to restore original codeforces sync behavior - Add allback node prop to CompatibleImage for broken profile pictures (404 handling) - Render initials in BracketRoomClient when user profile avatars fail to load - Update getBracketSnapshot to prioritize oom.winnerTeamId when assigning match winners, accurately reflecting timeout/underdog rating tiebreakers on edges - Fetch and pass all user team IDs (currentUserTeamIds) in page.tsx so that users are correctly identified as participants in advanced rounds (e.g. Grand Final) and allowed to join the waiting room
- Add �racketSettings to ContestListingItem dto - Update ContestListingClient to display 'Double Elim Bracket' for double elimination formats - Update MatchHistoryClient tag to display 'Double Elim' appropriately
- **Presets**: Apply preset name and description if form fields are empty. Add `flex-wrap` and `flex-end` alignment to slot rows in `PresetManager`. - **Bracket**: Emit `contest.bracket_update` from `cfSyncWorker` and `reconciliationWorker` to ensure clients redraw bracket lines and node states on score updates and room completions. - **Tests**: Use valid 24-char hex ObjectIDs in session mocks and supply required `creatorId` and `isGlobal` fields to fix `ContestPreset` validation errors. Update preset assertions for members. Fix import and call for `createBracketContest` in e2e tests.
1499da7 to
54e6802
Compare
Resolves #33
Resolves #41
Resolves #42
Resolves #43
Resolves #44
Summary
This pull request unifies and lands the complete Contests Bug Fix Drive (Epic #33), integrating four interconnected sub-issues (#41, #42, #43, #44) that overhaul tournament brackets, submission integrity, problem statement rendering, spectator access, team management, and match activity feeds.
All commits and author attributions from the respective pull requests (PR #49, PR #52, PR #55, and PR #56) have been preserved in the git history to maintain full contributor credit.
🎯 Issue #33 Checklist Coverage
(deadline + 1)mfor tournaments; synced quick-add buttons and hint copy.1678B1->https://codeforces.com/contest/1678/problem/B1).room.activityevents for solves, critical reclaims, advances, and match endings, with backfilled history on reconnect."none","all","admin_creator","club_members"), server-sidecanSpectateauthorization, and disabled competitor interactions for viewers.pointsandtimeLimitMinutesper problem slot, overall match duration, and Redis worker synchronization.isHead()check on tournament and open contest creation, normalizing unprivileged requests to casual 1v1.Detailed Sub-Issue Breakdown
1. Tournament Bracket Progression, Creation Fixes & Security (Resolves #43 — PR #49 by @RsbhThakur)
isHeadauthorization for tournament and open contest creation, normalizing unprivileged attempts to casual 1v1 matches.(registrationDeadlineMinutes + 1)minutes for scheduled tournaments, updating quick-add buttons and modal hints dynamically.timeLimitMinutes) to problem slots and presets. Worker pipelines stampcurrentProblemStartTimein Redis on Blitz problem advances and preserve fine-tuned problem points.findOneAndUpdate), and non-blocking Redis key cleanup.All,Upper,Lower,Grand Final) and a dual-tree React Flow layout.2. Problem Engine, Submission Integrity & Code Runner (Resolves #41 — PR #52 by @Priyangshu-Mandal)
ContestSubmissionfor persistence and match result integrity.1678B1.3. Spectator Mode, Team Management UX & Match History (Resolves #44 — PR #55 by @DefineAditya)
spectatorRestrictiontoContestMatch("none","all","admin_creator","club_members") with server-sidecanSpectateaccess control, disabling competitor actions for spectators.ContestTeamRequest,ContestRegistrationTeam), and automatic leadership reassignment on leader departure (preventing ghost teams).actualStartTimeto display final placement rather than Round 1, fixes forfeit/tie scoring (1 pt for winner, -1 for forfeiter), and protects Redis room cache until all rooms finish.4. Persistent Forfeit Timers & Realtime Activity Feeds (Resolves #42 — PR #56 by @ronits2407)
room.activityevent logging across solves, critical reclaims, problem advances, and match endings, with backfilled activity history on reconnection.Technical & Architectural Integrity
jobId: disconnect-timeout-${roomId}-${userId}).Verification & Testing
pnpm typecheck(tsc --noEmit) passes with 0 errors.pnpm lint(eslint .) passes with 0 warnings/errors.tests/integration/contests-spectator.test.ts(6/6 passed)tests/integration/contest-presets.test.ts(7/7 passed)src/lib/api/schemas/contestAction.test.ts(6/6 passed)src/types/bracket.test.ts(14/14 passed)src/lib/contests/problemContent.test.ts(3/3 passed)src/components/contests/roomPresentation.test.ts(2/2 passed)tests/integration/blog-revisions-history.test.ts(27/27 passed)rs0) and Redis containers.Contributor Credits