feat: add direct-to-directory restore format (RFC 0006)#117
Merged
Conversation
f6cbd90 to
ae3cb6d
Compare
3bf8536 to
3c379de
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR adds step-1 support for restoring snapshots directly into a filesystem directory (cloudstic restore -format dir -output <directory>), while preserving the existing ZIP restore behavior and adding output-based format auto-detection.
Changes:
- Introduces a
RestoreWriterabstraction in the engine and implements both ZIP and filesystem writers. - Adds
Client.RestoreToDirand CLI-formathandling (explicitzip|dirplus auto-detection from-output). - Updates tests (unit + e2e), CLI usage text, completions, and user guide to cover the new restore mode.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/engine/restore.go | Refactors restore to use a writer abstraction; adds filesystem restore writer and path hardening helper. |
| internal/engine/restore_test.go | Updates existing tests for ZIP writer and adds coverage for directory restore + secure path handling. |
| client.go | Wraps existing restore in ZIP writer and adds RestoreToDir API. |
| cmd/cloudstic/client_iface.go | Extends CLI client interface with RestoreToDir. |
| cmd/cloudstic/cmd_restore.go | Adds -format flag, format resolution, and routes to dir restore when requested. |
| cmd/cloudstic/cmd_restore_test.go | Updates summary assertions and adds tests for restore format resolution. |
| cmd/cloudstic/stub_client_test.go | Extends stub client to satisfy new interface method for tests. |
| cmd/cloudstic/completion.go | Updates bash/zsh completions to include -format and -path for restore. |
| cmd/cloudstic/usage.go | Updates restore help text and examples for dir format. |
| docs/user-guide.md | Documents ZIP vs dir restore, auto-detection, and updated dry-run wording. |
| e2e/e2e_test.go | Adds end-to-end coverage for direct-to-directory restore and partial dir restore. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Addressed Copilot review feedback in commit 4bd4593.
Added/updated tests:
Validation run:
|
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.
Summary
cloudstic restore -format dir -output <directory>..zip-> zip, otherwise dir).RestoreManager.RunToDirand expose it viaClient.RestoreToDir.Scope notes
Testing
go test -count=1 ./internal/engine -run 'TestRestoreManager_Run|TestRestoreManager_RunToDir|TestRestoreManager_PathFilter'go test -count=1 ./cmd/cloudstic -run 'TestPrintRestoreSummary|TestResolveRestoreFormat|TestCompletionBash|TestCompletionZsh|TestCompletionFish'go test -count=1 ./...golangci-lint run ./...Refs #104