Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions crates/fbuild-packages-fetch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,17 +364,25 @@ impl PackageBase {
fbuild_core::FbuildError::PackageError(format!("failed to create staging dir: {}", e))
})?;

// Download
install_status::publish_install_status(install_status::status(
&self.name,
Some(&self.version),
InstallPhase::Downloading,
InstallRole::Installer,
format!("downloading {} {}", self.name, self.version),
None::<String>,
));
// Download with progress reporting
tracing::info!("downloading {} v{}", self.name, self.version);
let archive_path = downloader::download_file(&self.url, &staging_path).await?;
let name = self.name.clone();
let version = self.version.clone();
let archive_path = downloader::download_file_with_progress(
&self.url,
&staging_path,
&mut |progress: &downloader::DownloadProgress| {
install_status::publish_install_status(install_status::status(
&name,
Some(&version),
InstallPhase::Downloading,
InstallRole::Installer,
progress.format_message(),
Comment on lines +374 to +380

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep forwarded download progress monotonic across retries.

download_file_with_progress_timed resets downloaded and last_pct for each retry. If one attempt publishes 50/150 MB (33%) and then retries, this callback can publish a lower value such as 10/150 MB (6%). The daemon and CLI will show progress moving backward. Publish retry-aware progress or suppress lower values before forwarding them to install_status.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/fbuild-packages-fetch/src/lib.rs` around lines 374 - 380, Update the
progress callback around download_file_with_progress_timed so forwarded progress
remains monotonic across retries. Track the highest published progress and
either adjust retry progress to preserve it or suppress values lower than the
previous value before calling install_status::publish_install_status; retain
normal progress updates when they are not regressive.

None::<String>,
));
},
)
.await?;

// Verify checksum
if let Some(ref expected) = self.checksum {
Expand Down
Loading