Skip to content

refactor(store-dir): share the store-index open and drain helpers - #13647

Merged
zkochan merged 1 commit into
mainfrom
share-store-handles
Aug 4, 2026
Merged

zkochan merged 1 commit into
mainfrom
share-store-handles

Conversation

@zkochan

@zkochan zkochan commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Ten call sites repeated the same store-index setup and teardown. None of it is install logic — it is how any caller opens the store index and closes its writer — so it moves to pacquet-store-dir, which already owns those types.

Duplicated block Sites Now
frozenStore branch → shared_immutable_in / shared_readonly_in 4 StoreIndex::shared_for
…wrapped in spawn_blocking + warn on join failure 3 StoreIndex::open_shared
frozenStore branch → spawn / spawn_disabled 2 StoreIndexWriter::spawn_for
Writer drain (match writer_task.await, warn both arms) 4 StoreIndexWriter::drain

Callers: create_virtual_store, install_frozen_lockfile, install_with_fresh_lockfile, patch, tarball_prefetch, dedupe. Two local wrappers that existed only to hold a copy — open_store_index_for_patch and resolver_setup::drain_store_index_writer — are gone.

Net −132 / +103, and the duplicated blocks drop to zero outside store-dir.

Design notes

frozen_store: bool, not &Config. store-dir sits below the config crate, and taking a bool keeps it that way rather than inverting the dependency for one field.

Degradation policy is now stated once. open_shared returns None on a join failure because every lookup then simply misses — which callers already handle for the empty-store case — and drain warns rather than propagating because by that point the rows describe work already on disk, so a missed index write only costs a re-fetch next install. Both rationales previously existed as comments in several copies, with the risk of one copy drifting.

One observable change

The warn! target moves from whichever caller copied the block — pacquet::install, pacquet::patch, pacquet::pnpr — to pacquet::store_index, which names the subsystem the event is about rather than whoever happened to trigger it. A RUST_LOG filter aimed at the old targets will no longer match these two lines.

These are tracing diagnostics, not reporter events, so nothing parses them and no changeset is needed. Flagging it because it is the only thing in this PR a user could notice.

Verification

  • pacquet-store-dir + pacquet-deps-restorer + pacquet-package-manager — 960 passed.
  • Full pacquet-cli suite — 2418 passed.
  • cargo clippy --workspace --all-targets -- -D warnings; cargo doc with RUSTDOCFLAGS=-D warnings --document-private-items; cargo dylint --all — all clean.

Squash Commit Body

Ten call sites repeated the same store-index setup and teardown: the
`frozenStore` branch for opening the shared index, the `spawn_blocking`
wrapper around it, the `spawn` / `spawn_disabled` branch for the writer,
and the writer drain. None of it is install logic.

`pacquet-store-dir` owns those types, so it now owns the helpers:
`StoreIndex::shared_for`, `StoreIndex::open_shared`,
`StoreIndexWriter::spawn_for` and `StoreIndexWriter::drain`. They take
`frozen_store: bool` rather than `&Config`, keeping `store-dir` free of
a dependency on the config crate above it.

Two local wrappers that existed only to hold a copy are removed.

The `warn!` target moves from whichever caller copied the block to
`pacquet::store_index`, naming the subsystem the event is about.

No behaviour change otherwise.

Checklist

  • 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 if this PR changes any published package.
  • Added or updated tests.

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


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability when installing dependencies with frozen lockfiles and stores.
    • Improved handling of dependency store access and shutdown errors, reducing the chance of interrupted or incomplete installation operations.
  • Refactor

    • Standardized dependency store management across installations, patching, and tarball prefetching.
    • Simplified background processing and error handling for more consistent behavior.

Four call sites branched on `frozenStore` to pick between
`shared_immutable_in` and `shared_readonly_in`, three of them wrapping
it in the same `spawn_blocking` plus warn-on-join-failure. Four more
repeated the writer drain verbatim, and two more branched to pick
between `spawn` and `spawn_disabled`. None of it is install logic — it
is how any caller opens the store index and closes its writer.

`pacquet-store-dir` owns those types, so it now owns the four helpers:

- `StoreIndex::shared_for` — the `frozenStore` branch.
- `StoreIndex::open_shared` — the same, off the reactor thread, degrading
  a join failure to `None` because every lookup then simply misses.
- `StoreIndexWriter::spawn_for` — the `spawn` / `spawn_disabled` branch.
- `StoreIndexWriter::drain` — await the final flush, warning rather than
  propagating, since the rows describe work already on disk.

