From 7c6c1a3bd4a929ce7b6a0fb6bc8c875ec37fbdc1 Mon Sep 17 00:00:00 2001 From: Andrew Dunn Date: Fri, 13 Mar 2026 17:11:34 -0400 Subject: [PATCH] deploy: fix progress bar math for containers-storage transport When pulling from containers-storage, layers are stored uncompressed but the progress bar total was set from the manifest descriptor size (compressed). This caused the display to show transferred exceeding total, e.g. '2.66 GiB/1.14 GiB'. Update the byte progress bar length from LayerProgress.total on each update, which reflects the actual blob size for the transport. Also use the bar's actual length for completion accounting so that total_read and subtask bytes are consistent. This matches how ostree-ext's CLI handles the same progress (cli.rs). For registry pulls, LayerProgress.total equals the manifest descriptor size, so this is a no-op in that case. Closes: #2001 Signed-off-by: Andrew Dunn --- crates/lib/src/deploy.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/lib/src/deploy.rs b/crates/lib/src/deploy.rs index 8684c334d..acd8f8198 100644 --- a/crates/lib/src/deploy.rs +++ b/crates/lib/src/deploy.rs @@ -234,11 +234,15 @@ async fn handle_layer_progress_print(mut config: LayerProgressConfig) -> Progres bytes_total: layer_size, }; } else { - byte_bar.set_position(layer_size); + // Use the bar's length (actual blob size) rather than + // the manifest descriptor size for completion accounting. + let actual_size = byte_bar.length().unwrap_or(layer_size); + byte_bar.set_position(actual_size); layers_bar.inc(1); - total_read = total_read.saturating_add(layer_size); + total_read = total_read.saturating_add(actual_size); // Emit an event where bytes == total to signal completion. - subtask.bytes = layer_size; + subtask.bytes_total = actual_size; + subtask.bytes = actual_size; subtasks.push(subtask.clone()); config.prog.send(Event::ProgressBytes { task: "pulling".into(), @@ -268,7 +272,12 @@ async fn handle_layer_progress_print(mut config: LayerProgressConfig) -> Progres bytes.as_ref().cloned() }; if let Some(bytes) = bytes { + // Update the bar length from the actual blob size, which + // may differ from the manifest descriptor size (e.g. + // containers-storage stores layers uncompressed). + byte_bar.set_length(bytes.total); byte_bar.set_position(bytes.fetched); + subtask.bytes_total = bytes.total; subtask.bytes = byte_bar.position(); config.prog.send_lossy(Event::ProgressBytes { task: "pulling".into(),