Conversation
Add Summer/Winter/Spring camp contest types to JAG_TRANSLATIONS and update the regex from `\d*$` to `\d*(-day\d+[A-Z]?)?$` so that contest IDs like JAGSummer2006-day2 and JAGSummer2012-day3A are correctly classified. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughJAG 合宿形式の contest_id(例: JAGSummer2024-day1A)を AOJ_JAG と判定できるよう正規表現を導入し、ラベル変換ルールと対応テストデータ・テストを追加・更新しました。 ChangesJAG camp contest support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/utils/contest.ts`:
- Line 104: The regex that detects JAG contest IDs wrongly allows missing year
because it uses \d*; update the pattern used where contest_id is tested (the
line with
/^JAG(Prelim|Regional|Summer|Winter|Spring)\d*(-day\d+[A-Z]?)?$/.exec(contest_id))
to require one or more digits for the year (change \d* to \d+ or a more specific
quantifier like \d{4}), so IDs like "JAGSummer-day2" no longer match.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: f07c2a10-35fc-4f62-a0cd-f58a286305aa
📒 Files selected for processing (6)
prisma/tasks.tssrc/lib/utils/contest.tssrc/test/lib/utils/contest.test.tssrc/test/lib/utils/test_cases/contest_name_and_task_index.tssrc/test/lib/utils/test_cases/contest_name_labels.tssrc/test/lib/utils/test_cases/contest_type.ts
Change `\d*` to `\d{4}` so that bare contest IDs without a year
(e.g. JAGPrelim, JAGSummer-day2) no longer match AOJ_JAG.
Add negative test cases to cover the boundary.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/utils/contest.ts`:
- Line 104: The JAG detection is inconsistent: classifyContest uses the strict
regex /^JAG(Prelim|Regional|Summer|Winter|Spring)\d{4}(-day\d+[A-Z]?)?$/ but
getContestNameLabel and isAojContest still use startsWith('JAG'), causing
mismatches (e.g., "JAGSummer-day2"). Update getContestNameLabel and isAojContest
to use the same regex-based check (or extract a shared isJagContest helper that
tests the strict regex) instead of startsWith so all three functions use the
same validation logic.
In `@src/test/lib/utils/contest.test.ts`:
- Around line 216-223: Add negative test cases for the same year-less JAG-like
inputs so the behavior is consistent across related functions: for each of
['JAGSummer-day2','JAGPrelim','JAGRegional'] assert that
classifyContest(contestId) is null AND that getContestNameLabel(contestId) does
not return a JAG-style label (e.g., returns null/undefined or a non-JAG string
per existing contract) and that addContestNameToTaskIndex does not add a JAG
entry for the same contestId; update the describe block to include tests calling
getContestNameLabel and addContestNameToTaskIndex (or inspect the index result)
to confirm they do not treat year-less inputs as JAG.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 10c11156-ef92-4e09-bff4-f0da71f9db4a
📒 Files selected for processing (2)
src/lib/utils/contest.tssrc/test/lib/utils/contest.test.ts
Extract the JAG regex into a named constant `regexForJag` and replace
loose `startsWith('JAG')` guards in getContestNameLabel and isAojContest
so that malformed IDs (no 4-digit year) are no longer treated as JAG.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
close #3580
Summary by CodeRabbit