soulsync/tests
BoulderBadgeDad cea0e365c2 Fix #759: Amazon enrichment floods when its public proxy is down
After an update, installs became unusable: the Amazon enrichment worker runs by
default, the default public T2Tunes proxy (t2tunes.site) was returning
503 'Amazon Music API is not initialized', and the worker treated every album
as an individual error -- logging an ERROR per item, churning network + DB
continuously across the whole library, and marking every row 'error' (a state
the retry tiers never re-attempt, so even after the proxy recovered nothing
re-enriched). The reporter couldn't reach the UI to turn it off.

Two-part fix:

1. Source-outage circuit breaker (core/amazon_outage.py, pure + tested):
   - is_source_outage(exc) distinguishes a whole-source outage (HTTP 5xx,
     'not initialized', connection failure, non-JSON error page) from a real
     per-item miss (404, transient 400, etc.).
   - On an outage the worker now leaves the item UNTOUCHED (so it's retried once
     the proxy recovers instead of being permanently burned to 'error'), logs
     ONCE per streak, and backs off with next_poll_delay_seconds() -- escalating
     30s -> 60s -> ... capped at 30 min -- instead of grinding every 2s. It
     auto-resumes the normal cadence the moment the source answers (success OR a
     non-outage error both clear the streak).
   - AmazonClientError now carries status_code so detection doesn't rely on
     message parsing.

2. Opt-in by default (web_server.py): amazon_enrichment_paused now defaults to
   True. Because enrichment depends on an external public proxy that can be
   down, it stays paused unless the user explicitly enables it -- a proxy outage
   can no longer take down installs that never opted in. (Behaviour change:
   anyone on the old auto-on default is now paused; re-enable in Settings.)

Together: on update the worker is paused -> no flood -> UI accessible; opted-in
users are protected from future outages by the breaker.

Tests: tests/test_amazon_outage.py (12) pin the classifier across every error
surface (incl. the exact 503 'not initialized' case) and the back-off schedule
(monotonic, capped). 157 Amazon tests pass; lint clean.

