fix(autofix): handle root directory pattern for safe sweep#272
Conversation
When a repo has Python files at the root directory, the safe sweep
pattern matching would fail because:
- find returns '.' as a directory
- clean_dir="${dir#./}" transforms '.' to empty string
- Pattern './**' or empty doesn't match paths like 'scripts/file.py'
This fix detects when clean_dir is empty or '.' and uses '**' pattern
which correctly matches all files at any depth.
Fixes #266
Automated Status SummaryHead SHA: 95dd54b
Coverage Overview
Coverage Trend
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
🤖 Keepalive Loop StatusPR #272 | Agent: Codex | Iteration 0/5 Current State
🔍 Failure Classification| Error type | infrastructure | |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the autofix safe sweep pattern matching that prevented autofix from pushing fixes when Python files exist at the repository root directory.
- Handles the edge case where
findreturns.for root directory Python files - Replaces empty/root directory patterns with
**to match all files at any depth - Prevents false rejections of legitimate file changes
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| clean_dir="${dir#./}" | ||
| if [[ -n "$clean_dir" ]]; then allowed_patterns+=("${clean_dir}/**"); fi | ||
| # Handle root directory: "." or empty becomes "**" to match all files | ||
| if [[ -z "$clean_dir" || "$clean_dir" == "." ]]; then |
There was a problem hiding this comment.
The condition checking for "$clean_dir" == "." is redundant. After the parameter expansion "${dir#./}", if dir is ., then clean_dir will be an empty string (not .). The #./ pattern removes the shortest match of ./ from the beginning, so . becomes empty. Therefore, checking [[ -z "$clean_dir" ]] alone is sufficient to catch this case.
| if [[ -z "$clean_dir" || "$clean_dir" == "." ]]; then | |
| if [[ -z "$clean_dir" ]]; then |
Automated Status Summary
Scope
Tasks
Acceptance criteria
Head SHA: 1c07da6
Latest Runs: ❔ in progress — Gate
Required: gate: ❔ in progress