They take `frozen_store: bool` rather than `&Config`, which keeps
`store-dir` free of a dependency on the config crate that sits above it.

The `warn!` target moves from whichever caller copied the block
(`pacquet::install`, `pacquet::patch`, `pacquet::pnpr`) to
`pacquet::store_index`, which names the subsystem the event is actually
about. `RUST_LOG` filters aimed at the old targets will no longer match
these two lines.

No behaviour change otherwise.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings August 4, 2026 19:20

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.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The PR adds shared APIs for store-index access and writer lifecycle handling. Dedupe, install, patch, and tarball flows now use these APIs instead of local frozen-store branching and task-result handling.

Store-index lifecycle

Layer / File(s) Summary
Shared store-index APIs
pnpm/crates/store-dir/src/store_index.rs
Adds shared index selection, asynchronous opening, writer creation, and writer draining APIs.
Store-index setup integration
pnpm/crates/cli/src/cli_args/dedupe.rs, pnpm/crates/deps-restorer/src/create_virtual_store.rs, pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs, pnpm/crates/package-manager/src/patch.rs
Uses shared index opening and writer creation based on the frozen-store setting.
Writer drain integration
pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs, pnpm/crates/package-manager/src/patch.rs, pnpm/crates/package-manager/src/tarball_prefetch.rs
Delegates writer completion, errors, and panics to StoreIndexWriter::drain.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • pnpm/pnpm#13472: Both changes update DedupeResolutionReporter store-index handling.
  • pnpm/pnpm#13624: Both changes update fresh-lockfile store-index setup and writer draining.
  • pnpm/pnpm#13151: Both changes modify dedupe and virtual-store install behavior.

Suggested labels: product: pacquet

Suggested reviewers: copilot

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch share-store-handles

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

Copy link
Copy Markdown

PR Summary by Qodo

Refactor: centralize StoreIndex open/drain helpers in store-dir

✨ Enhancement 🕐 20-40 Minutes

Grey Divider

AI Description

• Move shared StoreIndex open logic (including spawn_blocking + join-failure policy) into
 pacquet-store-dir.
• Add StoreIndexWriter spawn_for/drain helpers and standardize warning target to
 pacquet::store_index.
• Update install/patch/prefetch/dedupe call sites and remove redundant local wrappers.
Diagram

graph TD
  A["Callers (install/patch/prefetch/dedupe)"] --> B["StoreIndex helpers"] --> C["tokio spawn_blocking"] --> D[("index.db")]
  A --> E["StoreIndexWriter helpers"] --> C
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. RAII guard for writer drain (Drop-based)
  • ➕ Makes correct draining harder to forget at call sites
  • ➕ Can bundle writer + JoinHandle into a single "handles" type
  • ➖ Async work cannot run in Drop; would require explicit shutdown anyway
  • ➖ Adds a new lifecycle abstraction that may be heavier than needed
2. Pass &Config instead of frozen_store: bool
  • ➕ Avoids threading a separate boolean through call sites
  • ➖ Introduces an undesirable dependency edge into store-dir (config crate sits above)
  • ➖ Couples low-level store index primitives to broader configuration surface

Recommendation: Current approach is the best fit: it removes duplicated lifecycle logic while keeping store-dir independent from the config crate. The chosen degradation policies (open_shared join failure => None; drain => warn) are now centralized and consistent, and the explicit drain call remains clear at shutdown points without inventing an async Drop pattern.

Files changed (8) +107 / -142

Enhancement (1) +90 / -0
store_index.rsAdd shared_for/open_shared and spawn_for/drain helper APIs +90/-0

Add shared_for/open_shared and spawn_for/drain helper APIs

• Introduces StoreIndex::shared_for (frozen-store branching) and StoreIndex::open_shared (spawn_blocking wrapper with warn-and-None degradation on join failure). Adds StoreIndexWriter::spawn_for and StoreIndexWriter::drain to centralize writer selection and shutdown warnings, and moves warning targets to pacquet::store_index.

pnpm/crates/store-dir/src/store_index.rs

Refactor (7) +17 / -142
dedupe.rsUse StoreIndex::shared_for for dedupe StoreIndex selection +1/-5

Use StoreIndex::shared_for for dedupe StoreIndex selection

• Replaces the local frozen_store branching between shared_immutable_in/shared_readonly_in with the new StoreIndex::shared_for helper. This reduces duplication and keeps the frozen-store policy consistent with other callers.

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

create_virtual_store.rsUse StoreIndex::open_shared to centralize spawn_blocking + warning policy +1/-17