Note: could not reproduce the exact 'UI fully unreachable' mechanism remotely
(WAL + 8 gthreads shouldn't hard-lock); the fix removes the flood/churn that is
the practical cause and defaults the feature off.
2026-06-01 13:10:51 -07:00
..
artists
automation Auto-Sync: fix LB pipelines stuck on "Refreshing:" for 5+ minutes 2026-05-27 18:04:55 -07:00
database Preserve Navidrome album cover art 2026-05-25 19:51:38 -07:00
discovery Fix: Spotify sync crash 'unexpected keyword argument candidate_pool' 2026-05-31 23:00:24 -07:00
downloads Downloads: add per-track detail endpoint for the track-detail modal 2026-05-31 20:18:35 -07:00
enrichment
imports Quarantine: manage a quarantined file from the download modal (Listen / Accept / Search) 2026-05-31 15:41:04 -07:00
library Test missing-track existing file imports 2026-05-17 14:18:17 -07:00
matching AcoustID: report errors honestly instead of masking them as 'Skipped' 2026-05-31 20:10:31 -07:00
media_server Preserve Navidrome album cover art 2026-05-25 19:51:38 -07:00
metadata Cover-art sources: skip low-res art (min-resolution guard) + max-res iTunes 2026-06-01 12:24:51 -07:00
playback Player: log SoulSync web-player plays (recently-played + smart-radio recency) 2026-05-30 15:11:46 -07:00
playlists Expose mirrored playlist source-ref health 2026-05-24 19:32:39 -07:00
radio Player revamp Phase 2: smart radio ranking (play-count + popularity) 2026-05-30 08:47:18 -07:00
search Basic search: visual overhaul + per-source picker in hybrid mode 2026-05-28 10:22:07 -07:00
static Fix: mirrored playlist action buttons dead when name has an apostrophe 2026-06-01 09:02:25 -07:00
stats
streaming Player revamp Phase 3a: extract stream state into testable per-session store 2026-05-30 08:59:15 -07:00
sync Address Cin review: extract helpers, indexed pool fetch, tidy nits 2026-05-24 23:33:55 -07:00
text Address Cin review: extract helpers, indexed pool fetch, tidy nits 2026-05-24 23:33:55 -07:00
tools test(amazon): update search_albums test for derived-from-tracks behavior 2026-05-19 18:24:27 -07:00
watchlist Complete MusicBrainz watchlist source parity 2026-05-18 19:19:25 -07:00
webui Fix missing album placeholder asset path 2026-05-22 08:34:42 -07:00
wishlist Wishlist: route the manual flow through the shared engine (manual == auto) 2026-05-29 17:43:40 -07:00
conftest.py tests: isolate the database so the suite can never touch the real DB 2026-05-31 23:36:57 -07:00
test_acoustid_error_reporting.py AcoustID: report errors honestly instead of masking them as 'Skipped' 2026-05-31 20:10:31 -07:00
test_acoustid_scanner.py
test_acoustid_skip_logic.py AcoustID: report errors honestly instead of masking them as 'Skipped' 2026-05-31 20:10:31 -07:00
test_acoustid_version_mismatch.py AcoustID: report errors honestly instead of masking them as 'Skipped' 2026-05-31 20:10:31 -07:00
test_album_bundle.py Album picker #730: add word-boundary full-phrase bonus (from PR #731 review) 2026-05-30 20:10:22 -07:00
test_album_bundle_dispatch.py Add Soulseek album bundle downloads 2026-05-23 15:08:21 -07:00
test_album_completeness_job.py
test_album_mbid_consistency.py
test_amazon_outage.py Fix #759: Amazon enrichment floods when its public proxy is down 2026-06-01 13:10:51 -07:00
test_archive_pipeline.py feat(downloads): add archive_pipeline module for torrent/usenet downloads 2026-05-20 17:05:00 -07:00
test_artist_full_detail_source_id.py Fix: enhanced artist view 404s for library artists opened via source ID 2026-05-28 12:00:29 -07:00
test_artist_top_tracks_clients.py
test_audiodb_worker_stuck_track.py
test_auth_usage_throttle.py
test_auto_sync_js.py Add node:test contract for auto-sync.js helpers 2026-05-25 00:01:34 -07:00
test_config_save_retry.py
test_content_filter_regex.py
test_create_finding_dedup_counter.py
test_dashboard_events.py
test_database_io_resilience.py Handle transient SQLite IO during maintenance 2026-05-21 17:50:30 -07:00
test_db_genres_json_normalization.py DB: normalize legacy comma-separated genres to canonical JSON 2026-05-29 12:11:09 -07:00
test_db_integrity.py DB backups: verify integrity + never evict the last good backup 2026-05-30 21:13:04 -07:00
test_db_isolation_guard.py tests: isolate the database so the suite can never touch the real DB 2026-05-31 23:36:57 -07:00
test_db_migration_ledger.py DB: add schema_migrations ledger + PRAGMA user_version backstop 2026-05-29 12:14:20 -07:00
test_db_watchlist_amazon_id_migration.py DB: stop watchlist_artists rebuilds from dropping amazon_artist_id 2026-05-29 12:04:11 -07:00
test_debug_info_services.py
test_discogs_collection_source.py Discogs: strip artist disambiguation suffixes at every name surface (#634) 2026-05-27 09:05:47 -07:00
test_discogs_track_count.py
test_discover_section_controller_js.py
test_download_orchestrator_soundcloud.py
test_download_plugin_conformance.py Add torrent usenet PR notes and test updates 2026-05-21 15:28:48 -07:00
test_downloads_pagination.py
test_duplicate_detector_mount_paths.py
test_duplicate_detector_slskd_dedup.py
test_duplicate_keep.py Fix: duplicate detector kept lossy over lossless (rank format first) 2026-06-01 12:49:34 -07:00
test_enrichment_services.py
test_featured_artist_completion.py
test_hifi_instance_methods.py
test_hls_parsing.py
test_image_cache.py Image cache: reject truncated downloads instead of caching broken covers (#750) 2026-05-30 17:45:01 -07:00
test_import_album_match_endpoint.py
test_import_singles_parallel.py
test_integrity_failure_marks_task_failed.py
test_lb_series_detect.py Roll LB Weekly / Top series into single rolling mirrors (Phase 1c.2.1) 2026-05-26 15:49:49 -07:00
test_library_disk_usage.py Repair stale media schema during refresh 2026-05-21 17:41:54 -07:00
test_library_reorganize.py
test_library_reorganize_orchestrator.py Reorganize: skip files in the duplicate-cleaner /deleted quarantine (#746) 2026-05-30 00:15:06 -07:00
test_library_tag_payload.py Add _build_library_tag_db_data helper 2026-05-25 18:48:45 -07:00
test_library_track_identity.py
test_lidarr_download_client.py
test_listenbrainz_manager.py Auto-Sync: fix LB pipelines stuck on "Refreshing:" for 5+ minutes 2026-05-27 18:04:55 -07:00
test_listening_stats_batch_queries.py
test_lyrics_reembed_from_sidecar.py
test_manual_library_match.py Manual library match: accept non-numeric library track ids (#754) 2026-05-31 09:11:46 -07:00
test_manual_pick_no_auto_retry.py Add torrent and usenet release staging support 2026-05-21 14:22:21 -07:00
test_manual_search_endpoint.py
test_matching_engine_cjk.py Fix: duplicate tracks in albums with Japanese / CJK titles (#722) 2026-05-28 08:53:43 -07:00
test_metadata_cache_table_recreate.py Fix: metadata cache tables silently missing after DB recovery (stale migration marker) 2026-05-31 23:27:14 -07:00
test_missing_cover_art.py
test_orphan_file_detector.py Fix Picard albumartist orphan false positives 2026-05-22 08:43:57 -07:00
test_personalized_api.py Personalized playlists (3/N): standardized API endpoints 2026-05-15 17:15:25 -07:00
test_personalized_generators_curated.py Personalized playlists (2/N): all 8 generators wired through manager 2026-05-15 17:02:08 -07:00
test_personalized_generators_singletons.py Personalized playlists (2/N): all 8 generators wired through manager 2026-05-15 17:02:08 -07:00
test_personalized_generators_variants.py Personalized playlists (2/N): all 8 generators wired through manager 2026-05-15 17:02:08 -07:00
test_personalized_manager.py Personalized pipeline: auto-refresh stale snapshots after watchlist scan 2026-05-15 20:53:03 -07:00
test_personalized_playlists_id_gate.py
test_playlist_sources_adapters.py Auto-Sync: fix LB pipelines stuck on "Refreshing:" for 5+ minutes 2026-05-27 18:04:55 -07:00
test_provenance_id_persistence.py
test_prowlarr_client.py test: cover Prowlarr + torrent + usenet adapters 2026-05-20 15:43:18 -07:00
test_qobuz_credential_sync.py
test_qobuz_playlists.py Fetch all Qobuz favorite tracks for discovery 2026-05-24 01:17:38 -07:00
test_reorganize_db_methods.py
test_reorganize_deleted_quarantine.py Reorganize: skip files in the duplicate-cleaner /deleted quarantine (#746) 2026-05-30 00:15:06 -07:00
test_reorganize_orphan_format_handling.py
test_reorganize_queue.py
test_reorganize_runner.py
test_reorganize_tag_source.py Reorganize: optional embedded-tag mode (closes #592) 2026-05-15 07:56:18 -07:00
test_reorganize_unknown_artist_hint.py
test_repair_worker_album_fill.py fix(album-completeness): block cross-artist auto-fill 2026-05-21 16:49:12 -07:00
test_repair_worker_unresolvable_folder_error.py
test_replaygain_summary_parse.py
test_request_cleanup_timer.py
test_runtime_state.py
test_script_split_integrity.py Add node:test contract for auto-sync.js helpers 2026-05-25 00:01:34 -07:00
test_server_playlist_append_mode.py
test_socketio_cors.py
test_soulseek_album_fallback.py Album bundle: fall back to per-track when the chosen folder yields nothing 2026-05-29 19:46:52 -07:00
test_soulseek_album_poll_stall.py Soulseek album poll: treat 'Aborted'/'Cancelled' transfers as failed 2026-05-29 19:29:55 -07:00
test_soulseek_search_throttle.py
test_soundcloud_client.py
test_source_ids_registry.py Source IDs: add canonical registry, adopt at the highest-value sites 2026-05-29 12:19:59 -07:00
test_spa_deep_linking.py feat: artist-detail deep linking — /artist-detail/:source/:id 2026-05-18 13:07:54 -07:00
test_staging_album_provenance.py refactor(staging): inject batch-field accessor instead of importing runtime_state 2026-05-20 20:43:35 -07:00
test_stats_automations_esc_js.py Fix: mirrored playlist action buttons dead when name has an apostrophe 2026-06-01 09:02:25 -07:00
test_status_engine_fallback.py
test_sync_discovery_scan_events.py
test_tag_writer_multi_artist.py
test_tidal_album_tracks.py
test_tidal_auth_instructions.py
test_tidal_auth_redirect_uri.py
test_tidal_collection_tracks.py
test_tidal_favorite_albums_artists.py
test_tidal_qualifier_filter.py
test_tidal_search_shortening.py
test_tool_progress_events.py
test_torrent_client_adapters.py test: cover Prowlarr + torrent + usenet adapters 2026-05-20 15:43:18 -07:00
test_torrent_usenet_plugins.py Fix: torrent/usenet album bundle hard-fails on 'no results' instead of falling back 2026-06-01 09:55:59 -07:00
test_track_artist_matching.py
test_track_number_repair.py
test_track_search_single_query.py
test_unknown_artist_fixer.py fix(repair): rewire Unknown Artist Fixer deferred imports (#646) 2026-05-19 22:09:15 -07:00
test_usenet_client_adapters.py Fix: Usenet bundle stuck at 99%/100% — SAB reports post-processing in History as non-terminal (#721) 2026-05-29 00:49:02 -04:00
test_watchlist_album_match.py
test_watchlist_bulk_add.py Complete MusicBrainz watchlist source parity 2026-05-18 19:19:25 -07:00
test_watchlist_scanner_scan.py
test_websocket_client_transport.py
test_websocket_infrastructure.py
test_wishlist_pagination.py
test_worker_existing_id_marks_matched.py
test_worker_utils_album_track_count.py Repair stale media schema during refresh 2026-05-21 17:41:54 -07:00
test_youtube_ffmpeg_no_eager_download.py
test_youtube_search_dash_query.py Escape dash-leading YouTube search queries 2026-05-24 08:54:47 -07:00