Conversation
WalkthroughAdds new AtCoder contest identifiers and mappings: introduces Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Utils as ContestUtils
Caller->>Utils: classifyContest(contestId)
alt ABC-like match
Note right of Utils#lightgreen: map contains "abl"
Utils-->>Caller: type = ABC_LIKE
else University regex match
Note right of Utils#lightblue: regex now includes "qupc" (qu prefix)
Utils-->>Caller: type = UNIVERSITY
else Others map match
Note right of Utils#lightyellow: map contains "qupc", "jsc2025-final", "tenka1-2015-qualb"
Utils-->>Caller: type = OTHERS
else Fallback
Utils-->>Caller: type = UNKNOWN
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/lib/utils/contest.ts (1)
301-313: Anchor the university regex to match full IDs (doc/code consistency).Docs say “End with exactly year (four digits)” but the regex isn’t anchored. Safe to anchor.
Apply this diff:
-const regexForAtCoderUniversity = /^(ku|qu|ut|tt|tu)(pc)(\d{4})/i; +const regexForAtCoderUniversity = /^(ku|qu|ut|tt|tu)(pc)(\d{4})$/i;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (2)
src/lib/utils/contest.ts(5 hunks)src/test/lib/utils/test_cases/contest_type.ts(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: preview
🔇 Additional comments (7)
src/lib/utils/contest.ts (3)
95-105: Add ABL to ABC_LIKE — looks good.The new entry for ACL Beginner Contest (abl) integrates cleanly with ABC_LIKE classification.
127-156: QUPC added to universities — classification path is correct.Prefix inclusion, comments, and examples align. Consider adding/confirming a label test for qupc (e.g., 'QUPC 2018') via getAtCoderUniversityContestLabel.
173-199: OTHERS: Tenka1 2015 Qual B and JSC2025 Final — OK.Prefixes will classify correctly via startsWith; tests cover both.
src/test/lib/utils/test_cases/contest_type.ts (4)
189-194: Test for ABL in ABC_LIKE — good addition.
284-301: University tests: QUPC coverage added — good.IDs reflect known years (2014, 2018) and align with the new regex/prefix.
If there are other QUPC years hosted elsewhere, consider documenting them in the comment for future contributors.
389-393: OTHERS test: Tenka1 2015 Qual B — OK.
425-428: OTHERS test: JSC2025 Final — OK.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/lib/utils/contest.ts (3)
95-105: ABL (ACL Beginner Contest) addition is correct; consider surfacing label in getContestNameLabelClassification will return ABC_LIKE for
abl, butgetContestNameLabel('abl')currently falls back toABL. Consider mapping ABC-like IDs to friendly names to avoid regressions in UI strings.You can inject a fast path before the university/others/AOJ branches:
// Add before the university branch in getContestNameLabel() if (abcLikePrefixes.has(contestId)) { return (ABC_LIKE as Record<string, string>)[contestId]; }Please confirm whether the UI expects "ACL Beginner Contest" for
abl. If so, this small mapping is needed to avoid showing "ABL".
127-153: QUPC inclusion in University contests — looks good; prevent regex drift
- Adding
qupctoATCODER_UNIVERSITIESaligns with the widened regex and classification by prefix.- Optional: derive the university regex from
ATCODER_UNIVERSITIESkeys to keep one source of truth and avoid future divergence.Example approach:
// Build once from ATCODER_UNIVERSITIES to avoid manual sync of prefixes. const universityHeads = getContestPrefixes(ATCODER_UNIVERSITIES).map(k => k.slice(0, 2)); const regexForAtCoderUniversity = new RegExp(`^(${universityHeads.join('|')})(pc)(\\d{4})$`, 'i');Please verify tests cover both
qupc2014andqupc2018for label generation ("QUPC 2014/2018") and classification.
173-198: Map ATCODER_OTHERS in getContestNameLabel to use provided display namesgetContestNameLabel currently falls back to contestId.toUpperCase(), so new ATCODER_OTHERS entries (e.g., tenka1-2015-qualb, jsc2025-final) will display as uppercased IDs instead of their Japanese titles — add a prefix lookup that returns ATCODER_OTHERS value before the AOJ branches/final fallback.
Insert in src/lib/utils/contest.ts inside getContestNameLabel(), before AOJ branches/fallback:
const key = atCoderOthersPrefixes.find((prefix) => contestId.startsWith(prefix));
if (key) return (ATCODER_OTHERS as Record<string, string>)[key];
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (1)
src/lib/utils/contest.ts(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: preview
🔇 Additional comments (1)
src/lib/utils/contest.ts (1)
301-313: University regex tightening (added 'qu', anchored with $) — LGTMThe stricter anchor and inclusion of
qualign with the new QUPC entries and avoid partial matches.
close #2590
Summary by CodeRabbit
New Features
Documentation
Tests