soulsync/tests/imports
BoulderBadgeDad 79648a4f5f import: async staging scan so a large library doesn't time out the page (#947, phase 1 backend)
A whole-library migration (ramonskie copied his Lidarr library into /staging) makes the synchronous
staging scan walk + tag-read tens of thousands of files INSIDE the GET request, blowing past
gunicorn's 120s timeout — and because the killed request never warms the cache, every reload
re-times-out. Moves the SAME scan off the request thread; the page reports progress instead of
hanging.

- _scan_staging_records gains an optional `progress` param (additive; default None = unchanged).
  Refactored to two passes: a fast walk to collect the audio-file list (total), then the slow
  tag-read loop updating scanned. A generation guard stops a scan that finishes AFTER an import
  from committing stale records.
- ensure_background_staging_scan(path): idempotent background runner filling the existing cache.
- get_staging_records_or_status(): warm cache or a scan that finishes within a ~3s grace → records
  (so small/normal folders still answer in one request, no UX change); else ("scanning", progress).
  A scan error is re-raised so the endpoints log + return it exactly as before.
- /staging/files|groups|hints return {scanning, progress} when the scan is still running instead of
  blocking; new lightweight /staging/scan-status for cheap progress polling.

Single source preserved (same scan + cache, just off the request thread). 13 new tests (progress,
idempotent ensure, grace ready-vs-scanning, generation guard discards stale, endpoint scanning
shape, error contract, status ready/cold); full import suite 626 green; ruff clean.

Next: phase 2 — the React import page polls scan-status + shows a progress bar, then renders.
2026-06-29 09:24:41 -07:00
..
test_album_grouping.py
test_album_matching_exact_id.py
test_album_matching_helper.py
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
test_auto_import_clear_completed_endpoint.py
test_auto_import_context_shape.py
test_auto_import_executor.py
test_auto_import_live_progress.py
test_auto_import_multi_disc_matching.py
test_auto_import_multi_source_fallback.py
test_auto_import_scanner_grouping.py
test_auto_import_tag_reader_real_files.py
test_build_single_import_context_typed_path.py
test_dedup_orphan_cleanup.py
test_duration_tolerance_resolution.py
test_expected_duration_for_check.py
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
test_import_album.py
test_import_context.py
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
test_import_guards.py
test_import_paths.py
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_import_resolution_single_track_context.py
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
test_import_singles_route_through_album_path.py
test_import_staging.py
test_lossy_copy_delete_original.py
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
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
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
test_staging_scan_async.py import: async staging scan so a large library doesn't time out the page (#947, phase 1 backend) 2026-06-29 09:24:41 -07:00
test_track_number_resolver.py
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