Skip to content

feat: add snapshot cleanup command for automatic snapshot expiration - #10

Merged
smithclay merged 4 commits into
mainfrom
claude/add-snapshot-cleanup-command-jYY55
Jan 18, 2026
Merged

feat: add snapshot cleanup command for automatic snapshot expiration#10
smithclay merged 4 commits into
mainfrom
claude/add-snapshot-cleanup-command-jYY55

Conversation

@smithclay

Copy link
Copy Markdown
Owner

This commit adds a new CLI command for managing and cleaning up old
snapshots based on configurable retention policies.

New features:

  • icepick snapshot list <table>: List all snapshots with age and refs
  • icepick snapshot cleanup <table>: Expire old snapshots based on policy
    • --older-than-days N: Minimum age before a snapshot can expire (default: 7)
    • --retain-last N: Minimum snapshots to always retain (default: 10)
    • --dry-run: Preview what would be removed without executing
    • Both conditions must be met before a snapshot is expired

Implementation details:

  • Added snapshot_cleanup module with planning and execution logic
  • Extended Catalog trait with expire_snapshots() method
  • Added RemoveSnapshots variant to REST API TableUpdate enum
  • Added snapshot CLI subcommand with list and cleanup operations
  • Snapshots referenced by branches/tags or marked as current are protected

claude and others added 4 commits January 18, 2026 04:46
This commit adds a new CLI command for managing and cleaning up old
snapshots based on configurable retention policies.

New features:
- `icepick snapshot list <table>`: List all snapshots with age and refs
- `icepick snapshot cleanup <table>`: Expire old snapshots based on policy
  - `--older-than-days N`: Minimum age before a snapshot can expire (default: 7)
  - `--retain-last N`: Minimum snapshots to always retain (default: 10)
  - `--dry-run`: Preview what would be removed without executing
  - Both conditions must be met before a snapshot is expired

Implementation details:
- Added `snapshot_cleanup` module with planning and execution logic
- Extended Catalog trait with `expire_snapshots()` method
- Added `RemoveSnapshots` variant to REST API TableUpdate enum
- Added `snapshot` CLI subcommand with `list` and `cleanup` operations
- Snapshots referenced by branches/tags or marked as current are protected
- Remove unused TableMetadata import
- Remove dead code in execute_snapshot_cleanup that built metadata but was never used
- Apply rustfmt formatting
- Remove unused `dry_run` field from CleanupOptions (CLI handles it)
- Remove unused `parent_snapshot_id` field from SnapshotInfo
- Remove unused `removal_count()` and `retention_count()` methods
- Extract `format_age()` helper to DRY age formatting logic
- Update tests to match simplified API
Document the new snapshot cleanup feature in AGENTS.md and README.md:
- CLI commands (snapshot list, snapshot cleanup) in quick start
- New public API items (plan_snapshot_cleanup, execute_snapshot_cleanup)
- Pattern 8 code example for snapshot cleanup workflow
- Performance profile and comparison matrix entries
- Full README section with Rust example and CLI usage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@smithclay
smithclay merged commit 2bf4e8f into main Jan 18, 2026
3 checks passed
@smithclay
smithclay deleted the claude/add-snapshot-cleanup-command-jYY55 branch January 18, 2026 18:54
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