Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions crates/pm/src/service/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ async fn handle_cypress(
}

pub async fn update_package_binary(dir: &Path, name: &str) -> Result<()> {
if should_skip_binary_mirror() {
return Ok(());
}

let config = load_config().await?;

let mirrors = config["mirrors"]["china"]
Expand Down
5 changes: 4 additions & 1 deletion crates/pm/src/service/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ pub async fn clean_deps(groups: &HashMap<usize, Vec<(String, Package)>>, cwd: &P
.flat_map(|pkgs| pkgs.iter().map(|(path, _)| path.clone()))
.collect();

tracing::debug!("Valid packages: {valid_packages:?}");
tracing::debug!(
count = valid_packages.len(),
"Collected valid package paths"
);

let mut nm_dirs = vec![cwd.join("node_modules")];
for (_, ws_path, _) in workspace::find_workspaces(cwd).await? {
Expand Down
15 changes: 12 additions & 3 deletions crates/pm/src/service/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl PackageService {

// Binary linking queue - always process if package has bin files
if !package.bin_files.is_empty() {
tracing::debug!("Adding {} to bin linking queue", package.path.display());
tracing::trace!("Adding {} to bin linking queue", package.path.display());
queues.bin_linking.push((Rc::clone(&package), is_optional));
}
}
Expand Down Expand Up @@ -281,9 +281,12 @@ impl PackageService {
/// Queue contains (PackageInfo, is_optional) tuples - is_optional is not used here
/// as binary linking happens only for successfully installed packages
async fn execute_binary_linking(queue: &[(Rc<PackageInfo>, bool)]) -> Result<()> {
let mut linked_packages = 0usize;
let mut linked_bins = 0usize;
for (package, _is_optional) in queue {
if !package.bin_files.is_empty() {
tracing::debug!("Linking binary files for {}", package.name);
tracing::trace!("Linking binary files for {}", package.name);
linked_packages += 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The linked_packages counter is incremented for every package that has a non-empty bin_files list, regardless of whether any of those binaries are actually linked successfully. If all binaries for a package are skipped (e.g., because they don't exist on disk at line 292), the summary log at the end will still count this as a linked package. Consider incrementing this counter only if at least one binary was successfully processed for the package.

for (bin_name, relative_path) in &package.bin_files {
let target_path = package.path.join(relative_path);
if !crate::fs::try_exists(&target_path).await? {
Expand Down Expand Up @@ -319,10 +322,16 @@ impl PackageService {
link_path.display()
)
})?;
linked_bins += 1;
}
tracing::debug!("Linking binary files for {} successfully", package.name);
tracing::trace!("Linking binary files for {} successfully", package.name);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This trace log message is emitted even if no binaries were actually linked for the package (e.g., if all entries in bin_files were skipped due to missing files). This can be misleading when debugging. It would be better to only log this if at least one binary was successfully linked.

}
}
tracing::debug!(
packages = linked_packages,
bins = linked_bins,
"Binary linking completed"
);
Ok(())
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/pm/src/util/cloner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub async fn clone_package_once(

if fresh {
CLONE_COUNT.fetch_add(1, Ordering::Relaxed);
tracing::debug!("Cloned: {}@{} to {}", name, version, target_path.display());
tracing::trace!("Cloned: {}@{} to {}", name, version, target_path.display());
}
Some(())
})
Expand Down Expand Up @@ -406,7 +406,7 @@ async fn clone(src: &Path, dst: &Path, find_real: bool) -> Result<()> {
Retry::spawn(create_retry_strategy(), || async {
match unsafe { clonefile(src_c.as_ptr(), dst_c.as_ptr(), 0) } {
0 => {
tracing::debug!("clone {} to {} success", real_src.display(), dst.display());
tracing::trace!("clone {} to {} success", real_src.display(), dst.display());
Ok(())
}
_ => {
Expand All @@ -431,7 +431,7 @@ async fn clone(src: &Path, dst: &Path, find_real: bool) -> Result<()> {
{
Retry::spawn(create_retry_strategy(), || async {
hardlink_clone::clone_dir(&real_src, dst).await?;
tracing::debug!("clone {} to {} success", real_src.display(), dst.display());
tracing::trace!("clone {} to {} success", real_src.display(), dst.display());
Ok::<(), anyhow::Error>(())
})
.await?;
Expand Down
10 changes: 5 additions & 5 deletions crates/pm/src/util/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub async fn git_cache_lookup(name: &str, version: &str, tarball_url: &str) -> O
.await
.unwrap_or(false)
{
tracing::debug!("Git package cache hit: {}@{}", name, version);
tracing::trace!("Git package cache hit: {}@{}", name, version);
return Some(cache_path);
}
tracing::warn!(
Expand Down Expand Up @@ -118,7 +118,7 @@ pub async fn file_cache_lookup(name: &str, tarball_url: &str) -> Option<PathBuf>
let abs_path = tarball_url.strip_prefix("file:")?;
let hit = slot_cache_lookup(name, file_cache_slot(std::path::Path::new(abs_path))).await;
if hit.is_some() {
tracing::debug!("file: dep cache hit: {} ({})", name, tarball_url);
tracing::trace!("file: dep cache hit: {} ({})", name, tarball_url);
}
hit
}
Expand All @@ -127,7 +127,7 @@ pub async fn file_cache_lookup(name: &str, tarball_url: &str) -> Option<PathBuf>
pub async fn http_tarball_cache_lookup(name: &str, tarball_url: &str) -> Option<PathBuf> {
let hit = slot_cache_lookup(name, http_cache_slot(tarball_url)).await;
if hit.is_some() {
tracing::debug!("HTTP tarball cache hit: {} ({})", name, tarball_url);
tracing::trace!("HTTP tarball cache hit: {} ({})", name, tarball_url);
}
hit
}
Expand Down Expand Up @@ -173,7 +173,7 @@ pub async fn download_to_cache(name: &str, version: &str, tarball_url: &str) ->
.unwrap_or(false)
{
REUSE_COUNT.fetch_add(1, Ordering::Relaxed);
tracing::debug!("Cache hit: {}@{}", name, version);
tracing::trace!("Cache hit: {}@{}", name, version);
return Some(cache_path);
}

Expand All @@ -193,7 +193,7 @@ pub async fn download_to_cache(name: &str, version: &str, tarball_url: &str) ->
.ok()?;

DOWNLOAD_COUNT.fetch_add(1, Ordering::Relaxed);
tracing::debug!("Downloaded: {}@{}", name, version);
tracing::trace!("Downloaded: {}@{}", name, version);
Some(cache_path)
})
.await
Expand Down
Loading