fix(scanner): resolve case-insensitive path identity to prevent duplicate books

When library items are scanned or moved on case-insensitive filesystems, paths with non-standard author or folder capitalization point to the same physical disk entries. Treating previous path spellings as distinct caused scanner, upload, dock, and rename services to fail path-reuse lookups and create duplicate book records.

Introduce path identity helpers to check whether paths resolve to the same underlying filesystem entry, treating matching entries as path updates rather than creating duplicate books.

Closes #1012
This commit is contained in:
neon
2026-08-16 00:29:32 +00:00
parent f49541cb20
commit e2aeaf95ea
14 changed files with 528 additions and 75 deletions
@@ -151,6 +151,23 @@ const structuralScenarios: StructuralScenario[] = [
},
},
},
{
id: 'manual-case-only-author-folder-rename',
trigger: 'manual',
libraries: [{ key: 'a', rootDir: 'lib-a', mode: 'book_per_folder' }],
entries: [file('lib-a/Bell Hooks/Book/book.epub')],
operations: [{ type: 'move', from: 'lib-a/Bell Hooks', to: 'lib-a/bell hooks' }],
expected: {
a: {
statusByFolder: { 'bell hooks/Book': 'present' },
absentFolders: ['Bell Hooks/Book'],
fileOwners: { 'bell hooks/Book/book.epub': 'bell hooks/Book' },
presentCount: 1,
missingCount: 0,
},
},
requiresCaseRename: true,
},
{
id: 'manual-move-root-file-into-subfolder',
trigger: 'manual',