soulsync/tests/imports
BoulderBadgeDad 8abf470018 imports: never delete a file we couldn't quarantine — leave it for retry
Discord (Shdjfgatdif): "if a track isn't imported it should remain there, not be deleted, so we
can retry." He was seeing failed downloads disappear and having to re-download.

Normally a rejected file is QUARANTINED (moved to ss_quarantine, preserved + retryable), not
deleted. But all four quarantine blocks (integrity / silence / quality / acoustid) had the same
fallback: if move_to_quarantine itself raised, os.remove(file_path). On a NAS that move can fail
(cross-device / permissions), so the except fired and the user's download was DELETED — the worst
outcome, and exactly the re-download pain he reported.

fix: on quarantine failure, log and LEAVE the file in place — never delete. The task is still
marked failed and the batch still notified (that code runs after the try/except and never touched
the deleted file), so the only behaviour change is "preserved instead of destroyed". Reviewed
every os.remove in the pipeline: the remaining ones are success-path cleanups (replacing an
existing destination, or removing a redundant download when the track is already in the library at
equal/better quality) — left untouched.

regression test drives the REAL pipeline through integrity-rejection with quarantine forced to
raise, and asserts the source file is preserved while the task is still failed + notified.
1311 imports/downloads/quality tests green, ruff clean.
2026-06-28 15:10:43 -07:00
..
test_album_grouping.py Library: group imported albums by canonical release id, not just the name string 2026-06-18 09:16:00 -07:00
test_album_matching_exact_id.py Auto-import matching: fix Deezer source classification + bump tolerance 2026-05-09 15:53:17 -07:00
test_album_matching_helper.py Auto-import polish: real-file tag reader test, source-aware duration, pin consolation 2026-05-09 11:08:09 -07:00
test_album_position.py Auto-download: resolve an album track's real position from its album (not 1/1) 2026-06-22 13:32:24 -07:00
test_album_search_scoring.py Auto-import: fall through to other metadata sources when primary returns no match 2026-05-12 12:32:18 -07:00
test_auto_import_clear_completed_endpoint.py Import history: Clear History button now sweeps stuck 'processing' rows 2026-05-12 12:53:37 -07:00
test_auto_import_context_shape.py Auto-import: fall through to other metadata sources when primary returns no match 2026-05-12 12:32:18 -07:00
test_auto_import_executor.py Auto-import: bounded ThreadPoolExecutor + per-candidate UI state isolation 2026-05-09 17:45:42 -07:00
test_auto_import_live_progress.py Auto-import: live per-track progress + in-progress history row 2026-05-02 22:34:09 -07:00
test_auto_import_multi_disc_matching.py Auto-import: respect disc_number in dedup + match scoring 2026-05-08 22:36:51 -07:00
test_auto_import_multi_source_fallback.py Auto-import: fall through to other metadata sources when primary returns no match 2026-05-12 12:32:18 -07:00
test_auto_import_scanner_grouping.py Auto-import: dedup on folder_hash, not path — fixes silent-skip bug 2026-05-09 14:09:19 -07:00
test_auto_import_tag_reader_real_files.py Auto-import polish: real-file tag reader test, source-aware duration, pin consolation 2026-05-09 11:08:09 -07:00
test_build_single_import_context_typed_path.py Migrate album-info builders to typed Album path 2026-05-03 22:53:12 -07:00
test_dedup_orphan_cleanup.py Prune slskd dedup orphans after import 2026-05-01 09:35:08 -07:00
test_duration_tolerance_resolution.py Configurable duration tolerance for downloaded-file integrity check 2026-05-14 06:53:36 -07:00
test_expected_duration_for_check.py Import: don't duration-quarantine manual imports against a re-resolved release (#804) 2026-06-07 23:02:34 -07:00
test_file_integrity.py integrity: don't quarantine longer masters/versions as 'truncated' (#937) 2026-06-27 15:25:13 -07:00
test_folder_artist_override.py Fix import artist override and verification review 2026-06-11 01:28:31 +02:00
test_import_album.py Rehome import helpers into core/imports 2026-04-27 19:54:44 +03:00
test_import_context.py Multi-artist tags: Search → Download Now finally knows its metadata source (Netti93) 2026-06-09 17:20:16 -07:00
test_import_file_ops.py lossy copy: support all lossless formats, not just FLAC (#941) 2026-06-28 12:13:05 -07:00
test_import_filename.py Rehome import helpers into core/imports 2026-04-27 19:54:44 +03:00
test_import_guards.py feat(import): master toggle for quality-filtering on import + collapsible tile 2026-06-15 15:29:29 +02:00
test_import_paths.py Fix #767: Library Organizer dry run no longer creates folders 2026-06-02 10:32:06 -07:00
test_import_pipeline.py imports: never delete a file we couldn't quarantine — leave it for retry 2026-06-28 15:10:43 -07:00
test_import_rejection_reason.py test: update bit-depth guard tests to the unified quality-guard behavior 2026-06-14 12:52:14 +02:00
test_import_resolution_single_track_context.py Move metadata helpers into package modules 2026-04-29 11:28:42 +03:00
test_import_routes.py import page: share ONE staging scan across files/groups/hints (#935) 2026-06-28 09:49:03 -07:00
test_import_side_effects.py Add torrent and usenet release staging support 2026-05-21 14:22:21 -07:00
test_import_singles_route_through_album_path.py Route imported singles/EPs through album_path template 2026-04-30 21:33:09 -07:00
test_import_staging.py Show MusicBrainz release variants in import 2026-05-24 09:33:19 -07:00
test_lossy_copy_delete_original.py Honor lossy_copy.delete_original after successful conversion 2026-05-02 14:26:46 -07:00
test_normalize_disc_number.py Multi-disc: file the track in the disc folder that matches its tag (Sokhi) 2026-06-22 10:56:53 -07:00
test_quality_guard.py feat(import): master toggle for quality-filtering on import + collapsible tile 2026-06-15 15:29:29 +02:00
test_quarantine_management.py fix(quality): .aiff probe class + refresh tests drifted by the 2.7.4 merge (#896) 2026-06-24 21:40:14 +02:00
test_rematch_apply.py #889 Phase 4: the Re-identify modal + apply backend 2026-06-18 15:37:56 -07:00
test_rematch_hints.py #889 Phase 1: re-identify hint store (DB table + pure create/find/consume seam) 2026-06-18 15:15:41 -07:00
test_rematch_hints_seam.py #889: FIX data loss — re-identify to the same release no longer deletes the file 2026-06-18 17:13:46 -07:00
test_rematch_search.py #889 Phase 3: re-identify search — multi-source track→release lookup + API 2026-06-18 15:31:33 -07:00
test_search_match_endpoints.py Deezer search: drop advanced-syntax at endpoint, free-text + rerank wins 2026-05-10 09:36:48 -07:00
test_silence_guard.py quality: recognize DSD (.dsf/.dff) as lossless + stop the false "truncated" flag (#939) 2026-06-28 11:45:16 -07:00
test_single_to_album.py Library: wire single->album resolution into import detection (gated, fail-safe) 2026-06-18 09:30:11 -07:00
test_track_number_resolver.py Track "01" bug: recover real track position instead of fabricating 1 2026-06-15 23:35:48 -07:00
test_track_number_strip.py #890: strip leading track-number prefix from filename-derived titles 2026-06-18 18:35:04 -07:00
test_version_mismatch_fallback.py Downloads: opt-in last-resort acceptance of repeated version mismatches 2026-06-06 16:44:14 +02:00