feat(sweep): multi-pattern FILES, resume on interrupt, RESET=1#69
Conversation
- --files accepts comma-separated patterns (e.g. FILES="src/a.py,src/**/*.cs") - Tracks completed files in tmp/sweep-state.txt for resume after interruption - --reset / RESET=1 / RESTART=1 clears state and starts fresh - Backward compatible: FILE= still works as before - Closes #68
|
Warning Review limit reached
Next review available in: 54 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe deep sweep now accepts multiple file patterns, exclusion globs, and reset controls; persists completed files in ChangesDeep sweep selection and resumption
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Developer
participant Makefile
participant run-sweep.py
participant StateFile
participant SummaryFiles
Developer->>Makefile: invoke sweep with file, exclusion, or reset controls
Makefile->>run-sweep.py: pass selection and reset arguments
run-sweep.py->>StateFile: load completed paths
run-sweep.py->>run-sweep.py: filter and split candidates
run-sweep.py->>SummaryFiles: collect fresh and latest summaries
run-sweep.py->>StateFile: record completed files
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Coverage Report
Generated by pytest-cov on |
Greptile SummaryThis PR improves the deep sweep workflow. The main changes are:
Confidence Score: 4/5This should be fixed before merging.
tools/run-sweep.py Important Files Changed
Reviews (5): Last reviewed commit: "test(sweep): replace tautological tests ..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Makefile`:
- Around line 226-242: Do not modify the Makefile unless this PR explicitly
requires it; otherwise revert this change. If Makefile updates are authorized,
replace the shell parsing around FILES, FILE, RESET, and RESTART with native
Make conditionals and pass the comma-separated FILES value through the Python
script’s --files option, preserving reset handling without shell glob expansion.
In `@tools/run-sweep.py`:
- Around line 123-142: Move the state-management implementations from
load_completed, mark_done, and clear_state into an appropriate codecome package
module, then import and use those package symbols from the tools/run-sweep.py
wrapper. Keep the wrapper thin and preserve the existing state-file behavior,
including missing-file handling, directory creation, append semantics, and UTF-8
processing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a431d719-2caf-43f6-b508-d29d444e08ec
📒 Files selected for processing (4)
Makefiledocs/file-risk-sweeps.mdtests/test_run_sweep.pytools/run-sweep.py
There was a problem hiding this comment.
Pull request overview
This PR enhances the Phase 2 deep sweep runner workflow by adding multi-pattern file selection, resumable sweeps via a state file, and reset/restart controls, along with docs and tests to support the new CLI behavior.
Changes:
- Added
--files(comma-separated patterns),--reset, and sweep progress tracking viatmp/sweep-state.txtintools/run-sweep.py. - Updated
make sweepto supportFILES=...andRESET=1/RESTART=1, and documented the new usage indocs/file-risk-sweeps.md. - Added tests for the new state-file helpers and
--filessplitting.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tools/run-sweep.py | Adds state tracking + resume/skip logic, --files, and --reset, and extends aggregate summary inputs to include skipped files. |
| Makefile | Extends sweep target to accept comma-separated FILES and propagate reset/restart flags. |
| docs/file-risk-sweeps.md | Documents multi-pattern usage and resume/reset behavior. |
| tests/test_run_sweep.py | Adds unit tests for state-file lifecycle and basic --files splitting behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Replace shell IFS loop with native Make conditionals (CodeRabbit/Greptile fix) - Add --exclude for comma-separated glob patterns to exclude from sweep - EXCLUDE works with both file-based and index-based sweeps - Add summary-existence guard before mark_done() (Greptile fix) - Update docs and add tests
…ision RESET is already defined as an ANSI escape sequence in the Makefile, so $(if $(RESET),...) was always true. Use $(filter 1,$(RESET) $(RESTART)) like CODECOME_THINKING already does.
…scanned When a sweep was interrupted between the last per-file run and the aggregate rollup, restarting would exit early because all files were already marked completed. Now the aggregate rollup still runs using prior per-file summaries for the already-scanned files.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_run_sweep.py`:
- Around line 481-496: Replace the tautological tests in tests/test_run_sweep.py
lines 481-496 with tests that invoke run-sweep.py’s exposed CLI parser or main()
and assert its actual exclude parsing. In tests/test_run_sweep.py lines 498-524,
call the module’s file-exclusion filtering logic directly instead of duplicating
glob and loop behavior, removing the unused pat variable. In
tests/test_run_sweep.py lines 527-558, exercise the caller that conditionally
evaluates summaries before invoking mark_done(), covering both the evaluation
and non-processing paths rather than calling mark_done() directly or processing
no files.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7da84d92-93d1-4834-ad11-a41f095382c5
📒 Files selected for processing (4)
Makefiledocs/file-risk-sweeps.mdtests/test_run_sweep.pytools/run-sweep.py
🚧 Files skipped from review as they are similar to previous changes (3)
- docs/file-risk-sweeps.md
- Makefile
- tools/run-sweep.py
- TestSweepExclude now uses module.glob.glob with real files in tmp_path - TestSweepMarkDoneWithSummary simplified to test mark_done/load_completed directly - Removed tests that reimplemented logic (comma splitting, manual set matching)
Summary
Three usability improvements to the deep sweep runner (#68):
FILESMakefile variable — comma-separated patterns:make sweep FILES="src/a.py,src/**/*.cs"tmp/sweep-state.txt(one path per line, append-only). Restarting skips already-scanned files.RESET=1/RESTART=1— clears state and starts fresh.Backward compatible —
FILE=still works as before.Changes
tools/run-sweep.pySTATE_FILE,load_completed(),mark_done(),clear_state(),--files,--reset, resume/skip logicMakefilesweeptarget splitsFILESon,, passes--resetviaRESET/RESTARTdocs/file-risk-sweeps.mdFILES, resume,RESET=1tests/test_run_sweep.py--filessplitting, combined argsUsage
Summary by CodeRabbit
New Features
--excludeto filter out matching candidates, and--resetto clear saved progress.Documentation
FILESandEXCLUDE, plus resuming and forcing re-sweeps.Tests
--filesand--exclude, and completion handling.