Skip to content

fix(lockfile): round-trip the lockfile's time section - #13787

Merged
zkochan merged 3 commits into
mainfrom
fix-13776
Aug 10, 2026
Merged

zkochan merged 3 commits into
mainfrom
fix-13776

Conversation

@zkochan

@zkochan zkochan commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Summary

pacquet's Lockfile struct had no time field, so serde discarded the section on load and never wrote it back. Any pnpm-lock.yaml carrying the publish dates a resolutionMode: time-based install records lost them the first time pacquet rewrote it.

That is not only lockfile churn. In the TypeScript CLI, getPublishedByDate builds each direct dependency's publish date from the resolver's publishedAt and falls back to the lockfile's time entry when the registry's abbreviated metadata carries none. The newest of those dates (plus an hour) is the cutoff every subdependency is resolved under, so dropping the section can make a later time-based resolution pick different subdependency versions.

This PR:

  • adds time: Option<BTreeMap<String, String>> to Lockfile, so the section round-trips;
  • fills it from the time-based pre-pass — the prior lockfile's entries with this run's freshly resolved publish dates layered over them, matching upstream's {...wantedLockfile.time, ...time};
  • prunes it to the importers' direct dependencies on save, a port of pruneTimeInLockfile (peer suffix stripped, link: deps contribute nothing, npm aliases match their target's depPath);
  • reads it back in compute_time_based_cutoff as the fallback publish date for a direct dependency whose packument carries none.

The prune runs where pnpm's normalizeLockfile runs — on the serialized document, on the way to disk — so it covers every write path (fresh resolve, the fast lockfile update, the current lockfile under node_modules/.pnpm, and an afterAllResolved result) rather than one lockfile-building site. It also runs ahead of the verification cache's content hash, so an in-memory lockfile still hashes to what it will hash to once saved and read back.

The pnpr-assisted install path needs nothing of its own: the server resolves through the same fresh-lockfile pipeline, so the input lockfile's recorded dates already reach its answer. An end-to-end test against an in-process pnpr pins that.

This is a pacquet-only fix — the TypeScript CLI already models, writes, prunes, and reads the section. No TypeScript changes are needed for parity.

Closes #13776

Squash Commit Body

pacquet's `Lockfile` had no `time` field, so serde discarded the section
on load and never wrote it back: a `pnpm-lock.yaml` carrying the publish
dates a `resolutionMode: time-based` install records lost them the first
time pacquet rewrote it.

Model the section, fill it from the `time-based` pre-pass (the prior
lockfile's entries with this run's freshly resolved ones layered over
them), prune it to the importers' direct dependencies on save the way
`pruneTimeInLockfile` does, and read it back as the fallback publish date
for a direct dependency whose packument carries none — so against a
registry whose abbreviated metadata omits publish times, a later
resolution derives the cutoff the lockfile was written under rather than
a different one.

The prune runs on the serialized document, where pnpm's
`normalizeLockfile` runs, so every write path is covered: the fresh
resolve, the fast lockfile update, the current lockfile under
`node_modules/.pnpm`, and an `afterAllResolved` result. It also runs
ahead of the verification cache's content hash, so an in-memory lockfile
still hashes to what it will hash to once saved and read back.

Closes pnpm/pnpm#13776

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-5).

pacquet's `Lockfile` had no `time` field, so serde discarded the section
on load and never wrote it back: a `pnpm-lock.yaml` carrying the publish
dates a `resolutionMode: time-based` install records lost them the first
time pacquet rewrote it.

Model the section, fill it from the `time-based` pre-pass (the prior
lockfile's entries with this run's freshly resolved ones layered over
them), prune it to the importers' direct dependencies on save the way
`pruneTimeInLockfile` does, and read it back as the fallback publish date
for a direct dependency whose packument carries none — so against a
registry whose abbreviated metadata omits publish times, a later
resolution derives the cutoff the lockfile was written under rather than
a different one.

The write-time prune also runs ahead of the verification cache's content
hash, so an in-memory lockfile still hashes to what it will hash to once
saved and read back.

Closes #13776
Copilot AI lite review requested due to automatic review settings August 10, 2026 20:30

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix lockfile time section round-tripping for time-based installs

🐞 Bug fix 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Preserve pnpm-lock.yaml time: section by modeling it in Lockfile.
• Normalize/prune time: on save and before hashing to match pnpm behavior.
• Use recorded time: as publish-date fallback to keep time-based cutoffs stable.
Diagram

