test(skills): add error handling tests for Get-PR* scripts#1276
Conversation
Adds 42 new tests covering previously untested code paths across get_pr_checks.py, get_pr_reviewers.py, and get_pr_review_threads.py. Coverage gaps addressed: - API error exits (code 3) for all three scripts - GraphQL response edge cases (null PR, empty commits, no rollup) - StatusContext pending/failing/error states - CheckRun conclusion variants (CANCELLED, NEUTRAL, SKIPPED) - Timeout handling with --wait flag (exit code 7) - JSON output format stderr suppression on timeout - Missing user/author field handling in reviewer comments - Bot detection via [bot] suffix and type field - Reviewer sorting by comment count - Thread transform with no comments and missing authors - Missing pullRequest in GraphQL response Fixes #576 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
PR Validation ReportCaution ❌ Status: FAIL Description Validation
QA Validation
|
There was a problem hiding this comment.
Code Review
The pull request introduces a comprehensive set of new tests for error handling and edge cases across get_pr_checks.py, get_pr_reviewers.py, and get_pr_review_threads.py. This significantly improves the robustness and reliability of these scripts by covering scenarios like API errors, missing data in GraphQL responses, timeout handling, and various data transformation edge cases. The added tests demonstrate a thorough approach to ensuring the quality of the Get-PR* skill scripts.
AI Quality Gate ReviewWarning WalkthroughThis PR was reviewed by six AI agents in parallel, analyzing different aspects of the changes:
Review Summary
💡 Quick Access: Click on individual agent jobs (e.g., "🔒 security Review", "🧪 qa Review") in the workflow run to see detailed findings and step summaries. Security Review DetailsVERDICT: CRITICAL_FAIL QA Review DetailsVERDICT: CRITICAL_FAIL Analyst Review DetailsVERDICT: CRITICAL_FAIL Architect Review DetailsVERDICT: CRITICAL_FAIL DevOps Review DetailsVERDICT: CRITICAL_FAIL Roadmap Review DetailsVERDICT: CRITICAL_FAIL Run Details
Powered by AI Quality Gate workflow |
📝 WalkthroughWalkthroughThree test files receive new test coverage for PR-related scripts. Tests address API errors, missing/malformed GraphQL responses, timeout behavior, edge cases in data transformation, bot detection, sorting logic, and output formatting across get_pr_checks, get_pr_review_threads, and get_pr_reviewers. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/test_get_pr_reviewers.py (1)
43-44: Duplicate helper:_completedexists in test_get_pr_review_threads.py too.Consider extracting to a shared test utilities module if more test files need it. Low priority since it's 2 lines.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/test_get_pr_reviewers.py` around lines 43 - 44, The helper function _completed defined in tests/test_get_pr_reviewers.py is duplicated in tests/test_get_pr_review_threads.py; extract this small utility into a shared test utilities module (e.g., tests/utils.py or tests/helpers.py) containing the _completed function, update both test modules to import _completed from that shared module (replace the local definitions in test_get_pr_reviewers.py and test_get_pr_review_threads.py), and remove the duplicate definitions so both tests import and use the single shared _completed helper.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/test_get_pr_reviewers.py`:
- Around line 43-44: The helper function _completed defined in
tests/test_get_pr_reviewers.py is duplicated in
tests/test_get_pr_review_threads.py; extract this small utility into a shared
test utilities module (e.g., tests/utils.py or tests/helpers.py) containing the
_completed function, update both test modules to import _completed from that
shared module (replace the local definitions in test_get_pr_reviewers.py and
test_get_pr_review_threads.py), and remove the duplicate definitions so both
tests import and use the single shared _completed helper.
Pull Request
Summary
Adds 42 new tests covering previously untested error handling and edge case paths across three Get-PR* test files.
Specification References
Changes
Type of Change
Testing
Agent Review
Security Review
Other Agent Reviews
Checklist
Related Issues
Fixes #576