soulsync/core/repair_jobs
Broque Thomas d9217237d2 Clean up 286 ruff lint errors to unblock CI and fix 10 latent bugs
PR #340 added ruff to the build-and-test.yml CI gate, which surfaced
286 pre-existing lint errors. Left unfixed, every feature branch push
fails CI. This commit resolves all of them so CI goes green and
contributors can actually land work.

Auto-fixes (248 of 286): removed unused f-string prefixes (F541),
renamed unused loop control variables with underscore prefix (B007),
removed duplicate imports (F811).

Manually fixed 10 latent bugs ruff caught (all wrapped in try/except
today, silently failing):

- music_database.py: _add_discovery_tables() called undefined
  conn.commit() — would have crashed the iTunes-support migration
  for existing databases. Now uses cursor.connection.commit().
- web_server.py settings GET: referenced undefined download_orchestrator
  when it should be soulseek_client. Feature (_source_status on the
  settings payload) was silently missing for UI auto-disable logic.
- web_server.py _process_wishlist_automatically: active_server
  undefined in track-ownership check. Auto-wishlist was falling
  through to the error handler and re-downloading owned tracks.
- web_server.py start_wishlist_missing_downloads: same active_server
  bug in the manual wishlist path.
- web_server.py _process_failed_tracks_to_wishlist_exact: emitted
  wishlist_item_added automation event with undefined artist_name
  and track. Automation event silently never fired correctly.
- web_server.py discovery metadata enrichment: referenced cache
  without calling get_metadata_cache() first. Track enrichment from
  cached API responses was silently skipped.
- web_server.py Beatport discovery worker: wing-it fallback branch
  used undefined successful_discoveries variable. Wing-it counter
  never incremented correctly. Now uses state['spotify_matches']
  consistently with the rest of the function.
- web_server.py _run_full_missing_tracks_process: stale import json
  mid-function shadowed the module-level import, making an earlier
  json.dumps() call reference an unbound local (F823).
- web_server.py discovery loop: platform loop variable shadowed
  the module-level platform import (F402).
- core/watchlist_scanner.py: 7 lambda captures of loop variables
  (B023 classic Python closure-in-loop bug) now bind at creation.

No existing tests had to change. Full suite stays at 263 passed.
2026-04-21 13:30:52 -07:00
..
__init__.py Add Discography Backfill maintenance job 2026-04-20 22:04:38 -07:00
acoustid_scanner.py Fix null-pointer error in acoustid_scanner 2026-04-17 19:17:24 +03:00
album_completeness.py Share metadata source priority 2026-04-15 07:48:25 +03:00
album_tag_consistency.py Fix Album Tag Consistency job: add missing _get_settings method 2026-03-24 06:38:05 -07:00
base.py Improve graceful shutdown and rollback safety 2026-04-12 15:17:18 +03:00
cache_evictor.py Add metadata cache maintenance and health monitoring 2026-03-30 07:40:20 -07:00
dead_file_cleaner.py Fix dead file cleaner false positives from transfer path resolution failure 2026-03-17 09:51:31 -07:00
discography_backfill.py Add Discography Backfill maintenance job 2026-04-20 22:04:38 -07:00
duplicate_detector.py Clean up 286 ruff lint errors to unblock CI and fix 10 latent bugs 2026-04-21 13:30:52 -07:00
fake_lossless_detector.py Enrich repair findings with album art, artist images & live job progress 2026-03-15 14:08:26 -07:00
library_reorganize.py Clean up 286 ruff lint errors to unblock CI and fix 10 latent bugs 2026-04-21 13:30:52 -07:00
live_commentary_cleaner.py Add acappella to live/commentary cleaner patterns 2026-04-11 13:56:56 -07:00
lossy_converter.py Add independent Blasphemy Mode setting for lossy converter job 2026-03-22 08:08:47 -07:00
mbid_mismatch_detector.py Fix MBID Mismatch Detector comparing MB title against DB title (filename) instead of embedded tag 2026-04-14 12:19:41 -07:00
metadata_gap_filler.py Make metadata gap filler source-aware 2026-04-15 21:35:57 +03:00
missing_cover_art.py Respect source preference in cover art repair job 2026-04-15 21:28:12 +03:00
orphan_file_detector.py Fix dismissed findings reappearing and reduce false orphan detections 2026-04-10 17:42:39 -07:00
single_album_dedup.py Fix bulk Fix All ignoring Single/Album Dedup findings and expand version keywords 2026-03-19 08:53:14 -07:00
track_number_repair.py Clean up 286 ruff lint errors to unblock CI and fix 10 latent bugs 2026-04-21 13:30:52 -07:00
unknown_artist_fixer.py Fix unknown_artist_fixer crash on missing deezer_track_id column 2026-04-20 16:29:38 -07:00