Files
musicdl-catalog-sync-suite/catalog-sync/docs/superpowers/plans/2026-04-19-download-runner-dashboard-fixes.md

2.1 KiB

Download Runner And Dashboard Fixes Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Fix catalog-sync so download jobs start promptly on NAS and dashboard download speed only reflects truly active download workers.

Architecture: Tighten dashboard worker selection to current running items only, and remove the pre-worker playlist export refresh that can block a download stage before any download worker starts. Keep playlist export behavior during item completion and stage finalization.

Tech Stack: Python, sqlite3, unittest, FastAPI ops dashboard


Task 1: Lock The Regression With Tests

Files:

  • Modify: tests/catalogsync/test_ops_api.py

  • Modify: tests/catalogsync/test_ops_runner.py

  • Add a dashboard API regression test that seeds one real running download worker plus stale historical workers and expects transfer speed to only include the live worker.

  • Add a runner regression test that keeps a stage open with pending downloads and expects already-completed playlist exports not to run before pending download workers start.

  • Run targeted tests first and confirm they fail for the expected reason.

Task 2: Apply The Minimal Fix

Files:

  • Modify: musicdl/catalogsync/ops/web.py

  • Modify: musicdl/catalogsync/ops/runner.py

  • Restrict dashboard worker rows to workers whose current job item is still running under an active job.

  • Remove the pre-worker playlist artifact refresh from download stage startup so worker claiming is not blocked by export work.

  • Keep existing per-playlist export on item completion and full export refresh on stage completion.

Task 3: Verify The Fix

Files:

  • Modify: tests/catalogsync/test_ops_api.py

  • Modify: tests/catalogsync/test_ops_runner.py

  • Run the focused regression tests and confirm they pass.

  • Run a slightly wider ops test slice to catch nearby regressions.