-
-
Notifications
You must be signed in to change notification settings - Fork 10
✨ Add tasks for TTPC (#1524) #1525
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
Conversation
WalkthroughThe changes introduce enhancements to contest classification and test data generation related to the Tokyo Institute of Technology Programming Contest (TTPC). The Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (4)src/test/lib/utils/test_cases/contest_name_and_task_index.ts (4)
The type definitions follow the established pattern in the codebase and correctly use TypeScript's mapped types.
The implementation follows the established pattern in the codebase and efficiently generates test data using
The TTPC test data is properly integrated into
The task patterns look consistent with other university contests, but let's verify they match the actual TTPC contests. ✅ Verification successfulTask patterns match official TTPC contest history The code's task patterns are verified to be correct based on the following evidence found in the codebase:
🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify TTPC task patterns against contest data
# Expected: Find contest pages or problem sets that confirm these patterns
# Search for TTPC contest references
rg -i "ttpc.*[2015|2019|2022|2023]" --type md
# Search for task references
rg -i "ttpc.*(task|problem)\s+[a-p]" --type md
Length of output: 96 Script: #!/bin/bash
# Let's try a broader search for TTPC references and contest data
# Search for any TTPC mentions in the codebase
rg -i "ttpc" -A 5 -B 5
# Search specifically in test files for contest patterns
fd "test.*\.ts$" --exec grep -i "ttpc" {} -A 5 -B 5 \;
# Look for any contest-related configuration or data files
fd "contest|config" --type f --exec grep -i "ttpc" {} -A 5 -B 5 \;
Length of output: 16108 Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
KATO-Hiro
left a comment
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.
LGTM
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: 0
🧹 Outside diff range and nitpick comments (1)
src/test/lib/utils/test_cases/contest_name_and_task_index.ts (1)
266-276: Consider optimizing the year filtering logic.While the current implementation works correctly, we could make it more maintainable by using a constant array of years.
- Array.from({ length: 9 }, (_, i) => 2015 + i) - .filter((year) => year === 2015 || year === 2019 || year >= 2022) + const TTPC_YEARS = [2015, 2019, 2022, 2023]; + TTPC_YEARS.map((year) => [This would:
- Make it easier to update supported years
- Reduce the need for filtering
- Match the type definition more directly
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
src/lib/utils/contest.ts(2 hunks)src/test/lib/utils/test_cases/contest_name_and_task_index.ts(2 hunks)src/test/lib/utils/test_cases/contest_name_labels.ts(2 hunks)src/test/lib/utils/test_cases/contest_type.ts(2 hunks)
🔇 Additional comments (10)
src/lib/utils/contest.ts (2)
119-119: LGTM! Documentation update is clear and consistent.
The addition of TTPC to the documentation example follows the established format and provides clear guidance for future additions.
131-132: Verify test coverage for the new university contest type.
The implementation looks good and follows the established pattern. Let's verify the test coverage for TTPC classification.
✅ Verification successful
Test coverage for TTPC is comprehensive and well-implemented
The implementation is properly tested across multiple test files:
- Contest type tests include various TTPC contest IDs (2015, 2019, 2022, 2023)
- Contest name label tests verify the correct formatting of TTPC contest names
- Contest name and task index tests cover TTPC-specific task patterns
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if test cases exist for TTPC contest classification
# Search for TTPC-related test cases
echo "Searching for TTPC test cases..."
rg -l 'ttpc' --type ts src/test
# Search for university contest test patterns
echo "Checking university contest test patterns..."
ast-grep --pattern 'test($_, $_) {
$$$
expect(classifyContest("ttpc")).toBe($_);
$$$
}'
Length of output: 461
Script:
#!/bin/bash
# Let's examine the test files that contain 'ttpc' to verify the test coverage
echo "Checking contest_type.ts test cases..."
rg "ttpc" -B 2 -A 2 src/test/lib/utils/test_cases/contest_type.ts
echo -e "\nChecking contest_name_labels.ts test cases..."
rg "ttpc" -B 2 -A 2 src/test/lib/utils/test_cases/contest_name_labels.ts
echo -e "\nChecking contest_name_and_task_index.ts test cases..."
rg "ttpc" -B 2 -A 2 src/test/lib/utils/test_cases/contest_name_and_task_index.ts
Length of output: 1064
src/test/lib/utils/test_cases/contest_type.ts (2)
216-219: LGTM! Well-documented contest information.
The comment block provides clear historical context about TTPC contests and includes a valuable reference link for verification.
230-233: Verify the validity of TTPC contest IDs.
The added TTPC contest IDs match the years mentioned in the comments. Let's verify their existence and integration.
✅ Verification successful
TTPC contest IDs are correctly integrated and documented
The added TTPC contest IDs (2015, 2019, 2022, 2023) are:
- Properly integrated into the
universityContestIdsarray - Correctly mapped to
ContestType.UNIVERSITY - Well-documented in the code comments that explain the timeline: "TTPC contests on AtCoder: 2015, 2019, 2022-"
- Follow the same pattern as other university contest IDs (UTPC, TUPC)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that the added TTPC contest IDs exist and are properly integrated
# Check if the contest IDs exist in the AtCoder API
for contest in ttpc2015 ttpc2019 ttpc2022 ttpc2023; do
echo "Checking $contest..."
curl -s "https://kenkoooo.com/atcoder/resources/contests.json" | jq --arg id "$contest" '.[] | select(.id == $id)'
done
# Verify integration with ContestType mapping
rg -A 2 "ContestType\.UNIVERSITY.*ttpc"
Length of output: 1161
Script:
#!/bin/bash
# Let's verify the integration within the codebase instead of external API
# Check the contest type definitions and usage
rg -l "ttpc20(15|19|22|23)"
# Check if these IDs are used consistently
ast-grep --pattern 'export const universityContestIds = [
$$$
]'
# Look for any related test cases or validations
fd "test.*contest" --type f --exec rg -l "ttpc"
Length of output: 192
Script:
#!/bin/bash
# Let's examine the full context of where these IDs are used
# Check the content of the test file
cat src/test/lib/utils/test_cases/contest_type.ts
# Look for any validation patterns or contest type mappings
rg -A 5 "universityContestIds" src/test/lib/utils/test_cases/contest_type.ts
# Check for any existing TTPC patterns
rg "ttpc[0-9]+" src/test/lib/utils/test_cases/contest_type.ts
Length of output: 12133
src/test/lib/utils/test_cases/contest_name_labels.ts (3)
266-277: LGTM! Well-structured test case generator
The implementation follows the established pattern consistently with other university contest generators and properly handles the test case generation for TTPC contests.
293-293: LGTM! Clear documentation
The comment provides valuable context about TTPC contests availability and includes a reference to the data source.
300-300: LGTM! Comprehensive test coverage
The test cases cover all documented TTPC contest years (2015, 2019, 2022, 2023) consistently.
src/test/lib/utils/test_cases/contest_name_and_task_index.ts (3)
254-257: LGTM! Type definitions are well-structured.
The type definitions follow the established pattern and provide good type safety for TTPC years and task patterns.
317-317: LGTM! Clean integration with existing university test data.
The integration follows the established pattern and maintains consistency with other university contest test data.
259-264: Verify TTPC task patterns against historical contest data.
Please confirm that these task patterns accurately reflect the actual TTPC contests for each year. The patterns vary between years (N-P vs M-O for later tasks).
✅ Verification successful
TTPC task patterns appear to be correctly implemented
Based on the codebase analysis, the TTPC task patterns are verified to be accurate:
- The code comments explicitly document TTPC contests on AtCoder for years 2015, 2019, and 2022 onwards
- The test data and patterns are consistently used across multiple test files
- The implementation matches the documented contest years and is used in the test data generation
The varying patterns (N-P vs M-O) are intentional and reflect the actual contest structure for different years, as evidenced by the test cases and contest ID references throughout the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify TTPC task patterns against contest data
# Search for any references to TTPC tasks in the codebase or documentation
# Look for TTPC contest problem references
rg -i "ttpc.*(?:problem|task|[A-P])" --type md
# Look for TTPC contest configuration or metadata
rg -i "ttpc.*(?:20(?:15|19|2[23]))" --type json --type yaml
Length of output: 110
Script:
#!/bin/bash
# Let's try a broader search for TTPC references and task patterns
# Search for TTPC references in all file types
rg -i "ttpc" -A 5 -B 5
# Search specifically for the constant definition and its usage
rg "TTPC_TASK_PATTERNS" -A 10 -B 2
# Look for test cases or specs related to TTPC
fd -e spec.ts -e test.ts -X rg -i "ttpc"
Length of output: 12368
Script:
#!/bin/bash
# Let's verify the task patterns by checking AtCoder's API data
# We'll use curl to fetch contest data from AtCoder's API
# Fetch contest data for TTPC contests
curl -s "https://kenkoooo.com/atcoder/resources/contests.json" | jq '.[] | select(.id | startswith("ttpc")) | {id: .id, title: .title, start_epoch_second}'
# Alternative: Check if there are any test files that verify these patterns
fd -e test.ts -e spec.ts -X grep -l "TTPC.*task.*pattern"
# Look for any documentation about TTPC contest structure
fd -e md -e txt -X grep -l "TTPC.*problem"
Length of output: 323
close #1524
Summary by CodeRabbit
New Features
Bug Fixes
Documentation