soulsync/tests/downloads
dev ab05508acc feat(quality): rank-based candidate ordering toggle for priority mode
Adds an opt-in `rank_candidates_by_quality` profile flag. When on, the
priority-mode download walk orders candidates by the ranked-target quality
(confidence/speed only break ties) instead of confidence-first. Default off
keeps the byte-for-byte old behaviour, so existing installs are unaffected.

Best-quality search mode is always quality-first regardless of the flag; the
toggle only affects priority mode. Search-time source selection is unchanged —
nothing is skipped, so a track can never go missing, only the order in which
copies are tried changes.

The version-mismatch force-import follows automatically: it accepts the
first-tried (= best-ordered) quarantined candidate, which is the highest-quality
one once the walk is quality-first. No change to its selection logic needed.

- core/quality/selection.py: load_rank_candidates_by_quality() (fail-closed).
- core/downloads/task_worker.py: _best_quality_ordering -> _candidate_ordering;
  quality-first when best_quality mode OR the toggle is on.
- database/music_database.py: default profile carries the flag (False).
- web_server.py: flag is preserved globally across preset apply/reset, like
  search_mode.
- core/imports/version_mismatch_fallback.py: comment clarified (no behaviour
  change).

Tests (TDD): load_rank_candidates_by_quality default/enabled/disabled/error;
_candidate_ordering across all mode+toggle combinations + fail-closed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 22:00:57 +02:00
..
__init__.py
test_album_bundle_staging_sweep.py
test_album_serialize_drain.py
test_background_download_worker.py
test_candidate_ordering.py
test_deezer_pinning.py
test_download_engine.py
test_download_orchestrator.py
test_downloads_cancel.py
test_downloads_candidates.py
test_downloads_cleanup.py
test_downloads_history.py
test_downloads_lifecycle.py
test_downloads_master.py
test_downloads_post_processing.py
test_downloads_staging.py
test_downloads_status.py
test_downloads_task_worker.py
test_downloads_validation.py
test_file_finder.py
test_hifi_pinning.py
test_lidarr_pinning.py
test_orchestrator_search_mode.py
test_playlist_folder_exists.py
test_qobuz_pinning.py
test_rate_limit_policy.py
test_soulseek_aac_quality.py
test_soulseek_pinning.py
test_soundcloud_pinning.py
test_tidal_pinning.py
test_track_detail.py
test_track_link.py
test_track_metadata_backfill.py
test_wishlist_aggregator.py
test_worker_quality_ordering.py
test_youtube_pinning.py