Skip to content

dedupe: do not treat split library folders as already filed - #14

Merged
Mancolt merged 3 commits into
mainfrom
cursor/critical-bug-management-5ec7
Sep 18, 2026
Merged

Mancolt merged 3 commits into
mainfrom
cursor/critical-bug-management-5ec7

Conversation

@cursor

@cursor cursor Bot commented Sep 17, 2026

Copy link
Copy Markdown

Bug and impact

Config/dedupe_roots treated a multi-file release as already filed whenever every source inode appeared somewhere under the library, even if those files lived in different folders. hardlinkUnlessFiled then skipped, printed Already in the library at <first folder>, and cacheMe wrote the processed marker — so later runs never completed the book.

Trigger: a two-disc release whose files were previously hardlinked under two different matches (a prior multibook run, or one disc moved in Audiobookshelf). The next unpinned run with dedupe_roots set never created the unified folder.

Root cause

alreadyFiled collected a folder per inode and returned folders[0] without checking they were the same directory. That violated its own contract ("the library folder that already holds every one of files").

Fix

Return None unless every file maps to the same library folder, so hardlinkUnlessFiled completes the release (hardlinkFile still skips dests that already exist). Sibling {title} {disc} directories are a conservative false-negative (re-link, skip-if-exists) rather than a skip-forever.

Validation

  • New test LibraryTest.test_files_in_different_library_folders_are_not_already_filed
  • Existing same-folder / partial-filing / pin-bypass dedupe tests still pass
  • python3 -m unittest discover -s tests -p 'test_*.py': 189 tests, OK
Open in Web View Automation 

cursoragent and others added 3 commits September 17, 2026 14:35
alreadyFiled returned the first inode's folder whenever every file of a
release appeared somewhere under dedupe_roots. Discs left in two different
matches (a prior multibook run, or a file moved in the library) were
skipped, then cacheMe hid the rest of the files on later runs. Require
every file to live in the same folder so hardlinkUnlessFiled can complete
the release.

Co-authored-by: Mancolt <Mancolt@users.noreply.github.com>
…t as filed

The same-folder rule would have reported every multi-disc book booktree
filed itself (Config/target_path/disc_folder) as not filed, switching
dedupe_roots off for exactly the releases that #15 now groups. Collapse a
disc subfolder to its parent before comparing; a split filing across two
titles still fails the check.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Mancolt
Mancolt marked this pull request as ready for review September 18, 2026 15:20
@Mancolt
Mancolt merged commit 41660ee into main Sep 18, 2026
2 of 3 checks passed
@Mancolt
Mancolt deleted the cursor/critical-bug-management-5ec7 branch September 18, 2026 15:20
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