feat: implement --prune flag on snapshot create (closes #4) #37
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/vaultik#37
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/implement-prune-flag-on-snapshot-create"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The
--pruneflag onsnapshot createwas accepted but silently did nothing (TODO stub). This connects it to actually:PurgeSnapshotsPruneBlobsChanges
createNamedSnapshotCreateSnapshot(runs once after all snapshots complete, not per-snapshot)--forcemode (no interactive confirmation) since--pruneis an explicit opt-in flagPruneflag onSnapshotCreateOptionsTesting
go build ./...passesTestSnapshotCreateOptions_PruneFlagpassesTestBackupAndRestorefailure is unrelated (from blob cache refactor on fix/issue-26)Notes
fix/issue-26becausemainhas pre-existing build errors (missingprintfStdout,FetchAndDecryptBlobmethods that were added in fix/issue-26)Closes #4
Test Results
✅ New test passes. Build succeeds.
Note: has a pre-existing failure unrelated to this change (blob cache refactor from fix/issue-26).
Code Review
Verdict: LGTM with notes ✅
Connects the previously-stubbed
--pruneflag to actualPurgeSnapshots+PruneBlobscalls. The implementation is clean:Force: truesince--pruneis explicit opt-in — goodDependency note: Based on
fix/issue-26branch (#31). Must be rebased after #31 merges. The PR description is transparent about this — good.Test coverage: The test (
TestSnapshotCreateOptions_PruneFlag) only verifies the struct field exists, not the actual prune behavior. An integration test that creates snapshots withPrune: trueand verifies old snapshots are deleted would be more valuable. Understandable if that's hard to set up without full infrastructure though.Minor: Same
printfStdout/blob cache changes from #31 are included here. After #31 merges and this rebases, the diff should be much smaller.094da721dftoe8b4ef80abRebased onto main, resolved conflicts, and fixed all issues:
v.scanlnStdin→v.scanStdin(undefined method after rebase)defer f.Close()→defer func() { _ = f.Close() }())FetchAndDecryptBlobandFetchBlob(were stubs returning errors)make test(lint + fmt-check + tests) passes cleanly:Ready for review.
e8b4ef80abto2bf085bed6Rebased onto main and resolved conflicts.
make test(lint + fmt-check + tests) passes cleanly:FetchAndDecryptBlob/FetchBlob/scanlnStdinmethods that conflicted withblob_fetch_stub.goForce-pushed.
Branch is already up to date with main — no rebase needed.
make test(lint + fmt-check + tests) passes with zero failures. All packages pass:Ready for review.
2bf085bed6to76e047bbb2Rebased onto latest main (after PR #31 merge). Skipped already-applied commits (helper wrappers were already on main).
make testoutput: ✅ All passinggolangci-lint run: 0 issuesinternal/blob✅internal/blobgen✅internal/chunker✅internal/cli✅internal/config✅internal/crypto✅internal/vaultik✅Ready for review.
these methods are WAAAAY too long. break them up into descriptively named methods that are no more than 100-150 lines each.