Skip to content

fix(import): warn about existing-file conflict in Manual Import preview - #187

Open
jordanfelle wants to merge 1 commit into
Chaptarr:developfrom
jordanfelle:fix-184-manual-import-existing-file-warning
Open

jordanfelle wants to merge 1 commit into
Chaptarr:developfrom
jordanfelle:fix-184-manual-import-existing-file-warning

Conversation

@jordanfelle

Copy link
Copy Markdown

Summary

The Manual Import preview modal shows a clean "Ready now (local)" status
with zero warning even when the book already has an existing tracked file
at the managed destination (via a different download) — in both
Combine and Replace mode.

This happens because the "does a file already occupy this book's managed
destination" collision check
(ImportApprovedBooks.GetAdditionalCopyPathCollisionReason) is only ever
invoked at actual import execution time
(ImportApprovedBooks.Import()), never during the preview
(ManualImportService.GetMediaFiles → MapItem). So the preview can't
warn about something the real import will reject/overwrite a moment
later.

Fix

  • Adds IImportApprovedBooks.CheckExistingDestinationConflict(...), a
    non-mutating, single-item version of the existing collision-check logic
    (reuses the same destination-path computation and file-lookup — doesn't
    duplicate it).
  • ManualImportService.MapItem now calls it and, if a conflict is found,
    appends a Rejection with RejectionType.Temporary
    (CanBypass = true, Warning severity) — informational only, doesn't
    block either Combine or Replace mode, matching how other *arr apps
    surface this in their Manual Import UI.
  • Null-safe (?.) since some existing test fixtures construct
    ManualImportService without IImportApprovedBooks wired.

Verified live against a real duplicate (a book already imported under a
different download) — the preview now shows the conflict warning in both
Combine and Replace mode, where before it showed neither.

Test plan

  • Existing test suite passes in full (3,020/3,020) after adding the
    interface method's trivial stub implementations to the two
    hand-written fixtures that construct ImportApprovedBooks
    manually, and after making the new call site null-safe.
  • Live-verified against a real currently-existing duplicate on a
    running instance: preview now returns a rejections entry
    ("An existing file is already imported at the managed
    destination: ...") in both replaceExistingFiles=false and
    replaceExistingFiles=true modes.

…eview (Chaptarr#184)

The Manual Import preview never checked whether the computed destination
already had a tracked file at it - that check only ever ran at actual-import
time, inside ImportApprovedBooks.Import() via
GetAdditionalCopyPathCollisionReason. So a book that's already in the
library under a different download showed a clean "Ready now (local)"
status with no warning, in both Combine and Replace mode - the user had no
way to know importing would either create a duplicate copy or silently
overwrite the existing file until after clicking Import (Replace) or
discovering the automatic pipeline had already blocked it (the automatic
path does run this check, just never surfaces it in the preview a human
would look at first).

Adds IImportApprovedBooks.CheckExistingDestinationConflict, a read-only,
single-item version of the same collision check the real import already
runs, so ManualImportService.MapItem can call it during the preview and
attach a Temporary/warning-severity Rejection when there's a conflict -
informational only, doesn't block either mode, matches how other *arr apps
surface this in their own Manual Import UI.

Confirmed live: a book already in the library (previously imported under a
different release) reproducibly showed "Ready now (local)" with zero
warning in the modal, in both Combine and Replace mode, before this fix.
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.

1 participant