Skip to content

Recover files: bring back deleted or changed files from parity - #31

Merged
firsttris merged 1 commit into
masterfrom
claude/recover-files
Oct 9, 2026
Merged

firsttris merged 1 commit into
masterfrom
claude/recover-files

Conversation

@firsttris

Copy link
Copy Markdown
Owner

Adds a recycle bin. Until the next sync, the parity still holds every file as it was at the last sync. The new page Recover files (sidebar, under Dashboard) lists what changed since then and restores the picked files.

What it does

  • Two tabs from snapraid diff:
    • Deleted: files removed since the last sync.
    • Changed: same name, other content. This covers files encrypted by ransomware or overwritten by mistake.
  • Search and selection: search by part of the path or by the exact disk name, then tick single files or Select all shown files.
  • Restore: Restore N files asks for confirmation. For changed files the confirmation says the current content is replaced and lost.
  • Next sync warning: a notice shows when the next scheduled sync runs, because after it these files can no longer be restored.
  • After restoring: restored files leave the list. A file restored in place can still show as changed in diff until the next sync. SnapRAID sometimes keeps the new modification time to avoid inode mix-ups; the content is the old one, and the page explains this.
  • Sync preview: the "deleted files" hint now points to Recover files.

How

  • Endpoint: POST /api/snapraid/restore takes {configPath, files: [{disk, path}]} and runs snapraid fix -d <disk> -f /<path>….
    • One job per disk, one after the other. A filter applies to every disk in a run, so a file with the same path on another disk would otherwise be reverted too.
    • The chain stops after a failed fix, or if another job starts in between.
    • At most 1000 files per request.
  • Filter escaping: SnapRAID's filters have no backslash escape. Each *, ? and [ becomes a one-character class ([*]), so names like x[1] *.bin match literally.
  • Verified by hand against SnapRAID 14.10: fix -f restores deleted files, and also changed files to the content of the last sync.

Tests

  • Backend: 141 passed with Deno 2.5 (the CI version). New tests cover the exact filter with wildcards, one run per disk, and stopping on failure or a busy engine.
  • Frontend: Biome, typecheck, Vitest 29. New tests cover splitting the diff into deleted and changed files, and the search.
  • E2E: 17/17 locally. New tests:
    • a deleted file and an "encrypted" file are restored byte for byte;
    • a file with the same path on another disk stays untouched.
  • Docs: Recover files section in usage.md (with a ransomware tip), API row in architecture.md, development.md, README feature. mkdocs build --strict passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JuXnquCPdbG5sBbDyin7yF


Generated by Claude Code

A page lists the files deleted or changed since the last sync, from
snapraid diff, and restores the picked ones as they were at the last
sync: snapraid fix -d <disk> -f /<path>, one run per disk so a file of
the same path on another disk stays as it is. Wildcards in file names
are matched literally. Changed files cover ransomware: their encrypted
content is replaced by the version of the last sync.

With unit and end-to-end tests and documentation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JuXnquCPdbG5sBbDyin7yF
@firsttris
firsttris force-pushed the claude/recover-files branch from c07a0ab to 1c5edc0 Compare October 9, 2026 11:16
@firsttris
firsttris merged commit d139490 into master Oct 9, 2026
4 checks passed
@firsttris
firsttris deleted the claude/recover-files branch October 16, 2026 09:56
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