feat: per-name purge filtering for snapshot purge #51

Merged
sneak merged 2 commits from feature/per-name-purge into main 2026-03-22 00:50:25 +01:00

2 Commits

Author SHA1 Message Date
clawbot
b939e016e3 refactor: remove backward compat wrapper and legacy snapshot support
All checks were successful
check / check (pull_request) Successful in 2m26s
- Remove PurgeSnapshots wrapper; callers use PurgeSnapshotsWithOptions directly
- Update snapshot create --prune to call PurgeSnapshotsWithOptions
- Remove TestSnapshotPurgeOptions (tested Go struct assignment, no value)
- Remove legacy no-name snapshot tests (TestPurgeKeepLatest_LegacyNoNameSnapshots,
  TestPurgeKeepLatest_MixedNamedAndLegacy)
- Remove legacy format test cases from TestParseSnapshotName
- Update parseSnapshotName doc to not mention legacy format
2026-03-21 16:48:14 -07:00
user
e3e1f1c2e2 feat: per-name purge filtering for snapshot purge
All checks were successful
check / check (pull_request) Successful in 4m28s
PurgeSnapshots now applies --keep-latest retention per snapshot name
instead of globally across all names. Previously, --keep-latest would
keep only the single most recent snapshot regardless of name, deleting
the latest snapshots of other names (e.g. keeping only the newest
'system' snapshot while deleting all 'home' snapshots).

Changes:
- Add parseSnapshotName() to extract snapshot name from snapshot IDs
- Add SnapshotPurgeOptions struct with Name field for --name filtering
- Add PurgeSnapshotsWithOptions() method accepting full options
- Modify --keep-latest to group snapshots by name and keep the latest
  per group (backward compatible: PurgeSnapshots() wrapper preserved)
- Add --name flag to both 'vaultik purge' and 'vaultik snapshot purge'
  CLI commands to filter purge operations to a specific snapshot name
- Add comprehensive tests for per-name purge behavior including:
  multi-name retention, name filtering, legacy/mixed format support,
  older-than with name filter, and edge cases

closes #9
2026-03-19 22:53:02 -07:00