fix(cherry-pick): prevent label duplication on merged PRs#902
Conversation
When cherry-picking to multiple branches on a merged PR, labels were being added N times (once per branch) inside the cherry-pick loop, resulting in N×N total label additions. Fixed by moving label addition outside the cherry-pick loop, ensuring labels are added exactly once per target branch. Also added: - Comprehensive test for multiple branches scenario - Docstring explaining why labels are added for both unmerged and merged PRs - Labels serve as audit trail for completed cherry-picks on merged PRs Test coverage: - test_process_cherry_pick_command_merged_pr_multiple_branches validates fix - All 5 cherry-pick tests passing
WalkthroughThe PR refactors cherry-pick label handling in the issue comment handler. Labels are now computed upfront from exit target branches and applied uniformly via a dedicated post-processing loop, regardless of PR merge status. A comprehensive docstring documents expected behavior for both unmerged and merged PR scenarios. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related issues
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (3)📓 Common learnings📚 Learning: 2024-10-29T10:42:50.163ZApplied to files:
📚 Learning: 2024-10-29T08:09:57.157ZApplied to files:
🧬 Code graph analysis (2)webhook_server/libs/handlers/issue_comment_handler.py (1)
webhook_server/tests/test_issue_comment_handler.py (1)
🔇 Additional comments (2)
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 |
|
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. |
|
/verified |
|
New container for ghcr.io/myk-org/github-webhook-server:latest published |
When cherry-picking to multiple branches on a merged PR, labels were being added N times (once per branch) inside the cherry-pick loop, resulting in N×N total label additions.
Fixed by moving label addition outside the cherry-pick loop, ensuring labels are added exactly once per target branch.
Also added:
Test coverage:
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests