Repository navigation
Labels
Milestone
Description
Describe the bug
Code review of the branch cleanup automation feature (PR #1067) identified four critical safety issues in scripts/cleanup-branches.js:
- daysSince(): Returns
Infinityfor invalid/missing dates instead of 0. SinceInfinity < 30is false, branches with missing metadata get deleted instead of preserved. - isMerged(): Uses
String.includes()causing false positives (e.g.,origin/feat/foomatchesorigin/feat/foo-bar). - deleteLocalBranch(): Force-deletes with
-Dwhen normal delete fails, risking loss of unmerged work. - buildExcludeRegex(): No error handling for invalid regex patterns, causing script to crash.
To Reproduce
- Run cleanup-branches with a branch that has invalid/missing commit date
- Expected: branch preserved (missing data = unsafe to delete)
- Actual: branch deleted due to Infinity age logic
Expected behavior
All edge cases handled safely with sensible defaults:
- Invalid dates treated as recent
- Exact branch name matching (no substrings)
- Safe-fail on errors (no force operations)
- Graceful regex error handling
Additional Context
These issues were identified during Copilot code review. A fix commit (a55754e) addresses all four issues with enhanced test coverage (6 tests, all passing).
Related: #1067
Definition of Ready (DoR)
- Bug is reproducible and clearly described
- Steps to reproduce written
- Environment details provided
- Screenshots/logs included (if possible)
- Linked to existing issues/PRs (if any)
- Estimate added (if relevant)
- Ready for triage
Definition of Done (DoD)
- Bug confirmed and reproducible
- Fix implemented and tested (all supported browsers/devices)
- Follows WordPress coding standards
- Documentation updated (if needed)
- Changelog entry prepared for PR (CHANGELOG.md)
- QA performed
- Accessibility: no WCAG 2.2 AA regressions (semantic HTML, keyboard support, colour contrast)
- Security: no XSS, SQL injection, or other OWASP Top 10 vulnerabilities introduced
- Performance: no adverse impact introduced
- Linked issue closed
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
None yet
Activity
linear-code commentedon Jul 22, 2026
LS-1629
github-actions commentedon Jul 22, 2026
✅ Template check passed after update. Thanks for fixing the issue body.
jl3panadero-source commentedon Jul 22, 2026
Solucion Leonidas\n\n```\nBranch Cleanup Automation: Fixing Critical Safety Issues
===========================================================
Introduction
Branch cleanup automation is a crucial process in software development to maintain code quality, reduce technical debt, and improve overall system safety. In this response, we will outline a step-by-step approach to automate branch cleanup and address critical safety issues.
Prerequisites
Step 1: Identify Critical Safety Issues
Step 2: Automate Branch Cleanup
Step 3: Implement Safety Fixes
Example Script (Python)
Commit Message Guidelines
fix: [ brief description ]feat: [ brief description ]safety,security,performance) to facilitate search and filteringBest Practices
By following these steps and guidelines, you can automate branch cleanup and fix critical safety issues, ensuring a more maintainable and secure codebase.\n```
docs: add changelog entry for branch cleanup safety hardening
docs: add changelog entry for branch cleanup safety hardening
fix: improve branch cleanup safety and robustness (#1071)
1 remaining item
docs(projects): update v1.0 roadmap status — Phase 2A progress report
refactor(prd-factory-planner-agent): Phase 2A standardization — compl…
github-actions commentedon Sep 8, 2026
This issue has labels that are not in the canonical taxonomy:
migrate:priority:normalmigrate:type:bugmigrate:type:securityValid Canonical Labels
Please use labels with a prefix from the canonical taxonomy:
type:bug,type:feature,type:task,type:documentation, etc.status:needs-triage,status:in-progress,status:done, etc.priority:critical,priority:high,priority:normal,priority:lowarea:ci,area:docs,area:labels,area:security, etc.meta:needs-changelog,meta:duplicate,meta:blocked, etc.For the complete list, see .github/labels.yml.