#11: auto-prune stale snoozes on full-repo runs - #34
Merged
Conversation
deps) out of runner.ts into src/rule-files.ts. Pure relocation, no behaviour change; runner.ts was at the line cap and include/exclude matching is a distinct concern. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nq6xHU6JtSNpYWhMYjXB15
Move the keep/prune decision out of baselinePrune into reapBaseline (src/baseline/reap.ts), which returns both the kept entries and the pruned paths. Manual prune now reports the pruned count from it; the upcoming auto-prune reuses the same reaper. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nq6xHU6JtSNpYWhMYjXB15
On a full-repo run (run() now reports scopeMode), runWithAutoPrune does a baseline-free full scan and reaps entries whose file is present but no longer produces findings, printing the pruned set. A scoped run never mutates the baseline (a file can look clean only because its smell is outside the diff), so it is a guaranteed no-op. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nq6xHU6JtSNpYWhMYjXB15
…e rules as the main run Without this fix, autoPruneFullRepo always called run() without configPath, falling back to default config discovery. When a user passes --config <custom>, the re-scan could evaluate files under different rules than the main run — causing the pruner to wrongly keep or prune baseline entries depending on which config includes/excludes a given file. Adds a test: a custom config that excludes bad.ts from scope; without the fix the re-scan (default config, no exclusion) finds bad.ts violating and keeps the stale baseline entry; with the fix the re-scan uses the same custom config, respects the exclusion, and correctly prunes the entry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
devill
force-pushed
the
issue-11-auto-prune
branch
from
June 17, 2026 15:01
2932aa6 to
7022739
Compare
devill
marked this pull request as ready for review
June 17, 2026 15:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11.
When a baselined (snoozed) smell is actually fixed, its
.habit-hooks-baseline.jsonentry was left behind forever — toil that erodes trust in the baseline. This auto-prunes those dead entries on full-repo runs.Locked decisions
reapBaselineis shared by manualbaseline pruneand auto-prune.Design
run()stays a pure evaluator (it now reportsscopeMode). Auto-prune is a CLI-orchestrated side effect inrunWithAutoPrune: it runs only whenscopeMode === 'all', does a baseline-free full scan (so a sensor gated off by the baseline can't make a snoozed file look falsely clean), reaps via the shared reaper, saves, and appends a coaching line listing what was pruned.Atomic commits
#11: extract rule-file matching into its own module— pure move (buildMatcher/filterFilesForRule→src/rule-files.ts) to free room under the 200-line cap.#11: extract a shared baseline reaper—reapBaselinereturns kept entries + pruned paths; manual prune reuses it.#11: auto-prune fixed baseline entries on full-repo runs— the auto-prune module,scopeMode, CLI wiring, tests,DECISIONS.md.Tests
Real git repo + real eslint: full-repo prune of a now-clean file (with the report), scoped run no-op even when the file is clean and in-scope, and not over-pruning a still-violating file.
Note
A baseline-free scan that hits a sensor spawn failure could read a file as falsely clean (pre-existing in manual
baseline prunetoo). Once #25 lands, auto-prune can skip pruning when a sensor failed — a natural follow-up.Gates
pnpm build,pnpm lint— cleanpnpm test— 388 passed (+3)🤖 Generated with Claude Code
Generated by Claude Code