Skip to content

fix(guard): treat mass renames as renames, not deletions - #336

Merged
gnacho merged 1 commit into
mainfrom
fix/delete-guard-renames
Nov 9, 2026
Merged

gnacho merged 1 commit into
mainfrom
fix/delete-guard-renames

Conversation

@gnacho

@gnacho gnacho commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Closes #335

Problem

The delete guard compared paths only, so a burst of local renames (for example a photo renamer rewriting names from EXIF, producing -1 copies) looked like a mass deletion and churned the server trash bin with delete+upload.

Fix

  • Bump the manifest format to v2 and store (path, size, mtime) per file.
  • In check(), compute both missing and created, and cross-match them by (size, mtime). A disappeared file matching a created file on size and mtime is a rename and is excluded from the deletion count.
  • Only the remaining missing paths count against the mass-deletion thresholds.

Matching key

(size, mtime) exact, not size-only: a rename (mv, exiftool -FileName) preserves both. Size-only would risk a false negative where an unrelated same-size creation hides a real deletion.

Tests

  • mass_rename_alone_stays_quiet: a batch rename produces no alert.
  • rename_is_excluded_but_real_deletions_still_alert: renames are excluded from missing_paths, genuine deletions still fire the guard.

Gates: 788 tests (0 failed, 3 ignored), clippy -D warnings, fmt.

The delete guard compared paths only, so a burst of local renames
(for example a photo renamer rewriting names from EXIF) looked like a
mass deletion and churned the server trash bin with delete+upload.

Store size and mtime per file in the manifest (format v2) and, in
check(), cross-match disappeared files against newly created ones by
(size, mtime). A matching pair is a rename and is excluded from the
deletion count, so only genuine deletions trip the guard.
@gnacho
gnacho merged commit 0b3092f into main Nov 9, 2026
2 checks passed
@gnacho
gnacho deleted the fix/delete-guard-renames branch November 9, 2026 17:58
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.

Delete guard treats mass renames as mass deletions

1 participant