fix: skip AI analysis on /approve cancel#1007
Conversation
The test oracle was triggered even when the approve label was being removed via /approve cancel. Only trigger AI analysis when approving, not when cancelling.
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
Review Summary by QodoSkip AI analysis on /approve cancel command
WalkthroughsDescription• Skip AI analysis when cancelling approval via /approve cancel • Add condition to check approval is not being removed • Add test case verifying test oracle not called on cancel Diagramflowchart LR
A["User runs /approve cancel"] --> B["label_by_user_comment called"]
B --> C{"Check: APPROVE_STR<br/>and not remove?"}
C -->|Yes| D["Call test oracle"]
C -->|No| E["Skip test oracle"]
File Changes1. webhook_server/libs/handlers/issue_comment_handler.py
|
Code Review by Qodo
1.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
WalkthroughTighten the /approve handling to avoid triggering the test oracle when the command is a cancellation (remove flag set) and add a test to ensure Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 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 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 |
|
/build-and-push-container |
|
New container for ghcr.io/myk-org/github-webhook-server:pr-1007 published |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@webhook_server/tests/test_issue_comment_handler.py`:
- Around line 1495-1511: The cancel-path test should also assert that no
background tasks are scheduled: patch asyncio.create_task (e.g. with
patch("asyncio.create_task", new_callable=AsyncMock) or patch.object(asyncio,
"create_task", new_callable=AsyncMock)) around the call to
issue_comment_handler.user_commands and then assert that the mocked create_task
was not called; keep the existing patches (create_comment_reaction,
labels_handler.label_by_user_comment, and call_test_oracle) and use the same
user_commands invocation (function user_commands in issue_comment_handler) but
add mock_create_task.assert_not_called() after the await.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
webhook_server/libs/handlers/issue_comment_handler.pywebhook_server/tests/test_issue_comment_handler.py
Strengthen cancel-path test by also patching asyncio.create_task and asserting it was not called.
|
/verified |
|
Successfully removed PR tag: ghcr.io/myk-org/github-webhook-server:pr-1007. |
|
New container for ghcr.io/myk-org/github-webhook-server:latest published |
Summary
/approve cancelCloses #1006
Changes
webhook_server/libs/handlers/issue_comment_handler.py— addand not removecheckwebhook_server/tests/test_issue_comment_handler.py— add test for cancel pathTest plan
Summary by CodeRabbit
Bug Fixes
Tests