soulsync/core/downloads
Broque Thomas a685f9ca4a diag: log every cancel_download caller with a trigger label
Diagnostic-only change for issue Technodude reported: Tidal sync-playlist
downloads getting mass-cancelled mid-flight with no clear cause in the
logs. App.log shows ~91 second gaps between Tidal download start and
cancel — matches the monitor's 90s queue-timeout exactly — but none of
the monitor's WARNING log lines fire, so the trigger is ambiguous
between five `_should_retry_task` paths, three web_server cancel paths,
and the API endpoints.

Added a single `[CancelTrigger:<label>]` INFO log line immediately
before every `download_orchestrator.cancel_download(...)` call so the
next log dump pins down which path is firing.

Labels (grep-able, prefix tells the file, suffix tells the trigger):

  monitor.not_in_live_transfers_90s
  monitor.errored_state_retry
  monitor.queued_state_timeout
  monitor.stuck_at_0pct_timeout
  monitor.unknown_state_no_progress_timeout
  candidates.worker_cancelled_during_download
  web.orphan_cleanup
  web.cancel_download_task
  web.atomic_cancel_v2
  api.manual_cancel_single
  api.public_cancel

The monitor's `deferred_ops` tuple grew from 3 elements to 4 (added
trigger label as last element). The dispatch loop unpacks both legacy
and new shapes so the change is backward-compatible for any in-flight
ops mid-deploy.

Zero behavior change. 367 download tests still green. WHATS_NEW left
untouched — diagnostic only, not user-facing.

After ship: ask Technodude to re-run the same sync playlist scenario,
attach the new app.log, grep `[CancelTrigger:` lines for the trigger
context, then write the actual fix.
2026-05-19 22:31:29 -07:00
..
__init__.py PR4a: lift sync history recording to core/downloads/history.py 2026-04-27 20:37:16 -07:00
cancel.py diag: log every cancel_download caller with a trigger label 2026-05-19 22:31:29 -07:00
candidates.py diag: log every cancel_download caller with a trigger label 2026-05-19 22:31:29 -07:00
cleanup.py PR4c: lift _automatic_wishlist_cleanup_after_db_update to core/downloads/cleanup.py 2026-04-27 22:23:41 -07:00
history.py PR4a: lift sync history recording to core/downloads/history.py 2026-04-27 20:37:16 -07:00
lifecycle.py Surface silent exceptions across remaining modules — ~70 sites 2026-05-07 10:28:58 -07:00
master.py Honor manual library matches across source labels 2026-05-18 16:32:38 -07:00
monitor.py diag: log every cancel_download caller with a trigger label 2026-05-19 22:31:29 -07:00
post_processing.py Cin-6: Rename soulseek_client global → download_orchestrator 2026-05-04 23:23:32 -07:00
staging.py Lift _try_staging_match to core/downloads/staging.py 2026-04-28 23:26:15 -07:00
status.py Harden quarantine approval flows 2026-05-18 08:37:11 -07:00
task_worker.py fix(amazon): wire amazon into all streaming-source guards 2026-05-16 10:24:13 -07:00
validation.py fix(amazon): wire amazon into all streaming-source guards 2026-05-16 10:24:13 -07:00
wishlist_failed.py Surface silent exceptions across remaining modules — ~70 sites 2026-05-07 10:28:58 -07:00