Use StoreIndex::open_shared to centralize spawn_blocking + warning policy

• Replaces the inline spawn_blocking wrapper (and pacquet::install-targeted warning) with StoreIndex::open_shared. Join failures now follow the shared policy (warn and degrade to None).

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

install_frozen_lockfile.rsAdopt StoreIndexWriter::spawn_for and ::drain in frozen-lockfile install +3/-18

Adopt StoreIndexWriter::spawn_for and ::drain in frozen-lockfile install

• Uses StoreIndexWriter::spawn_for to centralize the frozen_store writer selection and StoreIndexWriter::drain to standardize shutdown warnings. This also shifts warn target ownership to pacquet::store_index for writer-drain diagnostics.

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

install_with_fresh_lockfile.rsSwitch writer drain calls to StoreIndexWriter::drain in store-dir +3/-2

Switch writer drain calls to StoreIndexWriter::drain in store-dir

• Replaces resolver_setup::drain_store_index_writer with pacquet_store_dir::StoreIndexWriter::drain in both the materializing and lockfile-only paths. Keeps the shutdown semantics while consolidating warning policy and log target.

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

resolver_setup.rsUse store-dir helpers and remove local drain_store_index_writer wrapper +2/-46

Use store-dir helpers and remove local drain_store_index_writer wrapper

• Updates open_store_index_handles to use StoreIndex::open_shared and StoreIndexWriter::spawn_for. Removes the local drain_store_index_writer function since the shared drain logic now lives in store-dir.

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

patch.rsRemove patch-specific store-index open/drain wrappers; use shared helpers +6/-41

Remove patch-specific store-index open/drain wrappers; use shared helpers

• Replaces open_store_index_for_patch with StoreIndex::open_shared and centralizes writer lifecycle via StoreIndexWriter::spawn_for and ::drain. Also removes the now-unused SharedReadonlyStoreIndex import and standardizes warning target via store-dir.

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

tarball_prefetch.rsUse StoreIndexWriter::drain for tarball prefetch shutdown +1/-13

Use StoreIndexWriter::drain for tarball prefetch shutdown

• Replaces the inline JoinHandle await + warning match with StoreIndexWriter::drain. This standardizes warning behavior and moves the warn target to pacquet::store_index.

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

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

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.

@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge, with the migrated call sites retaining their previous store-index behavior and lifecycle ordering.

The extracted helpers reproduce the prior frozen-store branches, blocking-task handling, sender-drop-before-drain sequence, warning text, and error-degradation policy; the only observable difference is the tracing target change already documented by the author.

Reviews (1): Last reviewed commit: "refactor(store-dir): share the store-ind..." | Re-trigger Greptile

@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.

🧹 Nitpick comments (2)
pnpm/crates/store-dir/src/store_index.rs (1)

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

Complete the spawn_for rustdoc contract.

The rustdoc begins with a sentence fragment. State the selected writer mode and the common handle/task return contract.

As per coding guidelines, “Use rustdoc comments for public API contracts.” As per path instructions, public helper documentation must describe contracts and edge cases.

🤖 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/store-dir/src/store_index.rs` around lines 175 - 188, Complete
the rustdoc for StoreIndexWriter::spawn_for by stating that frozen_store selects
the disabled writer and otherwise selects the normal writer, and document that
both paths return an Arc<StoreIndexWriter> together with a JoinHandle whose task
resolves to Result<(), StoreIndexError>. Ensure the opening text is a complete
sentence and covers the read-only edge case.

Sources: Coding guidelines, Path instructions

pnpm/crates/deps-restorer/src/create_virtual_store.rs (1)

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

Remove delegated index-open details from this caller.

StoreIndex::open_shared owns the blocking-task and join-failure contract. Lines 272–283 repeat that behavior and name shared_readonly_in, which this caller no longer invokes. Keep the caller-specific cache-use rationale only.

As per coding guidelines, “Do not write comments that merely restate code, repeat callee documentation, [or] describe removed implementation history.”

🤖 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/deps-restorer/src/create_virtual_store.rs` at line 309, Remove
the caller comments around StoreIndex::open_shared in the store-opening flow
that describe blocking-task, join-failure, or shared_readonly_in details. Keep
only the caller-specific rationale for using the cache, leaving the delegated
index-open behavior documented by StoreIndex::open_shared itself.

Sources: Coding guidelines, 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.

Nitpick comments:
In `@pnpm/crates/deps-restorer/src/create_virtual_store.rs`:
- Line 309: Remove the caller comments around StoreIndex::open_shared in the
store-opening flow that describe blocking-task, join-failure, or
shared_readonly_in details. Keep only the caller-specific rationale for using
the cache, leaving the delegated index-open behavior documented by
StoreIndex::open_shared itself.

