Skip to content

feat(sweep): multi-pattern FILES, resume on interrupt, RESET=1#69

Merged
pruiz merged 5 commits into
masterfrom
feature/sweep-files-resume-reset
Jul 15, 2026
Merged

feat(sweep): multi-pattern FILES, resume on interrupt, RESET=1#69
pruiz merged 5 commits into
masterfrom
feature/sweep-files-resume-reset

Conversation

@pruiz

@pruiz pruiz commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

Three usability improvements to the deep sweep runner (#68):

  1. FILES Makefile variable — comma-separated patterns: make sweep FILES="src/a.py,src/**/*.cs"
  2. Resume on interrupt — completed files are tracked in tmp/sweep-state.txt (one path per line, append-only). Restarting skips already-scanned files.
  3. RESET=1 / RESTART=1 — clears state and starts fresh.

Backward compatible — FILE= still works as before.

Changes

File What
tools/run-sweep.py STATE_FILE, load_completed(), mark_done(), clear_state(), --files, --reset, resume/skip logic
Makefile sweep target splits FILES on ,, passes --reset via RESET/RESTART
docs/file-risk-sweeps.md Documented FILES, resume, RESET=1
tests/test_run_sweep.py 8 new tests: state file lifecycle, --files splitting, combined args

Usage

make sweep FILES="src/a.py,src/**/*.cs"       # multi-pattern
make sweep FILES="src/a.py,src/b.py" RESET=1  # force fresh
make sweep FILE="src/foo.*"                   # backward compat

Summary by CodeRabbit

  • New Features

    • Added support for selecting multiple specific files or comma-separated glob patterns in one sweep command.
    • Added sweep progress persistence to automatically skip already-completed files on reruns.
    • Added --exclude to filter out matching candidates, and --reset to clear saved progress.
    • Improved rollup behavior to use existing per-file summaries when applicable.
  • Documentation

    • Updated “Deep Sweep” instructions to document FILES and EXCLUDE, plus resuming and forcing re-sweeps.
  • Tests

    • Added unit coverage for sweep state persistence, CLI parsing for --files and --exclude, and completion handling.

- --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
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@pruiz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b5a4810c-755a-4517-91ab-df363c47f624

📥 Commits

Reviewing files that changed from the base of the PR and between e210a87 and f2cb0b2.

📒 Files selected for processing (1)
  • tests/test_run_sweep.py
📝 Walkthrough

Walkthrough

The deep sweep now accepts multiple file patterns, exclusion globs, and reset controls; persists completed files in tmp/sweep-state.txt; skips previously processed files; and updates aggregate summary handling, documentation, and tests.

Changes

Deep sweep selection and resumption

Layer / File(s) Summary
Sweep CLI and Makefile controls
Makefile, tools/run-sweep.py
Adds comma-separated FILES and EXCLUDE handling, retains FILE, and supports RESET or RESTART reset flags.
Persistent completion and aggregate processing
tools/run-sweep.py
Tracks completed paths, separates skipped candidates, records completion only when a current summary exists, and combines current and prior summaries for aggregate processing.
Documentation and behavior validation
docs/file-risk-sweeps.md, tests/test_run_sweep.py
Documents multi-file, exclusion, and resume workflows and tests state persistence, argument parsing, filtering, and summary-based completion.

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
Loading

Possibly related issues

Possibly related PRs

  • pruiz/CodeCome#59 — Both changes modify aggregate sweep rollup behavior and the per-file summaries supplied to it.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main sweep changes: FILES support, resuming after interruption, and RESET behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/sweep-files-resume-reset

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

Coverage Report

Metric Value
Line Coverage 76.9%
Lines Covered 0 / 0

Download detailed HTML coverage reports per OS/Python from the workflow artifacts.

Generated by pytest-cov on 2026-07-15T18:51:38.323Z

@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR improves the deep sweep workflow. The main changes are:

  • Add comma-separated FILES and EXCLUDE patterns.
  • Persist completed sweep paths for resume support.
  • Add RESET=1 and RESTART=1 to restart a sweep.
  • Document the new commands and add state-file tests.

Confidence Score: 4/5

This should be fixed before merging.

  • A sweep can publish a successful aggregate report after one selected file failed to produce its required summary.
  • The Makefile reset and argument handling changes preserve the documented command forms.

tools/run-sweep.py

Important Files Changed

Filename Overview
Makefile Passes FILES, FILE, EXCLUDE, and reset options to the sweep runner.
tools/run-sweep.py Adds file selection, exclusions, persisted completion state, reset handling, and resume rollups.
tests/test_run_sweep.py Adds coverage for state-file helpers and command-line argument splitting.
docs/file-risk-sweeps.md Documents multi-pattern sweeps, exclusions, resume behavior, and restart options.

Reviews (5): Last reviewed commit: "test(sweep): replace tautological tests ..." | Re-trigger Greptile

Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread tools/run-sweep.py Outdated
Comment thread tools/run-sweep.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3cb1b2a and c836204.

📒 Files selected for processing (4)
  • Makefile
  • docs/file-risk-sweeps.md
  • tests/test_run_sweep.py
  • tools/run-sweep.py

Comment thread Makefile Outdated
Comment thread tools/run-sweep.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 via tmp/sweep-state.txt in tools/run-sweep.py.
  • Updated make sweep to support FILES=... and RESET=1/RESTART=1, and documented the new usage in docs/file-risk-sweeps.md.
  • Added tests for the new state-file helpers and --files splitting.

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.

Comment thread tools/run-sweep.py
Comment thread Makefile Outdated
Comment thread tests/test_run_sweep.py
- 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
Comment thread Makefile Outdated
pruiz added 2 commits July 15, 2026 17:31
…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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between c836204 and e210a87.

📒 Files selected for processing (4)
  • Makefile
  • docs/file-risk-sweeps.md
  • tests/test_run_sweep.py
  • tools/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

Comment thread tests/test_run_sweep.py Outdated
- 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)
Comment thread tools/run-sweep.py
@pruiz
pruiz merged commit b02b843 into master Jul 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants