feat(pm): add phase timings and install summary#2813
Merged
Conversation
Surface the clean/validate step in the progress bar so the clone phase doesn't appear frozen on large trees, append elapsed time to each ✓ line (resolve / cloned / scripts), and print a two-line summary at the end of install: + 513 added · 3017 reused timing resolve 0.2s link 2.6s scripts 3.2s total 6.0s Track fresh vs reused clones via a shared CloneStats snapshot in cloner, diffed against a baseline taken at install entry so nested installs (e.g. global install) report their own delta. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances the package installation process by adding detailed timing and statistics tracking. It introduces the ability to measure the duration of key phases such as dependency resolution, package linking, and script execution, while also tracking the counts of freshly cloned versus reused packages. A new installation summary is printed upon completion to provide users with these performance metrics. I have no feedback to provide.
Each ✓ line already shows its phase elapsed time, so the trailing `timing resolve … link … scripts … total …` line was duplicating that info. Keep only the counts line: + 513 added · 3017 reused Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a third counter alongside added/reused so CI output stays meaningful even when node_modules/ is always fresh (everything is "added") but the tarball cache is persisted across runs. + 513 added · 3017 reused · 123 downloaded - added: node_modules/ dirs freshly materialized - reused: node_modules/ dirs already valid, kept as-is - downloaded: tarballs fetched from the registry this run downloaded is tracked at the download_to_cache OnceMap closure, so each unique name@version counts at most once. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ensure_package_lock is a lock-loading helper, not a UI layer — it shouldn't own progress-bar lifecycle. Move start/finish into the one caller that was relying on it (cmd::rebuild) and timestamp the phase there, matching cmd::deps. Also fill in the elapsed-time suffix for the `ut deps` command, which was previously passing `None`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous reuse_count tracked "node_modules/<pkg> was already valid and skipped", which is not what pnpm users expect under "reused" — pnpm uses reused for "tarball served from local cache, no network". Drop the node_modules-reuse counter and redefine the three counts to match pnpm: + 513 added · 3017 reused · 123 downloaded - added: linked into node_modules/ this run - reused: tarball served from local cache (no network) - downloaded: tarball fetched from the registry Simplifies cloner.rs: clone_package still returns bool but only to tell clone_package_once whether to bump CLONE_COUNT; there is no paired REUSE_COUNT anymore. Tarball counters now live in downloader.rs alongside the OnceMap they key off of. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
xusd320
approved these changes
Apr 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses two UX gaps reported during dependency install:
clean_depsfirst (validates & prunes stalenode_modules), during whichposdoesn't advance and the bar looks frozen on large trees. Now the spinner message readsvalidating node_modules→linking packagesso the user sees which phase is active.[elapsed], and a two-line summary prints at the end of install:Implementation notes
cloner::clone_packagenow returnsResult<bool>(true = freshly materialized, false = valid existing dst reused). Outcomes are accumulated into two process-global atomics exposed via aCloneStatssnapshot +Subimpl.InstallService::install()snapshotsclone_stats()at entry and prints the delta; this keeps nested installs (global install flows) reporting only their own work.finish_progress_barnow takesOption<Duration>— one function instead of two + a trampoline.format_elapsed_timeis built on a new sharedfmt_durationcore.Test plan
cargo fmtcargo clippy -p utoo-pm --all-targets -- -D warnings --no-depscargo test -p utoo-pm --bin utoo(cloner/install/logger tests all green)