In `@pnpm/crates/store-dir/src/store_index.rs`:
- Around line 175-188: Complete the rustdoc for StoreIndexWriter::spawn_for by
stating that frozen_store selects the disabled writer and otherwise selects the
normal writer, and document that both paths return an Arc<StoreIndexWriter>
together with a JoinHandle whose task resolves to Result<(), StoreIndexError>.
Ensure the opening text is a complete sentence and covers the read-only edge
case.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fb504210-68e2-401e-9444-521da18b86d4

📥 Commits

Reviewing files that changed from the base of the PR and between df3a09a and 4159c31.

📒 Files selected for processing (8)
  • pnpm/crates/cli/src/cli_args/dedupe.rs
  • pnpm/crates/deps-restorer/src/create_virtual_store.rs
  • pnpm/crates/deps-restorer/src/install_frozen_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs
  • pnpm/crates/package-manager/src/patch.rs
  • pnpm/crates/package-manager/src/tarball_prefetch.rs
  • pnpm/crates/store-dir/src/store_index.rs

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

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.05     15.8±1.67ms    23.6 MB/sec    1.00     15.1±1.84ms    24.7 MB/sec
packument/parse                                  1.12     45.1±3.13µs  1470.6 MB/sec    1.00     40.2±2.43µs  1650.1 MB/sec
tarball/download_dependency                      1.23      3.4±0.54ms  1271.8 KB/sec    1.00      2.8±0.20ms  1567.3 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.12   245.7±15.97ms 65.1 KElem/sec    1.00   218.5±21.19ms 73.2 KElem/sec
workspace_resolution/hoist_heavy                 1.03   367.4±36.27ms        ? ?/sec    1.00   356.2±47.14ms        ? ?/sec

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.19608% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.09%. Comparing base (df3a09a) to head (4159c31).

Files with missing lines Patch % Lines
pnpm/crates/store-dir/src/store_index.rs 86.11% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13647      +/-   ##
==========================================
+ Coverage   88.08%   88.09%   +0.01%     
==========================================
  Files         582      582              
  Lines       98620    98601      -19     
==========================================
- Hits        86866    86865       -1     
+ Misses      11754    11736      -18     

