feat(#61): confirm before restore overwrites or deletes files - #92
Merged
Conversation
|
@vsolano9 is attempting to deploy a commit to the Kavindu's projects Team on Vercel. A member of the Team first needs to authorize it. |
kavix
force-pushed
the
main
branch
2 times, most recently
from
August 8, 2026 18:16
78d1ab8 to
0225134
Compare
eko restore deleted every non-ignored top-level entry with no confirmation, so running it with unsaved work permanently discarded that work even when the snapshot id was the intended one. restore now lists exactly what it will delete and requires an explicit y. Anything else, including a bare Enter and EOF, cancels without touching disk. --yes/-y skips the prompt for scripting. When stdin is not a terminal and --yes was not passed, restore fails instead of guessing: assuming yes would delete a script's working directory that never opted in, and blocking on a read would hang CI until it times out. The prompt's list comes from snapshot.PendingRemovals, which RestoreSnapshot also uses to build its delete list, so what the user is shown and what is deleted cannot drift apart.
vsolano9
force-pushed
the
fix/61-restore-confirmation
branch
from
August 9, 2026 05:31
6cc7bc1 to
383dd95
Compare
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.
Closes #61.
eko restorecould overwrite modified files and remove files absent from the selected snapshot without confirmation. That made a correct snapshot ID insufficient protection against losing unsaved work.Behavior
y/yes.--yes/-yis the explicit non-interactive path.--yesreturns an error instead of guessing or hanging./dev/nullsafely reaches EOF and cancels.The branch is rebased onto the current content-addressed snapshot implementation (
93a5041).snapshot.PendingRestoreChangesand the restore path share the same workspace scan and content comparison, so the preview follows the same manifest/hash decisions used to restore. Legacy snapshots retain their existing top-level removal preview.Validation
go test ./...go vet ./...go build ./...git diff --checkThe restore tests cover decline, bare Enter, EOF, confirmation, exact destructive-path preview, non-TTY refusal,
--yes, unknown IDs, and unchanged-file omission. The preview test was observed red after the upstream CAS rebase (stable.txtwas incorrectly listed) before the shared content comparison was added.Scope
This does not auto-create a pre-restore snapshot. That would introduce separate retention and naming behavior and is better handled independently.