Skip to content

fix(importer): keep failed imports out of completed history - #1002

Merged
javi11 merged 1 commit into
mainfrom
fix/failed-import-history
Oct 14, 2026
Merged

javi11 merged 1 commit into
mainfrom
fix/failed-import-history

Conversation

@javi11

@javi11 javi11 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

When content verification rejects an import, provisional history could still report it as Completed alongside its Failed queue entry. Keep the live queue authoritative, roll back provisional history on failure or deferral, and return empty storage paths for failed jobs and jobs without a storage path. This prevents a failed download from exposing the import root to Sonarr/Radarr.

Remove history before its owning queue row during deletion and failed-job retention, in a transaction, so the foreign key cannot orphan a false Completed record. Existing successful archived history remains available.

Closes #997.

Validation:

  • Regression tests failed before the fixes and passed afterward for duplicated history, failure/retry/cancellation/repair deferral, missing storage, retention, and deletion faults.
  • Integration tests exercise real SQLite migrations and foreign keys, HTTP history responses by page and download ID, a subsequent successful release, and the importer failure lifecycle.
  • Uncached full Go suite, affected database/API/importer race suites, go vet, and go build passed.
  • Independent review and parent regression reruns passed.

PostgreSQL runtime and live Sonarr were not exercised. Already orphaned legacy records are preserved because they cannot safely be distinguished from successful archived imports. Existing macOS duplicate -lc++ linker warnings remain.

@javi11
javi11 merged commit c46f8e2 into main Oct 14, 2026
2 checks passed
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.

Failed import leaves a "Completed" history slot; Sonarr imports another show's episode under the failed download

1 participant