☔ 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.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 4159c31db66d

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.748 ± 0.121 2.559 2.916 1.65 ± 0.19
pacquet@main 2.699 ± 0.207 2.512 3.050 1.62 ± 0.21
pnpr@HEAD 1.667 ± 0.173 1.436 1.911 1.00
pnpr@main 1.677 ± 0.148 1.452 1.912 1.01 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7476278067999997,
      "stddev": 0.12138650826817902,
      "median": 2.7599333474999996,
      "user": 2.13713094,
      "system": 1.7084056,
      "min": 2.5591557369999998,
      "max": 2.915973454,
      "times": [
        2.582092185,
        2.5591557369999998,
        2.719547087,
        2.868308094,
        2.757607893,
        2.86618294,
        2.762258802,
        2.650563089,
        2.915973454,
        2.794588787
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6989931513999994,
      "stddev": 0.20719112127452016,
      "median": 2.598147828,
      "user": 2.2907295399999996,
      "system": 1.7975426999999997,
      "min": 2.511955551,
      "max": 3.050255125,
      "times": [
        2.511955551,
        2.526571313,
        2.578447287,
        2.617848369,
        2.528707958,
        2.539323485,
        2.937758529,
        2.9503191579999997,
        3.050255125,
        2.7487447389999997
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6674180675000003,
      "stddev": 0.17253915535399417,
      "median": 1.6561634245000003,
      "user": 1.5187437400000001,
      "system": 1.6033303999999997,
      "min": 1.436358955,
      "max": 1.9108349980000001,
      "times": [
        1.5997118590000001,
        1.7962026870000003,
        1.7646331900000003,
        1.436358955,
        1.7126149900000003,
        1.506233326,
        1.5662882180000002,
        1.9108349980000001,
        1.4840873760000002,
        1.8972150760000002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6773320668,
      "stddev": 0.14778221273903475,
      "median": 1.6882363935000002,
      "user": 1.7980660400000001,
      "system": 2.0309511,
      "min": 1.451632534,
      "max": 1.9118009630000001,
      "times": [
        1.813188865,
        1.451632534,
        1.831102443,
        1.526142555,
        1.7175741080000002,
        1.6742588200000001,
        1.9118009630000001,
        1.7022139670000003,
        1.6004273840000003,
        1.544979029
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 378.6 ± 20.6 350.6 413.3 1.03 ± 0.09
pacquet@main 374.4 ± 28.1 315.8 399.0 1.02 ± 0.10
pnpr@HEAD 367.9 ± 24.3 328.5 405.1 1.00
pnpr@main 515.2 ± 87.2 382.2 612.2 1.40 ± 0.25
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.37864044548,
      "stddev": 0.02058901268237005,
      "median": 0.37695623778000004,
      "user": 0.33994868,
      "system": 0.6517267199999999,
      "min": 0.35064725978,
      "max": 0.41325952578,
      "times": [
        0.39069304378,
        0.36813848478,
        0.35064725978,
        0.41325952578,
        0.36899643678000005,
        0.40020676978,
        0.35734486378,
        0.36007578578000005,
        0.38491603878,
        0.39212624578000005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.37438676128000004,
      "stddev": 0.028112962313072778,
      "median": 0.38174290178000003,
      "user": 0.31916668,
      "system": 0.69790672,
      "min": 0.31578415278,
      "max": 0.39904474778000004,
      "times": [
        0.37753053178,
        0.39898193878000004,
        0.37282607178000005,
        0.34491058078000003,
        0.39904474778000004,
        0.39857602578,
        0.35433701278,
        0.31578415278,
        0.38595527178,
        0.39592127878
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.36787296098,
      "stddev": 0.024273603327481914,
      "median": 0.36557183728,
      "user": 0.32811767999999997,
      "system": 0.64562672,
      "min": 0.32847382678000003,
      "max": 0.40511326778,
      "times": [
        0.38397864778,
        0.34454401178,
        0.34852375978,
        0.32847382678000003,
        0.40511326778,
        0.36938683078,
        0.35770899878,
        0.38266856678,
        0.36175684378,
        0.39657485578
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.51523330768,
      "stddev": 0.08715434244177075,
      "median": 0.5568974357800001,
      "user": 0.45744408000000003,
      "system": 0.7623431199999999,
      "min": 0.38215447078000003,
      "max": 0.6121641297800001,
      "times": [
        0.44048463078000005,
        0.42282341578000004,
        0.38215447078000003,
        0.56670210878,
        0.5501028887800001,
        0.5857591757800001,
        0.6121641297800001,
        0.60350363778,
        0.5636919827800001,
        0.42494663578
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.073 ± 0.267 2.838 3.760 1.74 ± 0.20
pacquet@main 2.985 ± 0.228 2.756 3.458 1.69 ± 0.19
pnpr@HEAD 1.778 ± 0.140 1.548 1.965 1.01 ± 0.11
pnpr@main 1.762 ± 0.139 1.532 1.951 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.0728008619000002,
      "stddev": 0.2669753185557745,
      "median": 3.0139250303000003,
      "user": 2.6014327600000002,
      "system": 2.1135526,
      "min": 2.8382948968000004,
      "max": 3.7597424008,
      "times": [
        3.7597424008,
        3.1628564058000004,
        3.0174351558000003,
        3.1389853128,
        3.0978150458,
        2.9620552578000003,
        2.8609273328000002,
        2.8382948968000004,
        3.0104149048,
        2.8794819058
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.9849421988,
      "stddev": 0.22754891324456034,
      "median": 2.9219562533000003,
      "user": 2.44616246,
      "system": 1.9774897,
      "min": 2.7556005968000004,
      "max": 3.4579175048,
      "times": [
        3.3311328808000003,
        2.9284428128,
        2.7962187788,
        2.9268583938000003,
        3.4579175048,
        2.8683253928,
        2.9800949838000004,
        2.9170541128000003,
        2.8877765308,
        2.7556005968000004
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.7777887320999999,
      "stddev": 0.13981069356688158,
      "median": 1.8081198073,
      "user": 1.4276387600000002,
      "system": 1.5850617999999996,
      "min": 1.5479136188,
      "max": 1.9650750898,
      "times": [
        1.6613482688,
        1.9650750898,
        1.6067344928,
        1.7156108268,
        1.8058745688,
        1.8535914458,
        1.5479136188,
        1.9281423847999999,
        1.8103650458,
        1.8832315788
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7620277509000002,
      "stddev": 0.13867090135830157,
      "median": 1.7968100613,
      "user": 1.51792596,
      "system": 1.6339261999999999,
      "min": 1.5324448848,
      "max": 1.9511010128,
      "times": [
        1.5844731838,
        1.7753179528,
        1.5324448848,
        1.7257428838,
        1.8717949708000001,
        1.9511010128,
        1.8257395537999999,
        1.6406922968,
        1.8183021698000001,
        1.8946685998
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 518.1 ± 36.3 482.7 606.8 1.32 ± 0.14
pacquet@main 474.3 ± 27.3 433.3 510.1 1.21 ± 0.11
pnpr@HEAD 410.5 ± 40.0 347.4 456.5 1.05 ± 0.13
pnpr@main 391.7 ± 29.4 359.8 427.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.51809134224,
      "stddev": 0.03626227836338616,
      "median": 0.50807519794,
      "user": 0.69387794,
      "system": 0.8284805800000001,
      "min": 0.48266687594,
      "max": 0.60680071894,
      "times": [
        0.5014911159400001,
        0.50150296894,
        0.48674819494,
        0.51510622794,
        0.49759070694,
        0.51464742694,
        0.53910631294,
        0.48266687594,
        0.60680071894,
        0.53525287294
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.47426759803999996,
      "stddev": 0.027287495574267785,
      "median": 0.47516439444,
      "user": 0.65084914,
      "system": 0.75532728,
      "min": 0.43333006394,
      "max": 0.51009522294,
      "times": [
        0.48168992994000004,
        0.45685779194000004,
        0.46863885894,
        0.43333006394,
        0.45267261894,
        0.51009522294,
        0.50274106494,
        0.49559447494000003,
        0.44231269194,
        0.49874326194
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.4104891147400001,
      "stddev": 0.040034751777365526,
      "median": 0.41928834044,
      "user": 0.28571453999999996,
      "system": 0.66767098,
      "min": 0.34740106694,
      "max": 0.45645349094000004,
      "times": [
        0.45638110594000003,
        0.37611247394,
        0.34740106694,
        0.36739757894,
        0.37908353694,
        0.43512909494,
        0.45645349094000004,
        0.42091562794000004,
        0.41766105294,
        0.44835611794
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.39174591714,
      "stddev": 0.029352284932407362,
      "median": 0.38245351444000003,
      "user": 0.2831941399999999,
      "system": 0.63859078,
      "min": 0.35983327694,
      "max": 0.42722466194000003,
      "times": [
        0.38627605194000003,
        0.36384116794,
        0.37863097694000003,
        0.41899001794,
        0.42541407094,
        0.36816059294000003,
        0.36253994294,
        0.35983327694,
        0.42654841094,
        0.42722466194000003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.992 ± 0.080 1.873 2.090 5.01 ± 0.65
pacquet@main 2.050 ± 0.254 1.864 2.678 5.16 ± 0.90
pnpr@HEAD 0.398 ± 0.049 0.335 0.474 1.00
pnpr@main 0.427 ± 0.075 0.336 0.552 1.07 ± 0.23
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.99219339626,
      "stddev": 0.07978667627623161,
      "median": 2.00858744886,
      "user": 1.1863334,
      "system": 1.0249621999999998,
      "min": 1.8730385523600002,
      "max": 2.09035843836,
      "times": [
        2.0492861753600002,
        1.98465472536,
        2.0841452243600003,
        2.04025100736,
        1.95952808436,
        2.09035843836,
        2.03252017236,
        1.88004263336,
        1.8730385523600002,
        1.92810894936
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.0504319162600004,
      "stddev": 0.25386437329864264,
      "median": 1.96150395586,
      "user": 1.3137428,
      "system": 1.090341,
      "min": 1.86399006136,
      "max": 2.67769574336,
      "times": [
        2.30713715836,
        1.99893403536,
        1.89102194236,
        1.86399006136,
        1.9095582323600002,
        2.00908912636,
        2.67769574336,
        1.92407387636,
        1.9141258043600002,
        2.00869318236
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.39760336595999995,
      "stddev": 0.04908867061730417,
      "median": 0.38082404336,
      "user": 0.26540480000000005,
      "system": 0.631501,
      "min": 0.33518183836000004,
      "max": 0.47412540836000006,
      "times": [
        0.37671241336,
        0.38493567336,
        0.35416219136000004,
        0.33518183836000004,
        0.36790144836,
        0.44955280636,
        0.45947281536,
        0.35685072336,
        0.41713834136,
        0.47412540836000006
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.42739827106000006,
      "stddev": 0.07533772006064492,
      "median": 0.41808291586,
      "user": 0.2944242,
      "system": 0.6841234,
      "min": 0.33568502436000003,
      "max": 0.5515987963600001,
      "times": [
        0.37528732436,
        0.44914662336000005,
        0.37342056736,
        0.39121937936,
        0.33568502436000003,
        0.34762748236,
        0.53313831036,
        0.5515987963600001,
        0.47191275036,
        0.44494645236
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 219.6 ± 22.2 197.6 270.4 2.10 ± 0.30
pacquet@main 242.3 ± 24.7 207.0 298.5 2.31 ± 0.33
pnpr@HEAD 117.4 ± 26.7 92.0 208.7 1.12 ± 0.28
pnpr@main 104.8 ± 10.4 90.0 131.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.21957537732545457,
      "stddev": 0.022188880568866153,
      "median": 0.21131384478,
      "user": 0.20122772181818183,
      "system": 0.0849477909090909,
      "min": 0.19759000878000002,
      "max": 0.27043010178000004,
      "times": [
        0.24653751878000002,
        0.21094047478,
        0.21878567378000002,
        0.20284500278,
        0.27043010178000004,
        0.21131384478,
        0.22397437378,
        0.19759000878000002,
        0.20220005178,
        0.20218893878000002,
        0.22852316078
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.24230496942285715,
      "stddev": 0.02467489357165706,
      "median": 0.23651022278,
      "user": 0.22356696857142858,
      "system": 0.09619255714285714,
      "min": 0.20702922478000002,
      "max": 0.29846676178000003,
      "times": [
        0.20702922478000002,
        0.25025465378,
        0.22772031078000002,
        0.23342680478000002,
        0.25734453478,
        0.28298989178,
        0.23778677578000001,
        0.23523366978000002,
        0.22184398978,
        0.23398892978000002,
        0.23968798878,
        0.29846676178000003,
        0.21664657378000002,
        0.24984946178
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.11739883017285717,
      "stddev": 0.026738174679090673,
      "median": 0.10889328978000001,
      "user": 0.03633186142857143,
      "system": 0.01981573571428571,
      "min": 0.09198847678000001,
      "max": 0.20870239878000002,
      "times": [
        0.10014764778,
        0.09198847678000001,
        0.09732971378000001,
        0.10957069378,
        0.11594692378,
        0.10956731678000001,
        0.10273244378,
        0.10844131078000001,
        0.09861109078000001,
        0.12272949778,
        0.10556330278,
        0.12402896978000001,
        0.10800233678,
        0.12002515678,
        0.10384726878,
        0.10934526878,
        0.11902282478000001,
        0.09664687978,
        0.10378135478,
        0.18506637678,
        0.20870239878000002,
        0.16416768878000002,
        0.13332165078,
        0.12078049578000001,
        0.10178304978000001,
        0.10510171678,
        0.10179232778000001,
        0.11912306078000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10479983794,
      "stddev": 0.01043000785883845,
      "median": 0.10373662178000001,
      "user": 0.03099774,
      "system": 0.01432118,
      "min": 0.09001354578000001,
      "max": 0.13107254478,
      "times": [
        0.11241190178,
        0.09317592778,
        0.10876464878,
        0.10082468078000001,
        0.11571848478,
        0.12015596278,
        0.10808807678,
        0.09500678778,
        0.09442554578000001,
        0.09971562578000001,
        0.13107254478,
        0.10527564378000001,
        0.09001354578000001,
        0.09384902278,
        0.10015277878,
        0.09246219678,
        0.10373662178000001,
        0.10688624978000001,
        0.11196910078000001,
        0.10083098178000001,
        0.11795627878,
        0.09494798778,
        0.09583803078,
        0.11031006278000001,
        0.11640725878000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.052 ± 0.204 0.804 1.394 1.00
pacquet@main 1.194 ± 0.406 0.788 2.153 1.13 ± 0.44
pnpm@HEAD 4.046 ± 0.548 3.312 5.140 3.84 ± 0.91
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.0523123308444444,
      "stddev": 0.20388537340175295,
      "median": 0.9840092924000001,
      "user": 0.9824999577777778,
      "system": 0.18973443333333334,
      "min": 0.8041611034,
      "max": 1.3938376044,
      "times": [
        0.9338506464,
        1.3938376044,
        1.1698519534,
        0.8932502684000001,
        0.9840092924000001,
        1.2557116494,
        0.8555820324000001,
        0.8041611034,
        1.1805564274
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.1935793518444444,
      "stddev": 0.405818248342149,
      "median": 1.0343111974,
      "user": 1.1351786244444444,
      "system": 0.18649354444444446,
      "min": 0.7883741314,
      "max": 2.1532370473999998,
      "times": [
        1.2602646554,
        1.3656489594,
        1.2549377054,
        0.9501333004000001,
        0.9050577154,
        1.0302494544,
        2.1532370473999998,
        0.7883741314,
        1.0343111974
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.0455086514000005,
      "stddev": 0.5481395815616157,
      "median": 4.0323470334,
      "user": 6.123863180000001,
      "system": 0.3687441,
      "min": 3.3124999373999997,
      "max": 5.1403373044,
      "times": [
        5.1403373044,
        4.4930947614,
        4.2865209164,
        3.7364944274,
        4.0323470334,
        4.1033190984,
        3.6783622294,
        3.6266021543999996,
        3.3124999373999997
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.711 ± 0.137 4.552 4.931 1.26 ± 0.05
pacquet@main 4.928 ± 0.194 4.561 5.248 1.32 ± 0.07
pnpr@HEAD 3.864 ± 0.146 3.664 4.151 1.04 ± 0.05
pnpr@main 3.725 ± 0.114 3.617 3.996 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.710818376259999,
      "stddev": 0.1368115809958842,
      "median": 4.68175406576,
      "user": 2.4164696,
      "system": 1.8046389599999997,
      "min": 4.55199271276,
      "max": 4.93116179776,
      "times": [
        4.67279456576,
        4.93116179776,
        4.85895630676,
        4.88077681676,
        4.61604537676,
        4.56262265676,
        4.55199271276,
        4.69071356576,
        4.60842205276,
        4.7346979107600005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.92769813396,
      "stddev": 0.19385310820659243,
      "median": 4.95713811176,
      "user": 2.5149599999999994,
      "system": 1.8769476600000001,
      "min": 4.56090886776,
      "max": 5.24826701976,
      "times": [
        4.87996678476,
        4.80857384976,
        4.56090886776,
        4.95321141876,
        4.96106480476,
        4.73369868276,
        5.07537845476,
        5.06752148276,
        5.24826701976,
        4.98838997376
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.8637120415600004,
      "stddev": 0.1464157171809337,
      "median": 3.86244686676,
      "user": 2.0257687,
      "system": 1.9692079599999996,
      "min": 3.66377043576,
      "max": 4.15078410576,
      "times": [
        3.96284593776,
        3.94372797176,
        3.78616470976,
        3.92797356776,
        4.15078410576,
        3.66377043576,
        3.80191457376,
        3.91123516376,
        3.8136585697600003,
        3.6750453797600002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.7246933450600004,
      "stddev": 0.1136392329129636,
      "median": 3.6868070187599997,
      "user": 1.7855471,
      "system": 1.68157046,
      "min": 3.61708905876,
      "max": 3.99612005476,
      "times": [
        3.7541798227600003,
        3.78966434276,
        3.99612005476,
        3.65138791276,
        3.61708905876,
        3.77783269876,
        3.71541655076,
        3.6440179817600002,
        3.65819748676,
        3.64302754076
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13647
Testbedpacquet

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.fresh-restore.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
350.65 ms
(+30.82%)Baseline: 268.04 ms
321.65 ms
(109.02%)

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,838.29 ms
(+7.41%)Baseline: 2,642.52 ms
3,171.03 ms
(89.51%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,873.04 ms
(+5.14%)Baseline: 1,781.48 ms
2,137.78 ms
(87.62%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
482.67 ms
(+13.17%)Baseline: 426.48 ms
511.78 ms
(94.31%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
197.59 ms
(+1.76%)Baseline: 194.17 ms
233.00 ms
(84.80%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,559.16 ms
(+6.80%)Baseline: 2,396.32 ms
2,875.58 ms
(89.00%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,551.99 ms
(+2.16%)Baseline: 4,455.87 ms
5,347.04 ms
(85.13%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
350.65 ms
(+30.82%)Baseline: 268.04 ms
321.65 ms
(109.02%)

isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
804.16 ms
(+13.67%)Baseline: 707.48 ms
848.97 ms
(94.72%)
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 0238477 into main Aug 4, 2026
34 of 35 checks passed
@zkochan
zkochan deleted the share-store-handles branch August 4, 2026 19:55
KSXGitHub pushed a commit that referenced this pull request Aug 4, 2026
Picks up the store-index helper sharing (#13647) and the
headless-install bin shim for publicly hoisted workspace packages
(#13644), which moves the linking and materialization-plan
modules from `package-manager` into `deps-restorer`.

Neither touches the mtime helpers or the workspace-state clock seam this
branch changes, so the merge is clean.
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.

3 participants