Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(library): atomic media import and net downgrade savings (#206, #207) (#213)

2 months ago

a09a3f0
Authored
Davy7/25/2026, 6:10:55 PM
#206: Song import copied media straight to the final content-addressed
path guarded only by existence, so a crash/ENOSPC/cancel mid-copy left a
truncated file that a later re-import silently accepted as complete. Route
both the primary media copy and the Media+G copy_if_missing path through a
new import_media_file: trust an existing destination only when its size
matches the source, otherwise copy to a uniquely named sibling temp file,
fsync, and atomically rename into place, cleaning up the temp on any error.
This mirrors StreamingOggWriter and the model download promotion.

#207: Downgrade disk-savings figures summed only the deleted drums+bass+
other bytes and ignored the accompaniment.ogg written in their place,
over-reporting by roughly one stem. downgrade_to_two_stem now returns the
deleted bytes minus the actual accompaniment size; estimate_downgrade_savings
nets out the existing vocals stem as a same-encoding proxy.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

Parent6ecbdfa

4 files changed
  • src-tauri/src/cache/stems.rs+24−3
  • src-tauri/src/library/import/ingest.rs+257−23
  • src-tauri/tests/phase1_import.rs+47−0
  • src-tauri/tests/phase3_stems_cache.rs+103−0