feat: download to staging + atomically promote complete album into the library
Rewrite run_pipeline's download->import section to download into a per-job staging dir (cleared before each candidate), verify completeness there, promote only a complete album into the library via import_album, tag the final dir, then DB-import. The staging dir is always removed in a try/finally, so a partial/failed download never touches or corrupts the library, and a retry can no longer leave orphan files behind. Also point test_upgrade_e2e.py's run_pipeline call at dest_root="/tmp/lib" (matching every other pipeline test) since import_album now unconditionally creates the final dir, which requires a writable dest_root.
This commit is contained in:
@@ -87,7 +87,7 @@ def test_below_cutoff_copy_is_upgraded_end_to_end(conn):
|
||||
assert job_id is not None
|
||||
|
||||
# upgrade_cutoff=2 so intake does NOT short-circuit on the existing quality-1 copy.
|
||||
run_pipeline(conn, job_id, [QobuzAdapter(FakeQobuzClient())], upgrade_cutoff=2)
|
||||
run_pipeline(conn, job_id, [QobuzAdapter(FakeQobuzClient())], upgrade_cutoff=2, dest_root="/tmp/lib")
|
||||
|
||||
assert _job_state(conn, job_id) == "imported"
|
||||
path, quality, source = _library_row(conn, "John Mayer", "Continuum")
|
||||
|
||||
Reference in New Issue
Block a user