graph TD
  A["Install flow"] --> B["Resolve workspace"] --> C["Compute time cutoff"] --> D[("recorded/resolved time map")] --> E["Build Lockfile"] --> F["Normalize on write (prune_time)"] --> G[("pnpm-lock.yaml")]
  F --> H["Lockfile hash (verification)"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Prune `time` at the typed model layer (before serialization)
  • ➕ Avoids serde_json::Value mutation and relies purely on Rust types
  • ➕ Easier to reason about invariants at compile time
  • ➖ Harder to guarantee coverage across every write path and intermediate representation
  • ➖ Would need explicit wiring in multiple save/call sites (risking regressions)
2. Keep full `time` map (no pruning) for maximum fidelity
  • ➕ Simplest behavior: never drop recorded publish dates
  • ➕ Avoids depPath resolution edge cases (peers/aliases/link:)
  • ➖ Section can grow to one entry per transitive package (lockfile bloat/churn)
  • ➖ Diverges from pnpm normalization expectations

Recommendation: Keep the PR’s approach: model Lockfile.time, merge prior + resolved values, and apply pnpm-equivalent pruning during serialization (and hashing). This best matches upstream behavior while ensuring every save path and the verification hash observe the same normalized content.

Files changed (28) +542 / -44

Enhancement (1) +55 / -0
prune_time.rsImplement pnpm-equivalent 'time:' pruning normalization +55/-0

Implement pnpm-equivalent 'time:' pruning normalization

• Adds 'prune_time(document: &mut Value)' to remove 'time:' entries not corresponding to importers’ direct dependencies, handling peer suffix stripping, npm aliases, and excluding 'link:' deps.

pnpm/crates/lockfile/src/prune_time.rs

Bug fix (8) +114 / -18
install.rsPreserve prior 'time:' for pnpr-assisted installs +7/-0

Preserve prior 'time:' for pnpr-assisted installs

• When installing via pnpr (server-side resolution), reuses the previous wanted lockfile’s 'time' section if the outcome has none. This prevents pnpr runs from implicitly deleting recorded publish dates.

pnpm/crates/cli/src/cli_args/install.rs

current_lockfile.rsCarry 'time' through current lockfile derivations +2/-0

Carry 'time' through current lockfile derivations

• Ensures 'materialization_closure' and related helpers propagate 'Lockfile.time' when building derived lockfile views.

pnpm/crates/deps-restorer/src/current_lockfile.rs

hash_lockfile.rsHash normalized lockfile content (including pruned 'time') +7/-1

Hash normalized lockfile content (including pruned 'time')

• Runs 'pacquet_lockfile::prune_time' before normalization and hashing so the in-memory lockfile hashes exactly as it will after being saved and re-read.

pnpm/crates/lockfile-verification/src/hash_lockfile.rs

lib.rsAdd 'Lockfile.time' field and export pruning module +13/-0

Add 'Lockfile.time' field and export pruning module

• Introduces 'time: Option<BTreeMap<String, String>>' on 'Lockfile' to round-trip 'time:' from YAML. Adds and exports the new 'prune_time' module.

pnpm/crates/lockfile/src/lib.rs

serialize_yaml.rsNormalize lockfile document before YAML rendering +11/-3

Normalize lockfile document before YAML rendering

• Changes YAML serialization to first convert to 'serde_json::Value', run 'prune_time', then render, matching pnpm’s on-write normalization behavior.

pnpm/crates/lockfile/src/serialize_yaml.rs

dependencies_graph_to_lockfile.rsThread 'time' map into lockfile generation +7/-0

Thread 'time' map into lockfile generation

• Extends 'GraphToLockfileOptions' with a 'time' map and writes it into 'Lockfile.time' when non-empty, enabling the lockfile builder to persist time-based publish dates.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs

install_with_fresh_lockfile.rsMerge prior recorded 'time' with newly resolved publish dates +27/-1

Merge prior recorded 'time' with newly resolved publish dates

• Plumbs 'resolved_time' from workspace resolution into fresh lockfile building, and merges it over the previous lockfile’s 'time' entries so missing packument timestamps can still fall back to recorded values.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs

resolve_workspace.rsCompute time-based cutoff with lockfile fallback and return 'time' map +40/-13

Compute time-based cutoff with lockfile fallback and return 'time' map

• Changes the time-based pre-pass to return both the cutoff and a 'time' map for direct deps. Falls back to 'wanted_lockfile.time' when registry metadata omits publish timestamps.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs

Refactor (1) +5 / -6
yaml_emit.rsMake YAML emitter accept already-normalized 'Value' +5/-6

Make YAML emitter accept already-normalized 'Value'

• Refactors 'yaml_emit::to_string' to accept a pre-normalized 'serde_json::Value' and return 'String' directly, separating normalization from byte rendering.

pnpm/crates/lockfile/src/yaml_emit.rs

Tests (17) +363 / -20
tests.rsUpdate Lockfile test helpers for new 'time' field +1/-0

Update Lockfile test helpers for new 'time' field

• Extends the helper 'empty_lockfile()' to set 'time: None', keeping tests compiling with the updated Lockfile struct.

pnpm/crates/cli/src/cli_args/patch_commit/tests.rs

install.rsAdd integration test for time-based 'time:' round-trip +40/-0

Add integration test for time-based 'time:' round-trip

• Adds an end-to-end test asserting a 'resolutionMode: time-based' install records 'time:' and that a subsequent install preserves it unchanged.

pnpm/crates/cli/tests/suite/install.rs

tests.rsUpdate deps-restorer fixtures for 'time' field +2/-0

Update deps-restorer fixtures for 'time' field

• Adds 'time: None' to lockfile fixtures used in deps-restorer tests.

pnpm/crates/deps-restorer/src/current_lockfile/tests.rs

tests.rsUpdate hoisted dep graph test fixtures for 'time' field +5/-0

Update hoisted dep graph test fixtures for 'time' field

• Adds 'time: None' to various lockfile literals used by hoisted dep graph tests.

pnpm/crates/deps-restorer/src/hoisted_dep_graph/tests.rs

tests.rsUpdate package map test fixtures for 'time' field +1/-0

Update package map test fixtures for 'time' field

• Adds 'time: None' to lockfile fixtures so tests compile with the new Lockfile shape.

pnpm/crates/deps-restorer/src/package_map/tests.rs

tests.rsUpdate prune-direct-deps fixtures for 'time' field +1/-0

Update prune-direct-deps fixtures for 'time' field

• Adds 'time: None' to lockfile fixtures used for pruning tests.

pnpm/crates/deps-restorer/src/prune_direct_deps/tests.rs

tests.rsUnit-test 'time:' pruning semantics +120/-0

Unit-test 'time:' pruning semantics

• Adds tests covering transitive pruning, multiple importers/groups, peer suffix stripping, npm alias target matching, link dependency behavior, and pass-through when 'time' is absent.

pnpm/crates/lockfile/src/prune_time/tests.rs

tests.rsTest saving preserves and prunes 'time:' section +55/-0

Test saving preserves and prunes 'time:' section

• Adds fixtures/tests ensuring 'time:' survives a save round-trip and is pruned to direct dependencies on write. Updates existing struct literals for the new field.

pnpm/crates/lockfile/src/save_lockfile/tests.rs

tests.rsAdjust YAML emitter tests to new API signature +15/-19

Adjust YAML emitter tests to new API signature

• Updates tests to call 'to_string(Value)' instead of 'to_string(&Serialize)' and removes now-unnecessary '.unwrap()'s.

pnpm/crates/lockfile/src/yaml_emit/tests.rs

tests.rsUpdate package-manager lockfile-builder test options +9/-0

Update package-manager lockfile-builder test options

• Initializes the new 'GraphToLockfileOptions.time' field in test helpers across the suite.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs

tests.rsUpdate install test fixtures for 'time' field +1/-0

Update install test fixtures for 'time' field

• Adds 'time: None' to the helper lockfile used by install tests.

pnpm/crates/package-manager/src/install/tests.rs

tests.rsUpdate lockfile diff fixtures for 'time' field +1/-0

Update lockfile diff fixtures for 'time' field

• Adds 'time: None' to lockfile constructors used in lockfile diff tests.

pnpm/crates/package-manager/src/lockfile_diff/tests.rs

tests.rsUpdate patch test fixtures for 'time' field +1/-0

Update patch test fixtures for 'time' field

• Adds 'time: None' to the patch test lockfile helper.

pnpm/crates/package-manager/src/patch/tests.rs

tests.rsUpdate hoist fixtures for 'time' field +21/-0

Update hoist fixtures for 'time' field

• Adds 'time: None' across real-hoist test lockfile literals to match updated struct shape.

pnpm/crates/real-hoist/src/tests.rs

tests.rsUpdate lockfile reuse fixtures for 'time' field +1/-0

Update lockfile reuse fixtures for 'time' field

• Adds 'time: None' to test lockfiles used in lockfile reuse scenarios.

pnpm/crates/resolving-deps-resolver/src/lockfile_reuse/tests.rs

tests.rsUpdate resolve-importer fixtures for 'time' field +3/-0

Update resolve-importer fixtures for 'time' field

• Adds 'time: None' to lockfile values constructed in resolver tests.

pnpm/crates/resolving-deps-resolver/src/resolve_importer/tests.rs

tests.rsTest time-based 'time' recording and lockfile fallback behavior +86/-1

Test time-based 'time' recording and lockfile fallback behavior

• Extends the time-based cutoff test to assert the 'time' map output and adds a new test validating fallback to recorded lockfile time when resolver results omit timestamps. Updates additional fixtures for 'time: None'.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs

Documentation (1) +5 / -0
lockfile-time-section-round-trips.mdDocument lockfile 'time:' preservation fix +5/-0

Document lockfile 'time:' preservation fix

• Adds a changeset describing that 'pnpm-lock.yaml' no longer drops 'time:' on rewrite, preventing time-based resolution drift.

.changeset/lockfile-time-section-round-trips.md

@greptile-apps

greptile-apps Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (3): Last reviewed commit: "test(lockfile): pin the `time` section's..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@zkochan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b008bdaf-d47b-4070-8af6-ef167ea21db6

📥 Commits

Reviewing files that changed from the base of the PR and between b23f464 and 7536a5c.

📒 Files selected for processing (8)
  • pnpm/crates/cli/tests/suite/install.rs
  • pnpm/crates/cli/tests/suite/pnpr_install.rs
  • pnpm/crates/lockfile-verification/src/hash_lockfile/tests.rs
  • pnpm/crates/lockfile/src/lib.rs
  • pnpm/crates/lockfile/src/prune_time/tests.rs
  • pnpm/crates/lockfile/src/save_lockfile/tests.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs
📝 Walkthrough

Walkthrough

The lockfile now stores direct dependency publish dates in an optional time: section. Resolution, installation, serialization, hashing, lockfile reconstruction, and tests preserve or prune this data as required.

Changes

Lockfile time metadata

Layer / File(s) Summary
Lockfile contract and normalization
pnpm/crates/lockfile/*, pnpm/crates/lockfile-verification/src/hash_lockfile.rs
Adds Lockfile::time, prunes non-direct entries during YAML serialization, and excludes time-dependent data from lockfile hashes.
Time-based resolver timestamps
pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs, pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
Records direct dependency publish dates and falls back to timestamps from the existing lockfile when registry metadata omits them.
Lockfile generation and install wiring
pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs, pnpm/crates/cli/src/cli_args/install.rs, pnpm/crates/deps-restorer/src/current_lockfile.rs, pnpm/crates/cli/tests/suite/install.rs
Passes timestamps through fresh installs, merges prior values, preserves reconstructed lockfiles, and retains the section when server output omits it.
Fixture compatibility and release metadata
.changeset/lockfile-time-section-round-trips.md, pnpm/crates/**/tests.rs
Updates lockfile fixtures for the new optional field and documents the round-trip and fallback behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

Possibly related PRs

  • pnpm/pnpm#12052 — Both modify time-based resolution and direct dependency publication timestamps.
  • pnpm/pnpm#13777 — Both modify preservation and pruning of lockfile time data.
  • pnpm/pnpm#13528 — Both modify lockfile generation and resolution metadata plumbing.

Suggested labels: product: pacquet

Suggested reviewers: yeshyungseok

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-13776

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

qodo-code-review Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Historical comment in test ✓ Resolved 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The new doc comment references the original pnpm implementation (Port of pnpm's ...) rather than
describing the current test’s behavioral contract. This violates the guideline to keep comments
focused on current behavior and can become misleading as code evolves.
Code

pnpm/crates/lockfile/src/save_lockfile/tests.rs[R119-121]

+/// Port of pnpm's `pruneTimeInLockfile`.
+#[test]
+fn time_is_pruned_to_the_importers_direct_dependencies() {
Relevance

●● Moderate

Mixed precedent: similar “current-contract” comment rewrites accepted, but historical-comment
rewording was rejected elsewhere.

PR-#13386
PR-#13728

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 requires comments to describe current behavior, not historical
implementations. The added comment explicitly frames the test as a port of pnpm’s prior
implementation rather than stating the current behavior being tested.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/lockfile/src/save_lockfile/tests.rs[119-121]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A newly added doc comment uses historical/porting phrasing (`Port of pnpm's ...`) instead of describing the current behavior being asserted.

## Issue Context
Comments should document current behavior/contracts, not historical implementations or where code was ported from.

## Fix Focus Areas
- pnpm/crates/lockfile/src/save_lockfile/tests.rs[119-121]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a bump for pacquet and omits the required pnpm package entry.
This can break or misreport release automation that expects pnpm to be explicitly versioned in
every changeset.
Code

.changeset/lockfile-time-section-round-trips.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

●●● Strong

Very recent precedent accepted adding required pnpm entry to pacquet-only changesets; compliance
rule repeatedly enforced.

PR-#13748
PR-#13403

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires each changeset to explicitly list the pnpm package with a valid
bump type. The added changeset front-matter only includes pacquet and contains no pnpm entry.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/lockfile-time-section-round-trips.md[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The changeset front-matter is missing a required `pnpm` package entry with a valid bump type.

## Issue Context
This PR adds a new changeset file but its front-matter only includes `"pacquet": patch`. The compliance checklist requires changesets to explicitly include `pnpm` with an appropriate bump type (`patch`/`minor`/`major`).

## Fix Focus Areas
- .changeset/lockfile-time-section-round-trips.md[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Unneeded time map clone ✓ Resolved 🐞 Bug ➹ Performance
Description
resolve_workspace clones wanted_lockfile.time even when time_based is false, so installs with an
existing time: section pay extra transient CPU/memory for data that is then unused. Since
lockfiles are treated as attacker-controlled, this also amplifies resource-usage risk for a repo
that commits an unusually large time: map.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[R208-209]

+    // Taken before the lockfile moves into the workspace ctx below.
+    let recorded_time = wanted_lockfile.as_ref().and_then(|lockfile| lockfile.time.clone());
Relevance

●● Moderate

Team sometimes accepts perf fast-paths, but similar “avoid clone” micro-opts have been rejected;
unclear priority here.

PR-#13510
PR-#13473

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The code clones lockfile.time immediately after destructuring options, but the value is only
passed into compute_time_based_cutoff under the if time_based branch; the else-branch ignores
it. The repo review guide explicitly treats lockfiles as attacker-controlled input, so unnecessary
copying is worth avoiding.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[183-260]
REVIEW_GUIDE.md[30-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`resolve_workspace` clones `wanted_lockfile.time` before branching on `time_based`, but the cloned map is only used to provide a fallback publish date in the `time_based` path.

### Issue Context
This adds avoidable overhead when a lockfile already contains a `time:` section but the current install is not `time-based`.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[183-260]

### Suggested fix
- Change `recorded_time` to only clone when `time_based` is true, e.g.:
 - `let recorded_time = if time_based { wanted_lockfile.as_ref().and_then(|lf| lf.time.clone()) } else { None };`
- Keep the `recorded_time.as_ref()` call in the `compute_time_based_cutoff(...)` invocation unchanged.
- Ensure any clippy/lint expectations remain satisfied and tests still pass.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context used
✅ Compliance rules (platform): 26 rules

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous review results

Review updated until commit 7536a5c

Results up to commit b23f464 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a bump for pacquet and omits the required pnpm package entry.
This can break or misreport release automation that expects pnpm to be explicitly versioned in
every changeset.
Code

.changeset/lockfile-time-section-round-trips.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

●●● Strong

Very recent precedent accepted adding required pnpm entry to pacquet-only changesets; compliance
rule repeatedly enforced.

PR-#13748
PR-#13403

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires each changeset to explicitly list the pnpm package with a valid
bump type. The added changeset front-matter only includes pacquet and contains no pnpm entry.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/lockfile-time-section-round-trips.md[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The changeset front-matter is missing a required `pnpm` package entry with a valid bump type.

## Issue Context
This PR adds a new changeset file but its front-matter only includes `"pacquet": patch`. The compliance checklist requires changesets to explicitly include `pnpm` with an appropriate bump type (`patch`/`minor`/`major`).

## Fix Focus Areas
- .changeset/lockfile-time-section-round-trips.md[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Unneeded time map clone ✓ Resolved 🐞 Bug ➹ Performance
Description
resolve_workspace clones wanted_lockfile.time even when time_based is false, so installs with an
existing time: section pay extra transient CPU/memory for data that is then unused. Since
lockfiles are treated as attacker-controlled, this also amplifies resource-usage risk for a repo
that commits an unusually large time: map.
Code

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[R208-209]

+    // Taken before the lockfile moves into the workspace ctx below.
+    let recorded_time = wanted_lockfile.as_ref().and_then(|lockfile| lockfile.time.clone());
Relevance

●● Moderate

Team sometimes accepts perf fast-paths, but similar “avoid clone” micro-opts have been rejected;
unclear priority here.

PR-#13510
PR-#13473

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The code clones lockfile.time immediately after destructuring options, but the value is only
passed into compute_time_based_cutoff under the if time_based branch; the else-branch ignores
it. The repo review guide explicitly treats lockfiles as attacker-controlled input, so unnecessary
copying is worth avoiding.

pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[183-260]
REVIEW_GUIDE.md[30-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`resolve_workspace` clones `wanted_lockfile.time` before branching on `time_based`, but the cloned map is only used to provide a fallback publish date in the `time_based` path.

### Issue Context
This adds avoidable overhead when a lockfile already contains a `time:` section but the current install is not `time-based`.

### Fix Focus Areas
- pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs[183-260]

### Suggested fix
- Change `recorded_time` to only clone when `time_based` is true, e.g.:
 - `let recorded_time = if time_based { wanted_lockfile.as_ref().and_then(|lf| lf.time.clone()) } else { None };`
- Keep the `recorded_time.as_ref()` call in the `compute_time_based_cutoff(...)` invocation unchanged.
- Ensure any clippy/lint expectations remain satisfied and tests still pass.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     13.1±0.91ms    28.5 MB/sec    1.54     20.2±2.02ms    18.5 MB/sec
packument/parse                                  1.00     40.3±1.48µs  1647.8 MB/sec    1.28     51.6±4.95µs  1286.1 MB/sec
tarball/download_dependency                      1.00      2.6±0.18ms  1657.6 KB/sec    1.97      5.2±0.52ms   840.9 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    197.1±5.45ms 81.2 KElem/sec    1.58    310.6±6.58ms 51.5 KElem/sec
workspace_resolution/hoist_heavy                 1.00   279.9±14.19ms        ? ?/sec    1.79   500.1±28.63ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Aug 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.40506% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.19%. Comparing base (996297c) to head (47663ef).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...package-manager/src/install_with_fresh_lockfile.rs 81.25% 3 Missing ⚠️
pnpm/crates/lockfile/src/prune_time.rs 91.66% 2 Missing ⚠️
pnpm/crates/cli/src/cli_args/install.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13787      +/-   ##
==========================================
+ Coverage   88.16%   88.19%   +0.03%     
==========================================
  Files         623      624       +1     
  Lines      101537   101608      +71     
==========================================
+ Hits        89520    89618      +98     
+ Misses      12017    11990      -27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

`crate::prune_time` names both the re-exported function and the module
it lives in, which `cargo doc --document-private-items` — what Rust CI
runs — rejects as an ambiguous intra-doc link. The pre-push gate omits
that flag, so the module stays invisible there and the link resolves.

Also drops the test doc comments that only narrate what the test name
and assertions already state, and skips cloning the lockfile's recorded
publish dates on an install that will not consult them.
Copilot AI review requested due to automatic review settings August 10, 2026 20:40

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zkochan

zkochan commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

Responses to the Qodo findings:

Unneeded time map clone — fixed in 47663ef. recorded_time is now gated on time_based, so an install that will never consult the recorded dates does not copy them.

Changeset missing pnpm entry — not applicable here. This is a Rust-only change, and AGENTS.md is explicit: "Do not add \"pnpm\" to a Rust-only changeset: in changesets, pnpm always means the TypeScript CLI package. A changeset whose implementation is Rust-only and targets pacquet must omit \"pnpm\"." The TypeScript CLI already models, writes, prunes, and reads the lockfile's time: section — convertToLockfileFile → normalizeLockfile → pruneTimeInLockfile on write, and getPublishedByDate reading it back — so there is nothing to bump there. Adding "pnpm" would cut a TypeScript CLI release for a change that does not touch it.

Also addressed Greptile's redundant-test-narration finding in the same commit, and fixed the Rust CI / Doc failure: crate::prune_time names both the re-exported function and its module, which cargo doc --document-private-items (what CI runs, unlike the pre-push gate) rejects as an ambiguous intra-doc link.


Written by an agent (Claude Code, claude-opus-5).

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 10, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 47663ef

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🧹 Nitpick comments (4)
pnpm/crates/lockfile/src/save_lockfile/tests.rs (1)

119-120: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Log the rendered lockfile before each multiline assertion.

Print saved_bytes with eprintln! before each assert_eq!. This makes lockfile-format failures readable in CI output.

Proposed change
 let saved_bytes = std::fs::read_to_string(&path).expect("read saved lockfile");
+eprintln!("SAVED LOCKFILE:\n{saved_bytes}\n");
 assert_eq!(saved_bytes, format!("{LOCKFILE_YAML}\n{DIRECT_TIME}\n"));

As per path instructions, “log complex values before non-equality assertions.”

Also applies to: 145-146

🤖 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 `@pnpm/crates/lockfile/src/save_lockfile/tests.rs` around lines 119 - 120, In
the lockfile save tests, add an eprintln! of saved_bytes immediately before each
multiline assert_eq! at the shown location and the additional occurrence around
lines 145-146, so the rendered lockfile appears in CI output before assertion
failures.

Sources: Path instructions, Learnings

pnpm/crates/cli/src/cli_args/install.rs (1)

1023-1029: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Add a pnpr fallback regression test.

Test an install with an existing lockfile that contains direct-dependency time: data. Make the pnpr response omit time:. Verify that the saved lockfile retains the prior direct entry and prunes obsolete entries.

As per path instructions, include “regression and meaningful unit/e2e coverage” and prefer real CLI fixtures for lockfile paths.

🤖 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 `@pnpm/crates/cli/src/cli_args/install.rs` around lines 1023 - 1029, Add
regression and meaningful unit/e2e coverage for the install flow around the pnpr
fallback in the relevant test suite. Use a real CLI fixture with an existing
lockfile containing direct-dependency time data, mock or configure the pnpr
response without a time section, then assert the saved lockfile preserves the
prior direct time entry while pruning obsolete entries.

Source: Path instructions

pnpm/crates/lockfile-verification/src/hash_lockfile.rs (1)

33-35: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add hash regression coverage for prune_time.

Test that a pruned transitive time: entry does not change hash_lockfile, while a retained direct time: entry changes the digest.

🤖 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 `@pnpm/crates/lockfile-verification/src/hash_lockfile.rs` around lines 33 - 35,
Extend the hash regression tests around hash_lockfile to cover
pacquet_lockfile::prune_time: verify that changing a pruned transitive time:
entry leaves the digest unchanged, while changing a retained direct time: entry
produces a different digest. Reuse the existing lockfile fixtures and hashing
helpers, and keep the assertions focused on these two behaviors.

Source: Path instructions

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs (1)

281-281: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add direct output coverage for time.

The changed tests only pass BTreeMap::new(). Add a test that passes a non-empty map and asserts that Lockfile.time contains the same entries. This protects the new graph-to-lockfile boundary.

As per path instructions, “Ensure the change remains scoped, uses the owning lockfile/resolver layers, includes regression and meaningful unit/e2e coverage.”

🤖 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 `@pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs` at line
281, Add direct regression coverage for the graph-to-lockfile conversion around
the time field: pass a non-empty BTreeMap through the owning resolver/lockfile
test path and assert that the resulting Lockfile.time preserves the same
entries. Keep existing empty-map coverage and limit the change to meaningful
unit or end-to-end boundary coverage.

Source: Path instructions

🤖 Prompt for all review comments with 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.

Inline comments:
In `@pnpm/crates/cli/tests/suite/install.rs`:
- Around line 1530-1534: Strengthen the assertions in the test around the
recorded publish dates by requiring recorded.len() == 1 in addition to verifying
the direct `@pnpm.e2e/foo`@ key count. Keep the existing direct-key assertion and
ensure the test covers pruning all transitive timestamp entries from the time:
data.

---

Nitpick comments:
In `@pnpm/crates/cli/src/cli_args/install.rs`:
- Around line 1023-1029: Add regression and meaningful unit/e2e coverage for the
install flow around the pnpr fallback in the relevant test suite. Use a real CLI
fixture with an existing lockfile containing direct-dependency time data, mock
or configure the pnpr response without a time section, then assert the saved
lockfile preserves the prior direct time entry while pruning obsolete entries.

In `@pnpm/crates/lockfile-verification/src/hash_lockfile.rs`:
- Around line 33-35: Extend the hash regression tests around hash_lockfile to
cover pacquet_lockfile::prune_time: verify that changing a pruned transitive
time: entry leaves the digest unchanged, while changing a retained direct time:
entry produces a different digest. Reuse the existing lockfile fixtures and
hashing helpers, and keep the assertions focused on these two behaviors.

In `@pnpm/crates/lockfile/src/save_lockfile/tests.rs`:
- Around line 119-120: In the lockfile save tests, add an eprintln! of
saved_bytes immediately before each multiline assert_eq! at the shown location
and the additional occurrence around lines 145-146, so the rendered lockfile
appears in CI output before assertion failures.

In `@pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs`:
- Line 281: Add direct regression coverage for the graph-to-lockfile conversion
around the time field: pass a non-empty BTreeMap through the owning
resolver/lockfile test path and assert that the resulting Lockfile.time
preserves the same entries. Keep existing empty-map coverage and limit the
change to meaningful unit or end-to-end boundary coverage.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 127fc20d-5781-4765-b48a-c1042afe4d77

📥 Commits

Reviewing files that changed from the base of the PR and between a30a1fa and b23f464.

📒 Files selected for processing (28)
  • .changeset/lockfile-time-section-round-trips.md
  • pnpm/crates/cli/src/cli_args/install.rs
  • pnpm/crates/cli/src/cli_args/patch_commit/tests.rs
  • pnpm/crates/cli/tests/suite/install.rs
  • pnpm/crates/deps-restorer/src/current_lockfile.rs
  • pnpm/crates/deps-restorer/src/current_lockfile/tests.rs
  • pnpm/crates/deps-restorer/src/hoisted_dep_graph/tests.rs
  • pnpm/crates/deps-restorer/src/package_map/tests.rs
  • pnpm/crates/deps-restorer/src/prune_direct_deps/tests.rs
  • pnpm/crates/lockfile-verification/src/hash_lockfile.rs
  • pnpm/crates/lockfile/src/lib.rs
  • pnpm/crates/lockfile/src/prune_time.rs
  • pnpm/crates/lockfile/src/prune_time/tests.rs
  • pnpm/crates/lockfile/src/save_lockfile/tests.rs
  • pnpm/crates/lockfile/src/serialize_yaml.rs
  • pnpm/crates/lockfile/src/yaml_emit.rs
  • pnpm/crates/lockfile/src/yaml_emit/tests.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs
  • pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs
  • pnpm/crates/package-manager/src/install/tests.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/lockfile_diff/tests.rs
  • pnpm/crates/package-manager/src/patch/tests.rs
  • pnpm/crates/real-hoist/src/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/lockfile_reuse/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs

Comment thread pnpm/crates/cli/tests/suite/install.rs Resolved
Adds the coverage the review asked for, and drops a redundant guard the
new tests exposed.

The pnpr-assisted install path needed no carry-over of its own: the
server resolves through the same fresh-lockfile pipeline, so the input
lockfile's recorded dates already reach its answer. An end-to-end test
against an in-process pnpr pins that, and fails when the pipeline's
merge is broken.

Also pins that a pruned `time:` entry leaves the verification cache's
content hash where it was while a retained one moves it, that a
non-empty map reaches `Lockfile.time` through the graph-to-lockfile
boundary while an empty one leaves the section out, and narrows the
end-to-end assertion to the exact recorded key so a stray transitive
entry cannot pass.
Copilot AI review requested due to automatic review settings August 10, 2026 20:58
@greptile-apps
greptile-apps Bot dismissed their stale review August 10, 2026 20:58

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zkochan

zkochan commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

Follow-ups to the review nitpicks, all in 7536a5c:

pnpr fallback regression test — added install_via_pnpr_preserves_the_lockfiles_time_section, an end-to-end test against the in-process pnpr: install, append a time: section carrying one direct and one transitive entry, add a dependency so the second install goes back through the server, and assert the saved lockfile keeps only the direct entry.

Writing it turned up something better than coverage: the client-side carry-over I had added to install_via_pnpr_inner was dead code, and it is now removed. The server resolves through the same install_with_fresh_lockfile pipeline, so the input lockfile's recorded dates already reach its answer — the test passes without the guard, and fails when the pipeline's merge_recorded_time is broken. Net effect: 7 lines of production code deleted and the pnpr path is covered by a test that actually discriminates.

Hash regression coverage for prune_time — added. This one also corrected my understanding: pruning leaves time: {} rather than removing the key (upstream's pickBy does the same, and normalizeLockfile has no empty-time deletion, unlike catalogs/overrides/patchedDependencies). So the invariant is that a lockfile whose time: holds only transitive entries hashes identically to one with time: {}, while a retained direct entry moves the digest. Both are pinned.

Direct output coverage for time — added two tests at the graph-to-lockfile boundary: a non-empty map reaches Lockfile.time unchanged, and an empty one leaves the section out entirely.

Logging before the multiline assertions — skipped. The style guide asks to log before non-assert_eq! assertions; these are assert_eq! under pretty_assertions, which already prints a line diff, and the neighbouring byte-parity tests in the same file (save_reproduces_pnpm_authored_bytes) don't log either. Adding it would diverge from the file's convention without adding signal.


Written by an agent (Claude Code, claude-opus-5).

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 10, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 7536a5c

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 7536a5cd7528

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.418 ± 0.090 2.349 2.644 1.58 ± 0.17
pacquet@main 2.572 ± 0.149 2.435 2.820 1.68 ± 0.19
pnpr@HEAD 1.535 ± 0.154 1.372 1.761 1.00
pnpr@main 1.795 ± 0.118 1.605 1.948 1.17 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.41807348268,
      "stddev": 0.0902880130456796,
      "median": 2.39416152608,
      "user": 1.62821304,
      "system": 1.29488126,
      "min": 2.34933364608,
      "max": 2.6436990640799998,
      "times": [
        2.39476061508,
        2.35768020608,
        2.41866083608,
        2.3621566820799997,
        2.34933364608,
        2.6436990640799998,
        2.39356243708,
        2.49277924408,
        2.41503970808,
        2.35306238808
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5721893717800004,
      "stddev": 0.1486125454637103,
      "median": 2.4996584085799998,
      "user": 1.8454289400000001,
      "system": 1.4352758599999997,
      "min": 2.43490266508,
      "max": 2.81967963608,
      "times": [
        2.43490266508,
        2.5035427760799998,
        2.75811123708,
        2.44291970608,
        2.48653792208,
        2.58577801508,
        2.81967963608,
        2.49577404108,
        2.75233769108,
        2.44231002808
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.53483344278,
      "stddev": 0.15395064560003957,
      "median": 1.5294216605799997,
      "user": 1.22035034,
      "system": 1.2221571599999999,
      "min": 1.37247819908,
      "max": 1.76096769408,
      "times": [
        1.5673841630799998,
        1.69654233308,
        1.4104515810799998,
        1.49778135808,
        1.5610619630799998,
        1.37247819908,
        1.37413288608,
        1.76096769408,
        1.7333899170799998,
        1.3741443330799998
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.79458542778,
      "stddev": 0.1184320268972205,
      "median": 1.81178822308,
      "user": 1.85364444,
      "system": 1.8139037599999994,
      "min": 1.60539426808,
      "max": 1.94767409408,
      "times": [
        1.92362946708,
        1.90299951308,
        1.8241288250799998,
        1.7615445380799999,
        1.82138993608,
        1.61179810008,
        1.60539426808,
        1.74510902608,
        1.8021865100799999,
        1.94767409408
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 453.7 ± 13.7 433.2 475.9 1.05 ± 0.09
pacquet@main 458.0 ± 22.2 436.7 503.2 1.06 ± 0.10
pnpr@HEAD 442.0 ± 56.7 370.0 536.3 1.02 ± 0.15
pnpr@main 431.6 ± 33.2 389.7 496.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.45374121976000004,
      "stddev": 0.013668755340732551,
      "median": 0.45315974886,
      "user": 0.42021571999999996,
      "system": 0.78272206,
      "min": 0.43315491736,
      "max": 0.47587764036,
      "times": [
        0.45395295836,
        0.47587764036,
        0.47132212736,
        0.45236653936000004,
        0.43315491736,
        0.45491658336,
        0.44615138136000004,
        0.45206560236000004,
        0.46195691536,
        0.43564753236000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.45803071626,
      "stddev": 0.02215312602400602,
      "median": 0.44726900186,
      "user": 0.41271701999999993,
      "system": 0.7953482599999999,
      "min": 0.43669564736,
      "max": 0.50321210236,
      "times": [
        0.43669564736,
        0.50321210236,
        0.44005657836,
        0.44431107436,
        0.44788501736,
        0.45996544436000003,
        0.48791567636,
        0.44665298636,
        0.44504265236,
        0.46856998336
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.44202036465999994,
      "stddev": 0.05669623108615842,
      "median": 0.41980006936,
      "user": 0.39638191999999994,
      "system": 0.7628276599999999,
      "min": 0.37004363636,
      "max": 0.53628927536,
      "times": [
        0.53628927536,
        0.48865951936,
        0.37004363636,
        0.38928762036000003,
        0.48294141536,
        0.5059146343600001,
        0.41426983136,
        0.41771637436000003,
        0.39319757536,
        0.42188376436
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.43160768926,
      "stddev": 0.03315536104970928,
      "median": 0.43103502436,
      "user": 0.37008212,
      "system": 0.7625238599999998,
      "min": 0.38972287936,
      "max": 0.49598099136,
      "times": [
        0.49598099136,
        0.39944578636,
        0.38972287936,
        0.40269103936,
        0.44406256636,
        0.47253893136,
        0.43469671136,
        0.42966134636000003,
        0.43240870236,
        0.41486793836
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.084 ± 0.045 2.981 3.124 1.84 ± 0.08
pacquet@main 3.025 ± 0.044 2.955 3.105 1.81 ± 0.07
pnpr@HEAD 1.673 ± 0.064 1.622 1.837 1.00
pnpr@main 1.708 ± 0.165 1.509 2.003 1.02 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.0839792721399997,
      "stddev": 0.04536326306186489,
      "median": 3.1003836492400003,
      "user": 2.84348036,
      "system": 2.2026307599999995,
      "min": 2.98134581374,
      "max": 3.12356171574,
      "times": [
        3.0683228547400003,
        3.1166797707400002,
        3.12356171574,
        3.0936491157400003,
        3.11835226174,
        3.1026224897400003,
        2.98134581374,
        3.03109595574,
        3.10601793474,
        3.0981448087400003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.0248823958399997,
      "stddev": 0.04397349648928377,
      "median": 3.0146043382400003,
      "user": 2.6576678599999997,
      "system": 2.1511373600000003,
      "min": 2.95462669774,
      "max": 3.10463312774,
      "times": [
        3.08229955574,
        2.95462669774,
        3.0229615887400003,
        3.10463312774,
        3.00527796174,
        3.03713802774,
        2.98873104474,
        3.04097222474,
        3.0062470877400003,
        3.00593664174
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.67297408044,
      "stddev": 0.06423340516994637,
      "median": 1.6524048362400001,
      "user": 1.81203316,
      "system": 1.82969556,
      "min": 1.6215313387399999,
      "max": 1.83698386574,
      "times": [
        1.6215313387399999,
        1.62238935474,
        1.64266080174,
        1.83698386574,
        1.70275163574,
        1.6283066077400001,
        1.68548272874,
        1.64588107074,
        1.65892860174,
        1.68482479874
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7076471220399998,
      "stddev": 0.16488322724363788,
      "median": 1.64926026374,
      "user": 1.6371563599999999,
      "system": 1.6861122599999998,
      "min": 1.50860130674,
      "max": 2.0031496517400003,
      "times": [
        1.5561014017400001,
        1.6175634807400001,
        1.50860130674,
        1.86505969974,
        1.66040099574,
        1.91917283774,
        1.63811953174,
        1.60754433674,
        2.0031496517400003,
        1.7007579777400001
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 505.8 ± 64.6 437.4 662.7 1.50 ± 0.21
pacquet@main 666.2 ± 191.2 478.9 1031.7 1.98 ± 0.58
pnpr@HEAD 337.0 ± 18.2 304.4 362.5 1.00
pnpr@main 337.4 ± 5.7 330.1 345.4 1.00 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.505771967,
      "stddev": 0.06461156349943332,
      "median": 0.4928729115,
      "user": 0.67832584,
      "system": 0.8212132799999999,
      "min": 0.437387197,
      "max": 0.66269022,
      "times": [
        0.5575155549999999,
        0.66269022,
        0.498172019,
        0.486682645,
        0.511678355,
        0.500052794,
        0.437387197,
        0.447827825,
        0.46813925600000006,
        0.48757380400000006
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6662253332,
      "stddev": 0.1912466541490859,
      "median": 0.6329005305,
      "user": 0.89178424,
      "system": 0.9205595799999999,
      "min": 0.47887765000000004,
      "max": 1.031725781,
      "times": [
        1.031725781,
        0.905969422,
        0.747972618,
        0.744692716,
        0.638793081,
        0.62700798,
        0.47887765000000004,
        0.49008293900000005,
        0.516378109,
        0.480753036
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33697651879999996,
      "stddev": 0.01816443820388675,
      "median": 0.33989891000000005,
      "user": 0.23816843999999998,
      "system": 0.5633721799999999,
      "min": 0.304368344,
      "max": 0.362547076,
      "times": [
        0.314786359,
        0.304368344,
        0.3236579,
        0.33338910000000005,
        0.34910603300000004,
        0.362547076,
        0.338826018,
        0.35289056500000004,
        0.349221991,
        0.34097180200000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3374247617000001,
      "stddev": 0.005678608182122518,
      "median": 0.33501231500000006,
      "user": 0.23889654,
      "system": 0.5752856799999999,
      "min": 0.33014535700000003,
      "max": 0.34539190200000003,
      "times": [
        0.344715879,
        0.34539190200000003,
        0.334033746,
        0.33300919500000004,
        0.33862837500000004,
        0.33381879000000003,
        0.333495772,
        0.33014535700000003,
        0.33599088400000005,
        0.345017717
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.750 ± 0.031 1.719 1.827 5.73 ± 0.21
pacquet@main 1.773 ± 0.029 1.741 1.820 5.81 ± 0.21
pnpr@HEAD 0.310 ± 0.008 0.300 0.325 1.02 ± 0.04
pnpr@main 0.305 ± 0.010 0.291 0.324 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7498196659799998,
      "stddev": 0.030785428069862415,
      "median": 1.74659893268,
      "user": 0.8225432000000001,
      "system": 0.7863619199999999,
      "min": 1.71921966968,
      "max": 1.82710053768,
      "times": [
        1.82710053768,
        1.76344960268,
        1.75780894068,
        1.7401108836799999,
        1.71921966968,
        1.7473565606800001,
        1.7458413046799999,
        1.72647598568,
        1.72326325068,
        1.74756992368
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.7731876671800002,
      "stddev": 0.028840255971458565,
      "median": 1.75980160718,
      "user": 0.8435413,
      "system": 0.8306670199999999,
      "min": 1.74139448368,
      "max": 1.82018908268,
      "times": [
        1.76476877968,
        1.75270914968,
        1.82018908268,
        1.79995888268,
        1.79995505568,
        1.80115303368,
        1.74886872168,
        1.74139448368,
        1.74804504768,
        1.75483443468
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31037708368,
      "stddev": 0.007893625314160699,
      "median": 0.30865215168000004,
      "user": 0.21140849999999997,
      "system": 0.5246027200000001,
      "min": 0.30018832868,
      "max": 0.32536572268,
      "times": [
        0.30390932268,
        0.31216018368,
        0.32230612668,
        0.31058309068,
        0.32536572268,
        0.30878253768,
        0.30633014467999997,
        0.30018832868,
        0.30852176568,
        0.30562361368
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30545551917999997,
      "stddev": 0.009754699983690832,
      "median": 0.30459537068,
      "user": 0.20097569999999995,
      "system": 0.52020962,
      "min": 0.29125366968,
      "max": 0.32373044068,
      "times": [
        0.30912812968,
        0.31425102468,
        0.29662715768,
        0.30606160968,
        0.32373044068,
        0.30312913168,
        0.31212763268,
        0.29584904168,
        0.30239735368,
        0.29125366968
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 205.2 ± 16.1 171.8 231.4 2.35 ± 0.19
pacquet@main 209.7 ± 15.9 189.5 236.1 2.40 ± 0.18
pnpr@HEAD 87.9 ± 1.9 84.9 93.4 1.01 ± 0.02
pnpr@main 87.2 ± 0.7 85.8 89.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2052489377584616,
      "stddev": 0.016147530237970668,
      "median": 0.20512469522000001,
      "user": 0.1678522646153846,
      "system": 0.05251678461538461,
      "min": 0.17184859822,
      "max": 0.23140827422000002,
      "times": [
        0.21159249622,
        0.21461206722,
        0.20755247122,
        0.19970329822000002,
        0.20512469522000001,
        0.22233700622000002,
        0.23140827422000002,
        0.19586150722,
        0.19284817822,
        0.17184859822,
        0.19151252122,
        0.22521227622,
        0.19862280122
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.20968819779142864,
      "stddev": 0.01588978141998269,
      "median": 0.20549333072000003,
      "user": 0.17198680857142853,
      "system": 0.05626132857142858,
      "min": 0.18951179022,
      "max": 0.23614133522000003,
      "times": [
        0.20206372722000002,
        0.21762462522,
        0.18951179022,
        0.20447540222000002,
        0.23575666922000002,
        0.19456772922,
        0.20976620322,
        0.20651125922000002,
        0.21486998322,
        0.23614133522000003,
        0.20194956122000002,
        0.23277330722,
        0.18998567222,
        0.19963750422
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08790187140181817,
      "stddev": 0.0019450500337461175,
      "median": 0.08749942222,
      "user": 0.020187667878787875,
      "system": 0.010355151515151515,
      "min": 0.08493897522,
      "max": 0.09335942622,
      "times": [
        0.08550364022000001,
        0.08749942222,
        0.08651345322000001,
        0.08714226822,
        0.08749278822,
        0.08836242722,
        0.08551285722,
        0.08699613422000001,
        0.08730149822000001,
        0.08770090122,
        0.09335942622,
        0.08770019022,
        0.08723220822000001,
        0.08756673722000001,
        0.08725597322,
        0.08663434122000001,
        0.08766709822,
        0.08708970922,
        0.08752341822000001,
        0.09201072422,
        0.08493897522,
        0.08772061822,
        0.08760772622,
        0.08897345122,
        0.09089604322,
        0.08594732622000001,
        0.08908076222,
        0.09100100122,
        0.08707846822000001,
        0.09052857122,
        0.09040591022000001,
        0.08523096522000001,
        0.08728672122
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08724056128249998,
      "stddev": 0.0006500425452898928,
      "median": 0.08722966372,
      "user": 0.018609661250000003,
      "system": 0.011253025,
      "min": 0.08580213222000001,
      "max": 0.08906533422,
      "times": [
        0.08722508522,
        0.08758382022,
        0.08604053222000001,
        0.08721362322000001,
        0.08828290822,
        0.08701547922,
        0.08794378922,
        0.08619264822,
        0.08668254322,
        0.08723591422,
        0.08736626122,
        0.08772888422,
        0.08652612722,
        0.08713430422,
        0.08774141722,
        0.08692465822,
        0.08693924622,
        0.08671418122,
        0.08779300422,
        0.08906533422,
        0.08580213222000001,
        0.08700860622,
        0.08742634422000001,
        0.08733142522000001,
        0.08791519422,
        0.08732908122000001,
        0.08719659022000001,
        0.08715651622000001,
        0.08737178022,
        0.08723424222000001,
        0.08669221122000001,
        0.08788407622000001
      ]
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 767.7 ± 139.6 673.4 1108.3 1.00
pacquet@main 921.9 ± 255.8 621.4 1328.5 1.20 ± 0.40
pnpm@HEAD 3250.9 ± 108.8 3119.8 3382.6 4.23 ± 0.78
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7676616319266666,
      "stddev": 0.13956679104909214,
      "median": 0.72336651626,
      "user": 0.7168896844444443,
      "system": 0.12901854444444444,
      "min": 0.67340984926,
      "max": 1.10832042026,
      "times": [
        0.67373718526,
        0.67340984926,
        0.68557492426,
        0.72336651626,
        0.69852272626,
        0.73224709326,
        0.7607066772600001,
        1.10832042026,
        0.8530692952600001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.9218647919266668,
      "stddev": 0.2558249659222507,
      "median": 0.8553666442600001,
      "user": 0.8787679066666667,
      "system": 0.17310943333333334,
      "min": 0.62143150026,
      "max": 1.3284639932600002,
      "times": [
        1.2989435092600001,
        0.77997632326,
        0.9567560822600001,
        1.02432520326,
        0.8553666442600001,
        1.3284639932600002,
        0.76356982226,
        0.66795004926,
        0.62143150026
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.250905237482222,
      "stddev": 0.10879611013243037,
      "median": 3.22647532426,
      "user": 5.028713906666667,
      "system": 0.2898003222222222,
      "min": 3.11976385526,
      "max": 3.3826413132599997,
      "times": [
        3.35784222626,
        3.11976385526,
        3.32245664126,
        3.1775779212599997,
        3.37452680126,
        3.17419429426,
        3.22647532426,
        3.3826413132599997,
        3.12266876026
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.603 ± 0.134 4.489 4.876 1.22 ± 0.05
pacquet@main 4.552 ± 0.046 4.481 4.636 1.21 ± 0.04
pnpr@HEAD 3.772 ± 0.112 3.596 3.959 1.00
pnpr@main 3.822 ± 0.089 3.735 4.019 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.60341839964,
      "stddev": 0.13374824048045691,
      "median": 4.540467292739999,
      "user": 2.36163988,
      "system": 1.6647606400000001,
      "min": 4.48911191774,
      "max": 4.87611094474,
      "times": [
        4.48911191774,
        4.494063530739999,
        4.550514648739999,
        4.5304199367399995,
        4.76207788974,
        4.70188507174,
        4.614415945739999,
        4.517936016739999,
        4.87611094474,
        4.49764809374
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.552141741039999,
      "stddev": 0.0462967733968137,
      "median": 4.5543807767399995,
      "user": 2.28025378,
      "system": 1.7105493399999996,
      "min": 4.4813673207399995,
      "max": 4.63568656774,
      "times": [
        4.5739223847399995,
        4.545739438739999,
        4.4813673207399995,
        4.53550573374,
        4.48163160974,
        4.55856773774,
        4.550193815739999,
        4.58122858374,
        4.63568656774,
        4.57757421774
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.77151089304,
      "stddev": 0.11178642402226922,
      "median": 3.79311410624,
      "user": 2.0743813799999997,
      "system": 1.99849524,
      "min": 3.5961215547400003,
      "max": 3.95873955274,
      "times": [
        3.6227170277400003,
        3.5961215547400003,
        3.8198685617400003,
        3.70351405574,
        3.7253079057400003,
        3.86557046474,
        3.83367365974,
        3.95873955274,
        3.76635965074,
        3.8232364967400003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.8224259109400003,
      "stddev": 0.08852456315147264,
      "median": 3.7905734517400003,
      "user": 2.20310528,
      "system": 2.14091274,
      "min": 3.73502001574,
      "max": 4.019064052739999,
      "times": [
        3.75006873874,
        3.8350159767400003,
        3.78881578474,
        4.019064052739999,
        3.93478377974,
        3.7682360207400003,
        3.73502001574,
        3.78937581974,
        3.79177108374,
        3.81210783674
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13787
Testbedpacquet

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.fresh-restore.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
433.15 ms
(+56.55%)Baseline: 276.69 ms
332.03 ms
(130.46%)

Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,981.35 ms
(+13.19%)Baseline: 2,633.84 ms
3,160.60 ms
(94.33%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,719.22 ms
(-2.35%)Baseline: 1,760.62 ms
2,112.74 ms
(81.37%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
437.39 ms
(+1.39%)Baseline: 431.40 ms
517.68 ms
(84.49%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
171.85 ms
(-20.21%)Baseline: 215.37 ms
258.44 ms
(66.50%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,349.33 ms
(-2.38%)Baseline: 2,406.65 ms
2,887.98 ms
(81.35%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,489.11 ms
(-0.26%)Baseline: 4,500.80 ms
5,400.96 ms
(83.12%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
433.15 ms
(+56.55%)Baseline: 276.69 ms
332.03 ms
(130.46%)

isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
673.41 ms
(+1.06%)Baseline: 666.37 ms
799.64 ms
(84.21%)
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit e77b843 into main Aug 10, 2026
36 of 39 checks passed
@zkochan
zkochan deleted the fix-13776 branch August 10, 2026 21:45
@qodo-code-review qodo-code-review Bot mentioned this pull request Sep 16, 2026
5 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pacquet drops the lockfile's time section, losing time-based resolution's recorded publish dates

3 participants