From 33caa8a57cdf8d5402bde2ecb922471caa64e4a9 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Thu, 8 Oct 2026 19:37:44 -0400 Subject: [PATCH] Epic assembler: free a file's chunks before reporting the file done The host tests caught the order: onProgress fired while the chunk only that file used was still on disk. A progress event now means the file is written, verified and its chunks released. --- app/src/main/rust/stores/src/epic/assemble.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/main/rust/stores/src/epic/assemble.rs b/app/src/main/rust/stores/src/epic/assemble.rs index 6da365a9c..93cb8629d 100644 --- a/app/src/main/rust/stores/src/epic/assemble.rs +++ b/app/src/main/rust/stores/src/epic/assemble.rs @@ -269,15 +269,9 @@ pub fn run_assemble( return outcome; } } - outcome.files_done += 1; - progress( - outcome.bytes_written, - plan.bytes_total, - outcome.files_done, - files_total, - ); // Scratch cache: this file was the last user of a chunk → the chunk goes now, not at the - // end, so the cache holds only what is still owed to files not yet written. + // end, so the cache holds only what is still owed to files not yet written. Released + // before the progress event, so "file done" also means "its chunks are freed". if plan.scratch_cache { for guid in distinct_guids(f) { let Some(count) = refs.get_mut(&guid) else { @@ -292,6 +286,13 @@ pub fn run_assemble( } } } + outcome.files_done += 1; + progress( + outcome.bytes_written, + plan.bytes_total, + outcome.files_done, + files_total, + ); } outcome.success = true;