Skip to content

Add karva snapshot delete command and fix snapshot path filtering#455

Merged
MatthewMckee4 merged 1 commit intomainfrom
add-snapshot-prune-command
Feb 10, 2026
Merged

Add karva snapshot delete command and fix snapshot path filtering#455
MatthewMckee4 merged 1 commit intomainfrom
add-snapshot-prune-command

Conversation

@MatthewMckee4
Copy link
Member

Summary

  • Add new karva snapshot delete subcommand that deletes all snapshot files (.snap and .snap.new) with optional path filtering and --dry-run support
  • Fix path filtering across all snapshot commands by replacing unreliable string.contains() substring matching with absolute-path prefix matching using resolve_filter_paths() + str::starts_with()
  • Add find_all_snapshots() to karva_snapshot::storage for discovering both .snap and .snap.new files
  • Update run_review to accept resolved &[Utf8PathBuf] filters instead of raw &[String]

Test plan

  • 5 new integration tests for delete: all, dry-run, no-snapshots, path-filter, only-pending
  • Updated test_snapshot_prune_with_path_filter to use correct path prefix filter
  • All 550 tests pass (just test)
  • prek run -a passes (clippy, fmt, etc.)
  • CLI docs regenerated via cargo run -p karva_dev generate-all

🤖 Generated with Claude Code

Add a new `karva snapshot delete` subcommand that deletes all snapshot
files (.snap and .snap.new) with optional path filtering and --dry-run.

Fix path filtering across all snapshot commands (accept, reject, pending,
review, prune, delete) by replacing unreliable `string.contains()`
substring matching with absolute-path prefix matching. Filter paths are
now resolved to absolute paths via `resolve_filter_paths()` and compared
using `str::starts_with()`, preventing false matches on partial path
components.
@MatthewMckee4 MatthewMckee4 force-pushed the add-snapshot-prune-command branch from 5c6fa9d to bda943d Compare February 10, 2026 14:34
@MatthewMckee4 MatthewMckee4 added the snapshot-testing Related to snapshot testing label Feb 10, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 10, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 1 untouched benchmark


Comparing add-snapshot-prune-command (bda943d) with main (077f038)

Open in CodSpeed

@MatthewMckee4 MatthewMckee4 merged commit 3cbefa5 into main Feb 10, 2026
9 checks passed
@MatthewMckee4 MatthewMckee4 deleted the add-snapshot-prune-command branch February 10, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

snapshot-testing Related to snapshot testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant