-
-
Notifications
You must be signed in to change notification settings - Fork 376
core: fix contest ghost export #996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe changes modify the "ghost" scoreboard view in the contest handler. The status code for accepted submissions is updated from "AC" to "OK". The displayed total number of teams is increased by 100 to include phantom teams. When listing teams, the code now prefers the user's display name over their username if available, and team names are wrapped in double quotes. Additionally, 100 placeholder teams named "Пополнить команду" are appended to the team list, each assigned a unique team ID following the actual teams. No exported or public entity declarations were altered. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
packages/hydrooj/src/handler/contest.tsOops! Something went wrong! :( ESLint: 9.28.0 Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@hydrooj/eslint-config' imported from /eslint.config.mjs 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/hydrooj/src/handler/contest.ts
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: build
- GitHub Check: Analyze (javascript)
- GitHub Check: build
🔇 Additional comments (1)
packages/hydrooj/src/handler/contest.ts (1)
788-794
: Changing “AC” → “OK” may break downstream importersMost parsers that consume the “.ghost” format still expect the traditional verdict code
AC
for an accepted run (cf. PC² / Kattis export specs).
Silently switching toOK
risks:
- Existing tools suddenly treating all accepted submissions as unknown → scores become zero.
- In-house analytics that use string equality on
"AC"
breaking without compile-time notice.Please double-check that every downstream consumer understands
OK
before merging. If in doubt, keepAC
or add a compatibility flag.
Array(100).fill(0).map((_, idx) => `@t ${tdoc.attend + idx + 1},0,1,"Пополнить команду"`), | ||
submissions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Hard-coded 100 “Пополнить команду” placeholders – fragile & untranslated
- The magic number
100
is repeated here and in@teams
. Extract it into a constant to avoid divergence. - The Russian label is baked in; non-Russian installations will get unexpected Cyrillic text. Consider passing it through the i18n layer.
- The placeholder string isn’t passed through
escape
, so any future commas/quotes introduced by translation will corrupt the CSV line.
🤖 Prompt for AI Agents
In packages/hydrooj/src/handler/contest.ts around lines 817 to 818, replace the
hard-coded number 100 with a named constant shared with the @teams usage to
avoid divergence. Pass the "Пополнить команду" label through the i18n
translation function to support localization. Also, ensure the translated string
is properly escaped using the existing escape function before inserting it into
the CSV line to prevent corruption from commas or quotes.
`@teams ${tdoc.attend + 100}`, | ||
`@submissions ${submissions.length}`, | ||
].concat( | ||
tdoc.pids.map((i, idx) => `@p ${pid(idx)},${escape(pdict[i]?.title || 'Unknown Problem')},20,0`), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible team-count mismatch
@teams
is now derived from tdoc.attend + 100
, while the real list length is teams.length
and may differ from tdoc.attend
(e.g. spectators, unranked users, withdrawn teams).
If these numbers diverge, many scoreboards will reject the file with “wrong team count”.
Consider:
-`@teams ${tdoc.attend + 100}`
+`@teams ${teams.length + 100}`
or assert that tdoc.attend === teams.length
before emitting.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
`@teams ${tdoc.attend + 100}`, | |
`@submissions ${submissions.length}`, | |
].concat( | |
tdoc.pids.map((i, idx) => `@p ${pid(idx)},${escape(pdict[i]?.title || 'Unknown Problem')},20,0`), | |
`@teams ${teams.length + 100}`, | |
`@submissions ${submissions.length}`, | |
].concat( | |
tdoc.pids.map((i, idx) => `@p ${pid(idx)},${escape(pdict[i]?.title || 'Unknown Problem')},20,0`), |
🤖 Prompt for AI Agents
In packages/hydrooj/src/handler/contest.ts around lines 809 to 812, the @teams
count is set using tdoc.attend + 100, which may not match the actual
teams.length due to spectators or withdrawn teams, causing scoreboard
rejections. Fix this by replacing tdoc.attend + 100 with the accurate
teams.length value or add an assertion to ensure tdoc.attend equals teams.length
before emitting the data.
Summary by CodeRabbit