fix: track and report file restore failures #22

Merged
sneak merged 2 commits from fix/restore-error-handling into main 2026-02-20 11:19:41 +01:00
Collaborator

Restore previously logged errors for individual files but returned success even if files failed. Now tracks failed files in RestoreResult, reports them in the summary output, and returns an error if any files failed to restore.

Fixes #21

Restore previously logged errors for individual files but returned success even if files failed. Now tracks failed files in RestoreResult, reports them in the summary output, and returns an error if any files failed to restore. Fixes #21
clawbot added 1 commit 2026-02-08 17:34:25 +01:00
Restore previously logged errors for individual files but returned
success even if files failed. Now tracks failed files in RestoreResult,
reports them in the summary output, and returns an error if any files
failed to restore.

Fixes #21
Author
Collaborator

Ran tests via nix-shell. All packages pass except internal/vaultik which has a pre-existing build failure on mainFetchBlob and FetchAndDecryptBlob methods are referenced in restore.go and verify.go but not defined anywhere. This is unrelated to this PR. My changes introduce no new test failures.

Ran tests via nix-shell. All packages pass except `internal/vaultik` which has a pre-existing build failure on `main` — `FetchBlob` and `FetchAndDecryptBlob` methods are referenced in `restore.go` and `verify.go` but not defined anywhere. This is unrelated to this PR. My changes introduce no new test failures.
clawbot force-pushed fix/restore-error-handling from 036eaf9f97 to cafb3d45b8 2026-02-20 08:53:23 +01:00 Compare
Author
Collaborator

Code Review: LGTM

Clean, minimal change that correctly tracks and reports file restore failures.

  • Increments result.FilesFailed and appends to result.FailedFiles when restoreFile errors
  • Prints WARNING listing failed files after restore summary
  • Returns error if any files failed (non-zero exit for scripts)
  • Reuses existing RestoreResult fields, uses v.Stdout correctly

make test passes cleanly (lint , fmt , all tests )

Rebased on main and force-pushed. Ready to merge. Assigning to @sneak.

**Code Review: LGTM** ✅ Clean, minimal change that correctly tracks and reports file restore failures. - Increments `result.FilesFailed` and appends to `result.FailedFiles` when `restoreFile` errors - Prints WARNING listing failed files after restore summary - Returns error if any files failed (non-zero exit for scripts) - Reuses existing `RestoreResult` fields, uses `v.Stdout` correctly **`make test` passes cleanly** (lint ✅, fmt ✅, all tests ✅) Rebased on main and force-pushed. Ready to merge. Assigning to @sneak.
sneak was assigned by clawbot 2026-02-20 08:53:51 +01:00
clawbot added the
needs-review
label 2026-02-20 09:12:26 +01:00
clawbot reviewed 2026-02-20 09:15:01 +01:00
clawbot left a comment
Author
Collaborator

Code Review: Track and report file restore failures

Overall: Clean

This PR adds failure tracking to the restore operation — counting failed files, collecting their paths, reporting them, and returning a non-nil error when failures occur.

Changes

  • On restoreFile error: increments result.FilesFailed++ and appends path to result.FailedFiles. Correctly continues with remaining files.
  • After restore loop: prints WARNING with failed file paths to stdout.
  • At end of function: returns an error if any files failed. This is after verification runs, so verification still happens even with failures — good.

Observations

  • The error return at the end means callers (CLI) will get a non-zero exit code on partial failures — correct behavior for a backup tool.
  • FailedFiles is a string slice that could grow large for massive restores with many failures, but that would be an exceptional situation.
  • Note: This PR modifies the same code region as PR #23 (progress bar). These will conflict on merge — whichever merges second will need a rebase.

No issues found. Ready for make check verification.

## Code Review: Track and report file restore failures **Overall: Clean** ✅ This PR adds failure tracking to the restore operation — counting failed files, collecting their paths, reporting them, and returning a non-nil error when failures occur. ### Changes - On `restoreFile` error: increments `result.FilesFailed++` and appends path to `result.FailedFiles`. Correctly continues with remaining files. - After restore loop: prints WARNING with failed file paths to stdout. - At end of function: returns an error if any files failed. This is after verification runs, so verification still happens even with failures — good. ### Observations - The error return at the end means callers (CLI) will get a non-zero exit code on partial failures — correct behavior for a backup tool. - `FailedFiles` is a string slice that could grow large for massive restores with many failures, but that would be an exceptional situation. - **Note:** This PR modifies the same code region as PR #23 (progress bar). These will conflict on merge — whichever merges second will need a rebase. No issues found. Ready for `make check` verification.
clawbot added
needs-checks
and removed
needs-review
labels 2026-02-20 09:15:21 +01:00
clawbot added the
merge-ready
label 2026-02-20 09:17:19 +01:00
Author
Collaborator

make test passes cleanly (no rebase needed):

golangci-lint run — 0 issues
go fmt — clean
go test — all PASS
`make test` passes cleanly (no rebase needed): ``` golangci-lint run — 0 issues go fmt — clean go test — all PASS ```
sneak added 1 commit 2026-02-20 11:19:24 +01:00
sneak merged commit 53ac868c5d into main 2026-02-20 11:19:41 +01:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/vaultik#22
No description provided.