fix(worker): reject a download with 0-byte/missing tracks (#16 partial)
Completeness only compared the adapter's self-reported track_count to expected, so a silently-skipped track (0-byte placeholder — see the Qobuz 24K Magic bug) imported as a "complete" album. Now the verify also counts the NON-EMPTY audio actually staged and fails "incomplete download" when fewer than expected are present (guarded with `staged and ...` so fake adapters that stage nothing keep using the count path). A real broken download now goes needs_attention (or falls through to another source) instead of importing a dead track. Full per-track duration matching against MB recording lengths (the rest of #16) remains a larger follow-up. worker 224 tests / 7-skip. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -310,7 +310,11 @@ def run_pipeline(
|
||||
# 5. verify completeness on the staging copy, then promote + tag
|
||||
_set_state(conn, job_id, "tagging", "tag")
|
||||
expected = target.track_count if target.track_count is not None else winner.track_count
|
||||
if result.track_count < expected:
|
||||
# Also count the NON-EMPTY audio actually on disk: a silently-skipped track leaves a
|
||||
# 0-byte placeholder that the adapter still counts, so trust the files when any are
|
||||
# staged. (`staged and ...` keeps fake adapters that stage nothing on the count path.)
|
||||
staged = _count_staged_audio(staging)
|
||||
if result.track_count < expected or (staged and staged < expected):
|
||||
_fail(conn, job_id, "incomplete download")
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user