Skip to content

fix(import): report why a manual import imported nothing - #191

Open
jordanfelle wants to merge 1 commit into
Chaptarr:developfrom
jordanfelle:fix-manual-import-report-failures
Open

jordanfelle wants to merge 1 commit into
Chaptarr:developfrom
jordanfelle:fix-manual-import-report-failures

Conversation

@jordanfelle

Copy link
Copy Markdown

Problem

ManualImportService.Execute counts results that were not imported but drops their reasons (the decision's Rejections and the result's Errors), and it leaves the command marked successful even when zero files were imported.

Through the API this looks like:

status: completed, result: successful
message: Manually imported 0 files (1 failed/skipped)

with nothing in the log. Anything driving Manual Import through POST /api/v1/command (scripts, integrations) cannot tell a real import from a rejected one. In practice about 89% (816 of 920) of the manual-import commands we submitted imported nothing, and we counted them as successes because the command reported success.

Fix

  • Log every non-imported file at Warn with its reasons: [MANUAL-IMPORT] Not imported (Rejected) '<path>': <reasons>.
  • Put the first reason in the command message: Manually imported 0 files (1 failed/skipped: <reason>).
  • Report the command as Unsuccessful when nothing was imported.

The reporter is an optional constructor argument (ICommandResultReporter commandResultReporter = null), so existing constructions and tests are unaffected. Partial imports keep their current result.

Verification

  • New test manual_import_that_imports_nothing_should_report_unsuccessful_with_the_reason.
  • Full suite: 3021 passed.
  • Live: the same request that previously returned a bare "0 files" now returns result: unsuccessful and ... 1 failed/skipped: The authoritative author catalog does not currently contain suggested work 'hc:781589' for Ebook., with the matching Warn line in the log.

ManualImportService.Execute counted non-imported results but discarded their
reasons (the decision's rejections and the result's errors), and left the
command marked successful even when zero files were imported. A caller saw
"Manually imported 0 files (1 failed/skipped)" with result Successful and
nothing in the log to explain it.

Log each non-imported file at Warn with its reasons, put the first reason in
the command message, and report the command as Unsuccessful when nothing was
imported. The reporter is an optional constructor argument, so existing
constructions are unaffected.
jordanfelle added a commit to jordanfelle/chaptarr that referenced this pull request Sep 26, 2026
jordanfelle added a commit to jordanfelle/chaptarr that referenced this pull request Sep 26, 2026
jordanfelle added a commit to jordanfelle/chaptarr that referenced this pull request Sep 26, 2026
jordanfelle added a commit to jordanfelle/chaptarr that referenced this pull request Sep 27, 2026
jordanfelle added a commit to jordanfelle/chaptarr that referenced this pull request Sep 27, 2026
jordanfelle added a commit to jordanfelle/chaptarr that referenced this pull request Sep 27, 2026
jordanfelle added a commit to jordanfelle/chaptarr that referenced this pull request Sep 27, 2026
jordanfelle added a commit to jordanfelle/chaptarr that referenced this pull request Sep 27, 2026
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