Skip to content

fix(pnpr): link one SQLite, libsql's, in place of rusqlite's bundled one - #17591

Closed
zkochan wants to merge 1 commit into
mainfrom
pnpr/single-sqlite
Closed

zkochan wants to merge 1 commit into
mainfrom
pnpr/single-sqlite

Conversation

@zkochan

@zkochan zkochan commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to the SQL metadata stack (#17577, #17578, #17580, #17583, #17585, all merged). Related to pnpm/tasks#244.

pnpr links libsql's SQLite (libsql-ffi, SQLite 3.45.1 with libsql's changes) for the embedded replica. rusqlite brought a second bundled SQLite (libsqlite3-sys, 3.51.3) that defines the same sqlite3_* symbols. A build linked only while libsql's archive came first on the link line, which is why pnpr-libsql loaded pnpr-error (and the rusqlite its server feature brings) ahead of libsql. In the linked pnpr binary, rusqlite, compiled against 3.51.3 headers, already ran on libsql's 3.45.1 code.

This PR makes libsql-rusqlite, rusqlite's API over libsql's SQLite from the same libsql revision, the only SQLite crate in the workspace:

  • pnpr-error, pnpr-auth, pnpr-storage, and pnpr use libsql-rusqlite. Its library is named rusqlite, so no source changes.
  • pnpm-store-dir moves too. pnpr's resolver opens a StoreDir, so its store index is in pnpr's binary. With only the pnpr crates moved, the pnpr binary pulls both SQLite objects and fails on duplicate symbols.
  • rusqlite and libsqlite3-sys leave Cargo.lock, and pnpr-libsql drops its link-order workaround. The pnpr binary contains one SQLite source id.
  • The fork has no Connection::total_changes, so the store-index tests read total_changes() through SQL.
  • libsql-ffi applies WASI flags only for the wasm32-wasi target. The wasm builds pass the flags rusqlite's build added for every WASI target through LIBSQLITE3_FLAGS (pnpm/wasm/sqlite-flags.mjs).

Open: this changes the pnpm CLI's SQLite

Because pnpm-store-dir is shared, the pnpm CLI's store index moves from SQLite 3.51.3 to libsql's 3.45.1 fork. That needs a decision before this leaves draft:

  • wasm32-wasip1-threads does not build yet. libsql keeps WAL enabled under WASI ("we do support WAL mode, we just don't support shared memory"), but its shared-memory code still calls mmap, which upstream SQLite compiles out under WASI. The flags above are not enough; bundled/src/sqlite3.c fails on PROT_READ/MAP_SHARED. Fixing it needs a change to libsql-ffi in the pnpm/libsql fork.
  • WAL checkpoints behave differently. libsql builds with LIBSQL_CHECKPOINT_ONLY_FULL, which aborts a checkpoint unless it can checkpoint the whole WAL. A reader holding an old snapshot blocks autocheckpoints, so the store index's WAL can grow under concurrent installs.

The alternatives keep the pnpm CLI on rusqlite but do not give pnpr a single SQLite: a pnpm-store-dir feature that picks its SQLite crate is unified on in every workspace-wide build, which puts both SQLite archives back into those test binaries.

Squash Commit Body

pnpr links libsql's SQLite for the embedded replica, and rusqlite brought
a second bundled SQLite that defines the same symbols. The build linked
only while libsql's archive came first on the link line, so pnpr-libsql
loaded pnpr-error ahead of libsql to keep that order, and rusqlite, built
against SQLite 3.51 headers, then ran on libsql's 3.45 code.

Every crate that used rusqlite now uses libsql-rusqlite, rusqlite's API
over libsql's SQLite, from the same libsql revision. That includes
pnpm-store-dir, whose store index pnpr's resolver opens, so rusqlite and
libsqlite3-sys leave the dependency graph and pnpr-libsql drops its
link-order workaround. The fork has no `Connection::total_changes`, so
the store-index tests read `total_changes()` through SQL.

libsql-ffi applies WASI flags only for the `wasm32-wasi` target, so the
wasm builds pass the flags rusqlite's build added for every WASI target
through `LIBSQLITE3_FLAGS`.

Related to pnpm/tasks#244.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • 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.

Tests: pnpm test:rust over every pnpr-* crate plus pnpm-registry-mock and pnpm-store-dir (2129 passed). Rust CI and TS CI pass on all three platforms; only the WebContainers job, which builds pnpm for wasm, fails, as described above. pnpm/wasm/build.mjs --check with WASI SDK 34 fails in libsql-ffi as described above. No changeset yet: whether the pnpm CLI's SQLite change needs a release note depends on the open decision.

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

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@garnet-runtime-review

garnet-runtime-review Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Nothing new recorded

0 of 1 recorded job changed
Garnet records 1 of 19 TS CI jobs
At d0e8bd5, compared with the last 10 recorded runs on main (latest 70a2200)
Recorded at the kernel (best-effort capture)

TS CI / Test / ubuntu (24.0.0, 2) / Node 24 / chunk 2/3 · nothing new

Workload · 70a2200 → d0e8bd5

  bash
  ├─ rustup
  │  └─ dualstack.k.sni.global.fastly[.]net
  └─ MainThread › pn
     ├─ dash › node
     │  ├─ node › node
     │  │  ├─ dash › node
     │  │  │  └─ registry.npmjs[.]org
     │  │  ├─ git
     │  │  │  ├─ git › git › git-remote-http
     │  │  │  │  └─ github[.]com
     │  │  │  └─ 192.168.127[.]1
     │  │  ├─ pnpr
     │  │  │  └─ registry.npmjs[.]org
     │  │  ├─ codeload.github[.]com
     │  │  ├─ github[.]com
     │  │  └─ registry.npmjs[.]org
     │  └─ pn › node
     │     ├─ dash
     │     │  ├─ dash › node
     │     │  │  └─ nodejs[.]org
     │     │  └─ node
     │     │     └─ registry.npmjs[.]org
     │     ├─ git
     │     │  ├─ git
     │     │  │  ├─ git › git-remote-http
     │     │  │  │  └─ github[.]com
     │     │  │  └─ 192.168.127[.]1
     │     │  └─ 192.168.127[.]1
     │     ├─ node
     │     │  ├─ git › git › git-remote-http
     │     │  │  └─ github[.]com
     │     │  ├─ node
     │     │  │  └─ registry.npmjs[.]org
     │     │  ├─ codeload.github[.]com
     │     │  ├─ github[.]com
     │     │  └─ unofficial-builds.nodejs[.]org
     │     ├─ pnpr
     │     │  └─ registry.npmjs[.]org
     │     ├─ codeload.github[.]com
     │     ├─ github[.]com
     │     ├─ nodejs[.]org
     │     ├─ registry.npmjs[.]org
     │     └─ unofficial-builds.nodejs[.]org
     └─ nodejs[.]org

  systemd
  ├─ bash › bash › bash › bash › bash › bash
  │  ├─ bash
  │  │  ├─ gh
  │  │  │  └─ api.github[.]com
  │  │  └─ node
  │  │     ├─ git
  │  │     │  ├─ git › git › git-remote-http
  │  │     │  │  └─ github[.]com
  │  │     │  └─ 192.168.127[.]1
  │  │     └─ pn
  │  │        ├─ dash › node › pn
  │  │        │  ├─ dash › pn › dash › pnpm › dash › node
  │  │        │  │  ├─ codeload.github[.]com
  │  │        │  │  └─ registry.npmjs[.]org
  │  │        │  └─ node
  │  │        │     ├─ node
  │  │        │     │  └─ registry.npmjs[.]org
  │  │        │     └─ pnpr
  │  │        │        └─ registry.npmjs[.]org
  │  │        └─ nodejs[.]org
  │  └─ node
  │     ├─ pnpm
  │     │  ├─ dash › node › dash › node
  │     │  │  └─ nodejs[.]org
  │     │  ├─ git
  │     │  │  ├─ git › git › git-remote-http
  │     │  │  │  └─ github[.]com
  │     │  │  └─ 192.168.127[.]1
  │     │  ├─ dualstack.k.sni.global.fastly[.]net
  │     │  ├─ nodejs[.]org
  │     │  ├─ registry.npmjs[.]org
  │     │  └─ unofficial-builds.nodejs[.]org
  │     ├─ blacksmith.blob.core.windows[.]net
  │     └─ registry.npmjs[.]org
  └─ git
     └─ 192.168.127[.]1

  node › node
  └─ registry.npmjs[.]org

Runner & GitHub's own traffic · blacksmith-8vcpu-ubuntu-2404 · Linux X64

  node
  └─ productionresultssa19.blob.core[.]windows (github infra)

  MainThread
  └─ productionresultssa16.blob.core[.]windows (github infra)

  systemd
  ├─ chronyd
  │  ├─ 144.202.66[.]214
  │  ├─ 162.254.225[.]152
  │  ├─ 169[.]254[.]169[.]123
  │  ├─ 170.187.147[.]56
  │  ├─ 185.125.190[.]56
  │  ├─ 185.125.190[.]57
  │  ├─ 185.125.190[.]58
  │  ├─ 192.231.84[.]118
  │  ├─ 209.51.161[.]238
  │  ├─ 23.159.16[.]194
  │  ├─ 23.168.24[.]210
  │  ├─ 23.186.168[.]126
  │  └─ 91.189.91[.]157
  ├─ nginx › nginx
  │  ├─ 140.82.112[.]22
  │  ├─ 140.82.113[.]21
  │  ├─ 140.82.113[.]22
  │  ├─ 140.82.114[.]21
  │  ├─ 140.82.114[.]22
  │  ├─ 192.168.127[.]1
  │  ├─ 8.8.8[.]8
  │  └─ results-receiver.actions[.]githubusercontent (github infra)
  ├─ snapd
  │  └─ api.snapcraft[.]io
  ├─ sudo › sudo
  │  └─ 192.168.127[.]1
  └─ systemd-resolve
     └─ 8.8.8[.]8

Job log · Full record in Garnet ↗


How to read this
bash › curl                 ← ancestry as captured, then the process that acted
└─ example[.]com            ← what it reached

Read down: what ran, then what it reached. + only in this commit · − only in the compared run · unmarked in both. Runner & GitHub's own traffic is activity outside your steps and never counts. · Docs ↗

Recorded by Garnet · Add it to your CI ↗

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     15.1±1.08ms    24.9 MB/sec    1.01     15.2±0.98ms    24.6 MB/sec
packument/parse                                  1.10     47.9±3.90µs  1385.7 MB/sec    1.00     43.7±3.92µs  1518.9 MB/sec
tarball/download_dependency                      1.00  852.9±112.17µs     5.0 MB/sec    1.15  984.6±107.77µs     4.3 MB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   232.2±14.40ms 68.9 KElem/sec    1.04    241.6±9.34ms 66.2 KElem/sec
version_pick/repeated_ranges_file                1.05      4.9±0.45ms  6.4 KElem/sec    1.00      4.6±0.09ms  6.8 KElem/sec
version_pick/repeated_ranges_raw                 1.00      4.6±0.23ms  6.8 KElem/sec    1.00      4.6±0.09ms  6.7 KElem/sec
workspace_resolution/hoist_heavy                 1.00   310.9±24.32ms        ? ?/sec    1.03    320.6±5.75ms        ? ?/sec
workspace_sort/chained_projects                  1.03     15.8±1.97ms        ? ?/sec    1.00     15.4±2.21ms        ? ?/sec

@blacksmith-sh

This comment has been minimized.

@codecov-commenter

codecov-commenter commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.75%. Comparing base (70a2200) to head (d0e8bd5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17591   +/-   ##
=======================================
  Coverage   92.75%   92.75%           
=======================================
  Files        2033     2033           
  Lines      262192   262192           
=======================================
+ Hits       243192   243198    +6     
+ Misses      19000    18994    -6     

☔ 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 Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2402.58 ms 2254.54 ms -6.2% 120.13 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1388.07 ms 1338.69 ms -3.6% 69.40 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 251.46 ms 247.02 ms -1.8% 12.57 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 244.98 ms 253.57 ms 3.5% 12.25 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 7.27 ms 7.40 ms 1.8% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 7.33 ms 7.33 ms -0.0% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 7.52 ms 7.78 ms 3.5% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 7.57 ms 7.56 ms -0.1% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2584.95 ms 2589.17 ms 0.2% 129.25 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1499.78 ms 1665.53 ms 11.1% 74.99 ms Inconclusive (overlapping samples)
isolated-fresh-install-hot-cache-hot-store pacquet 659.02 ms 649.25 ms -1.5% 32.95 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 376.65 ms 365.98 ms -2.8% 18.83 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1689.03 ms 1692.59 ms 0.2% 84.45 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 315.18 ms 322.93 ms 2.5% 15.76 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 272.77 ms 269.10 ms -1.3% 13.64 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 95.75 ms 94.62 ms -1.2% 4.79 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 265.01 ms 250.02 ms -5.7% 13.25 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 102.72 ms 104.41 ms 1.6% 5.14 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 97.75 ms 97.34 ms -0.4% 4.89 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4521.41 ms 4551.54 ms 0.7% 226.07 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3637.68 ms 3728.59 ms 2.5% 181.88 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 154.44 ms 168.37 ms 9.0% 7.72 ms Inconclusive (overlapping samples)
gvs-fresh-restore-hot-cache-hot-store pnpr 172.26 ms 169.38 ms -1.7% 8.61 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1323.81 ms 1324.33 ms 0.0% 66.19 ms Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet 31.57 ms 30.29 ms -4.0% 2.00 ms Within tolerance

Same-run syscall check

Each install runs 2 more times per revision, untimed, under strace --follow-forks --summary-only. A file syscall regresses when HEAD's fewest calls exceed main's most by more than 2% of main or 50 calls, whichever is larger. mkdir and mkdirat count only the calls that created a directory, since concurrent installs fail a varying number with EEXIST. A syscall whose identical runs differ by more than that tolerance is reported unstable and not gated, unless HEAD's fewest calls also exceed main's most by more than the tolerance plus that difference. Each scenario lists its largest change relative to its tolerance and every row that is not within tolerance.

Scenario Engine Syscall main calls (max) HEAD calls (min) Change Tolerance Identical-run spread Result
isolated-fresh-restore-cold-cache-cold-store pacquet symlink 3896 3900 +0.1% 77 5 Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr statx 95180 95181 +0.0% 1903 23 Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr statx 48986 48987 +0.0% 979 6 Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet readlink 15614 15649 +0.2% 312 107 Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet openat 3165 3177 +0.4% 63 5 Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet readlink 15279 15291 +0.1% 305 38 Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr access 11 11 +0.0% 50 0 Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet symlink 1151 1152 +0.1% 50 0 Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet access 22 22 +0.0% 50 0 Within tolerance

Integrated-Benchmark Report (Linux)

Commit: d0e8bd591e40

Compared against main at: 70a2200088ae

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.276 ± 0.084 2.187 2.428 1.66 ± 0.17
pacquet@main 2.403 ± 0.128 2.226 2.571 1.75 ± 0.19
pnpr@HEAD 1.370 ± 0.129 1.245 1.632 1.00
pnpr@main 1.386 ± 0.124 1.240 1.566 1.01 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.27586701164,
      "stddev": 0.08447022160455829,
      "median": 2.25454197844,
      "user": 1.6087502400000002,
      "system": 1.2284551599999998,
      "min": 2.18696432744,
      "max": 2.42779988344
    },
    {
      "command": "pacquet@main",
      "mean": 2.4029612527400004,
      "stddev": 0.12807066989030358,
      "median": 2.40258051744,
      "user": 1.6403762399999997,
      "system": 1.19337706,
      "min": 2.22616989644,
      "max": 2.57090368744
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.36964342044,
      "stddev": 0.12931570203362625,
      "median": 1.3386941009400002,
      "user": 1.5438561399999997,
      "system": 1.2119872600000001,
      "min": 1.2452906534400001,
      "max": 1.6323868394400003
    },
    {
      "command": "pnpr@main",
      "mean": 1.3862503823400003,
      "stddev": 0.12357784942531246,
      "median": 1.3880650109400001,
      "user": 1.58091594,
      "system": 1.15266006,
      "min": 1.2397960434400002,
      "max": 1.5657976784400003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 248.0 ± 8.4 237.5 263.2 1.00
pacquet@main 251.8 ± 10.3 238.5 270.5 1.02 ± 0.05
pnpr@HEAD 254.1 ± 10.5 239.1 275.0 1.02 ± 0.05
pnpr@main 248.4 ± 7.9 240.3 260.9 1.00 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24796132436,
      "stddev": 0.008419591194876255,
      "median": 0.24702216786,
      "user": 0.28949803999999996,
      "system": 0.5958119199999999,
      "min": 0.23746381236000003,
      "max": 0.26324515236
    },
    {
      "command": "pacquet@main",
      "mean": 0.25176543246000005,
      "stddev": 0.010278546971131203,
      "median": 0.25146405486,
      "user": 0.27308744,
      "system": 0.63022102,
      "min": 0.23854599536000004,
      "max": 0.27045268036000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2541027718600001,
      "stddev": 0.01050049904063482,
      "median": 0.25356625036,
      "user": 0.27530194,
      "system": 0.56303342,
      "min": 0.23906451636000003,
      "max": 0.27499795236
    },
    {
      "command": "pnpr@main",
      "mean": 0.24842653386000008,
      "stddev": 0.007917824737935201,
      "median": 0.24498099736,
      "user": 0.28324463999999994,
      "system": 0.5500331199999999,
      "min": 0.24031028036000002,
      "max": 0.26085708536
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 7.5 ± 0.8 7.0 15.1 1.03 ± 0.11
pacquet@main 7.3 ± 0.2 6.9 8.7 1.00
pnpr@HEAD 7.4 ± 0.3 6.9 9.2 1.01 ± 0.05
pnpr@main 7.4 ± 0.2 7.0 9.2 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.007545101093695654,
      "stddev": 0.0007638293661536549,
      "median": 0.007404821360000001,
      "user": 0.004890732608695652,
      "system": 0.003357228695652172,
      "min": 0.00697016586,
      "max": 0.015135446860000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.007307785875974437,
      "stddev": 0.00022292170870885606,
      "median": 0.00727296986,
      "user": 0.00453506741214057,
      "system": 0.0034509504792332264,
      "min": 0.0069087598600000005,
      "max": 0.008700876860000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.007379330264891305,
      "stddev": 0.0002888011905775023,
      "median": 0.00732703736,
      "user": 0.004819365760869565,
      "system": 0.0032325584239130444,
      "min": 0.00688304186,
      "max": 0.009226093860000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.007355381402613631,
      "stddev": 0.0002482479140817297,
      "median": 0.00732786436,
      "user": 0.0046366204545454535,
      "system": 0.0034029310795454545,
      "min": 0.00695579186,
      "max": 0.009213542860000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 7.9 ± 0.3 7.4 9.4 1.04 ± 0.07
pacquet@main 7.6 ± 0.4 7.1 11.2 1.00
pnpr@HEAD 7.6 ± 0.3 7.2 10.6 1.00 ± 0.07
pnpr@main 7.6 ± 0.3 7.1 10.3 1.00 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.00787066738142348,
      "stddev": 0.0003355964371096063,
      "median": 0.007783394780000001,
      "user": 0.004467013096085407,
      "system": 0.004148228612099641,
      "min": 0.007382081780000001,
      "max": 0.00944809578
    },
    {
      "command": "pacquet@main",
      "mean": 0.007596395747426702,
      "stddev": 0.0004272913574775019,
      "median": 0.007517504780000002,
      "user": 0.004999048729641693,
      "system": 0.003263017328990226,
      "min": 0.007124326780000001,
      "max": 0.01124800878
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.007610122071262139,
      "stddev": 0.0002916080444508587,
      "median": 0.00756195978,
      "user": 0.004533102006472491,
      "system": 0.003726399482200646,
      "min": 0.00715932178,
      "max": 0.010647330780000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.007614699065714292,
      "stddev": 0.0002918749246887816,
      "median": 0.007566572780000001,
      "user": 0.004801994285714287,
      "system": 0.003475820544217685,
      "min": 0.00713349278,
      "max": 0.01030601878
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.584 ± 0.036 2.535 2.641 1.72 ± 0.11
pacquet@main 2.584 ± 0.015 2.559 2.615 1.72 ± 0.11
pnpr@HEAD 1.609 ± 0.162 1.415 1.800 1.07 ± 0.13
pnpr@main 1.500 ± 0.092 1.369 1.706 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5842492891399997,
      "stddev": 0.03649156988186126,
      "median": 2.58916539974,
      "user": 2.50273972,
      "system": 1.7626021199999997,
      "min": 2.53519442324,
      "max": 2.64068944824
    },
    {
      "command": "pacquet@main",
      "mean": 2.5843764478399995,
      "stddev": 0.01478594203479297,
      "median": 2.58494891374,
      "user": 2.5051971199999996,
      "system": 1.70201952,
      "min": 2.55909702024,
      "max": 2.61498117924
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6086397312400003,
      "stddev": 0.16227935733637633,
      "median": 1.66553439224,
      "user": 1.9662470200000002,
      "system": 1.5191147199999997,
      "min": 1.4148911692400001,
      "max": 1.7995169212400002
    },
    {
      "command": "pnpr@main",
      "mean": 1.50044277204,
      "stddev": 0.0921801023609065,
      "median": 1.4997824467400003,
      "user": 1.9233690199999998,
      "system": 1.4287721199999999,
      "min": 1.3694568412400001,
      "max": 1.7056647452400002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 643.7 ± 20.2 616.3 670.4 1.75 ± 0.08
pacquet@main 669.1 ± 47.2 600.5 742.4 1.81 ± 0.14
pnpr@HEAD 368.8 ± 13.3 353.1 393.3 1.00
pnpr@main 369.4 ± 22.2 326.2 392.8 1.00 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6437274296600001,
      "stddev": 0.020232253628720335,
      "median": 0.6492542168600001,
      "user": 0.97249934,
      "system": 1.40457418,
      "min": 0.6163442483600001,
      "max": 0.6704145973600001
    },
    {
      "command": "pacquet@main",
      "mean": 0.6690636776600001,
      "stddev": 0.0472093409947614,
      "median": 0.65901503036,
      "user": 0.9880226400000002,
      "system": 1.44837618,
      "min": 0.60047451236,
      "max": 0.74240698136
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.36877358316000003,
      "stddev": 0.0133297891551546,
      "median": 0.36598034886,
      "user": 0.3709384399999999,
      "system": 0.7129574799999999,
      "min": 0.35307876836,
      "max": 0.39326859736
    },
    {
      "command": "pnpr@main",
      "mean": 0.36943301846,
      "stddev": 0.02221475154817578,
      "median": 0.37665164086,
      "user": 0.37604874,
      "system": 0.73869178,
      "min": 0.32622036836,
      "max": 0.39279229636
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.692 ± 0.039 1.631 1.772 5.39 ± 0.19
pacquet@main 1.697 ± 0.024 1.668 1.747 5.40 ± 0.17
pnpr@HEAD 0.324 ± 0.016 0.303 0.348 1.03 ± 0.06
pnpr@main 0.314 ± 0.009 0.304 0.330 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.69186146582,
      "stddev": 0.039389547285507344,
      "median": 1.69258587222,
      "user": 1.02538536,
      "system": 0.9790917199999998,
      "min": 1.63104119172,
      "max": 1.7722426177200001
    },
    {
      "command": "pacquet@main",
      "mean": 1.6974981184200004,
      "stddev": 0.024228202417557937,
      "median": 1.68903083672,
      "user": 1.05757196,
      "system": 1.0171591199999999,
      "min": 1.66820717272,
      "max": 1.74735786472
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32370427972000004,
      "stddev": 0.015727963971801335,
      "median": 0.32292765372,
      "user": 0.31778285999999994,
      "system": 0.6188087199999999,
      "min": 0.30252264572000004,
      "max": 0.34840878372
    },
    {
      "command": "pnpr@main",
      "mean": 0.3140925117200001,
      "stddev": 0.008614112913011987,
      "median": 0.31518198472000003,
      "user": 0.2912016599999999,
      "system": 0.6306966199999999,
      "min": 0.30423053672,
      "max": 0.33034504272000004
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 267.4 ± 15.0 229.5 284.7 2.82 ± 0.18
pacquet@main 275.4 ± 14.9 254.1 299.8 2.91 ± 0.18
pnpr@HEAD 94.7 ± 3.1 88.6 103.8 1.00
pnpr@main 96.3 ± 3.3 91.1 104.8 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.26742300428666665,
      "stddev": 0.014984102792703565,
      "median": 0.26910336962000003,
      "user": 0.27722163333333333,
      "system": 0.29890484999999994,
      "min": 0.22950792862000002,
      "max": 0.28465452562
    },
    {
      "command": "pacquet@main",
      "mean": 0.27539048132,
      "stddev": 0.014924000692562934,
      "median": 0.27276940161999996,
      "user": 0.2749298,
      "system": 0.3276668,
      "min": 0.25409751662,
      "max": 0.29979389062
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09471958208666667,
      "stddev": 0.0030503021835640324,
      "median": 0.09462487512000001,
      "user": 0.0376784,
      "system": 0.025025029999999997,
      "min": 0.08857232662,
      "max": 0.10379491662000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.09633131882000004,
      "stddev": 0.0033028684969161675,
      "median": 0.09575008762000001,
      "user": 0.04041403333333334,
      "system": 0.02371729333333333,
      "min": 0.09106324362,
      "max": 0.10481703662
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 256.5 ± 20.4 228.9 302.1 1.00
pacquet@main 262.1 ± 8.2 245.5 272.7 1.02 ± 0.09
pnpm@HEAD 4312.7 ± 326.1 3903.0 4962.6 16.81 ± 1.84
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25653830228888885,
      "stddev": 0.020358577886889304,
      "median": 0.25001763540000005,
      "user": 0.29072967555555557,
      "system": 0.07187637777777778,
      "min": 0.22886768540000002,
      "max": 0.3021486004
    },
    {
      "command": "pacquet@main",
      "mean": 0.26214366117777776,
      "stddev": 0.00818116102650697,
      "median": 0.26501014540000006,
      "user": 0.3047302311111111,
      "system": 0.05563726666666666,
      "min": 0.24550266340000002,
      "max": 0.27269269240000005
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.312698202733333,
      "stddev": 0.32614602416018873,
      "median": 4.2232914214,
      "user": 6.682798453333332,
      "system": 0.4327840444444444,
      "min": 3.9029597114,
      "max": 4.9626056034
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 105.3 ± 11.5 87.2 128.7 1.03 ± 0.15
pacquet@main 101.9 ± 10.0 86.0 125.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.1053218683036364,
      "stddev": 0.011457097118245945,
      "median": 0.10440875494000001,
      "user": 0.09643612181818183,
      "system": 0.054820021818181804,
      "min": 0.08724635494,
      "max": 0.12871658394000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.10187919209384615,
      "stddev": 0.010023790187136615,
      "median": 0.10272377044,
      "user": 0.09582417076923075,
      "system": 0.05168299384615384,
      "min": 0.08600250394,
      "max": 0.12539865494000002
    }
  ]
}

Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 98.1 ± 5.5 89.8 111.5 1.00
pacquet@main 98.8 ± 6.8 89.9 117.9 1.01 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.0981255247648276,
      "stddev": 0.005499841724448653,
      "median": 0.09734027142000001,
      "user": 0.0366361675862069,
      "system": 0.06955889103448275,
      "min": 0.08983130042000001,
      "max": 0.11150773542000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.09878172705333335,
      "stddev": 0.006848240155304706,
      "median": 0.09775073242000001,
      "user": 0.03599840666666666,
      "system": 0.07102372666666665,
      "min": 0.08989310542000001,
      "max": 0.11787354842000002
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.627 ± 0.196 4.400 4.899 1.26 ± 0.06
pacquet@main 4.581 ± 0.170 4.411 4.873 1.25 ± 0.05
pnpr@HEAD 3.762 ± 0.102 3.643 3.927 1.03 ± 0.03
pnpr@main 3.661 ± 0.065 3.576 3.762 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.6274521138,
      "stddev": 0.19578919317476157,
      "median": 4.5515433649000006,
      "user": 2.11174644,
      "system": 1.6334415199999999,
      "min": 4.400056198400001,
      "max": 4.899437460400001
    },
    {
      "command": "pacquet@main",
      "mean": 4.580693095,
      "stddev": 0.1704548700157253,
      "median": 4.5214064599,
      "user": 2.1709390399999995,
      "system": 1.6619525200000003,
      "min": 4.4106555354,
      "max": 4.8728036314
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.761503897800001,
      "stddev": 0.10202093168900501,
      "median": 3.7285874999000006,
      "user": 2.50332394,
      "system": 1.9562541199999999,
      "min": 3.6431841774000002,
      "max": 3.9271948314000005
    },
    {
      "command": "pnpr@main",
      "mean": 3.661188759900001,
      "stddev": 0.06534183274699733,
      "median": 3.6376814454,
      "user": 2.2435270400000005,
      "system": 1.8099922199999998,
      "min": 3.5761250484000002,
      "max": 3.7615550384
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 168.4 ± 10.0 146.5 189.0 1.09 ± 0.13
pacquet@main 155.2 ± 16.5 131.6 195.1 1.00
pnpr@HEAD 169.1 ± 7.5 156.9 188.8 1.09 ± 0.13
pnpr@main 174.6 ± 9.9 162.5 195.6 1.12 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.16842743749333336,
      "stddev": 0.00998594210764692,
      "median": 0.16837092656000002,
      "user": 0.21131523333333332,
      "system": 0.17140223333333332,
      "min": 0.14649978356,
      "max": 0.18903273156000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.1552120877952941,
      "stddev": 0.016451250643244566,
      "median": 0.15443718056000003,
      "user": 0.19666811176470583,
      "system": 0.1584845823529412,
      "min": 0.13156965656000003,
      "max": 0.19509585056
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.16913587589333337,
      "stddev": 0.0075132558513633435,
      "median": 0.16937915756000002,
      "user": 0.20769876666666665,
      "system": 0.14773483333333332,
      "min": 0.15690334056000002,
      "max": 0.18883138256
    },
    {
      "command": "pnpr@main",
      "mean": 0.17458478329333335,
      "stddev": 0.00988573810926329,
      "median": 0.17225972656000002,
      "user": 0.2145151,
      "system": 0.15061556666666664,
      "min": 0.16253134856,
      "max": 0.19555131056000002
    }
  ]
}

Scenario: Store only: unlocked direct deps, cold cache + hot store

Store-only install (enableModulesDir: false, per-file store index, trusted lockfile) against a lockfile missing the direct dependencies that have peers, with the metadata cache wiped per iteration: the install resolves those from the registry, reuses their subtrees from the lockfile and checks the store, linking nothing. Direct installs only.

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.338 ± 0.050 1.285 1.433 1.01 ± 0.06
pacquet@main 1.328 ± 0.060 1.218 1.433 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.33807733684,
      "stddev": 0.04995884744510989,
      "median": 1.32433467844,
      "user": 0.7287893,
      "system": 0.32238266000000004,
      "min": 1.28467295744,
      "max": 1.4329041954400001
    },
    {
      "command": "pacquet@main",
      "mean": 1.3276052119400004,
      "stddev": 0.06030879110087609,
      "median": 1.32381277694,
      "user": 0.6937816000000001,
      "system": 0.32919425999999996,
      "min": 1.2180138604400002,
      "max": 1.4329243524400002
    }
  ]
}

Scenario: Cargo: repeat install, hot cache + hot store

Frozen repeat install of a Cargo workspace (cargo.enabled: true) whose crates are already materialized in <storeDir>/v11/crates/ and linked into .pnpm/crates/crates-io. Direct installs only.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 30.9 ± 2.7 27.7 44.5 1.00
pacquet@main 32.2 ± 2.5 27.9 42.4 1.04 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.030943618331034466,
      "stddev": 0.002713457472994319,
      "median": 0.030292534400000005,
      "user": 0.023054851724137924,
      "system": 0.016194708965517248,
      "min": 0.027682412400000002,
      "max": 0.0445441274
    },
    {
      "command": "pacquet@main",
      "mean": 0.03215297213469388,
      "stddev": 0.0025125346744219617,
      "median": 0.03156965590000001,
      "user": 0.023781759183673458,
      "system": 0.017011266122448975,
      "min": 0.027946332400000003,
      "max": 0.042360596400000006
    }
  ]
}

@zkochan
zkochan force-pushed the pnpr/single-sqlite branch from 8c51510 to 9f1dddf Compare November 3, 2026 00:58
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch 2 times, most recently from 339fcf1 to 764228e Compare November 3, 2026 01:11
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch from 9f1dddf to d00e0e1 Compare November 3, 2026 01:11
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from 764228e to a410d70 Compare November 3, 2026 01:26
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch 2 times, most recently from a47456c to fda88ab Compare November 3, 2026 01:36
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from a410d70 to afb829e Compare November 3, 2026 01:36
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch from fda88ab to ad8dae1 Compare November 3, 2026 01:43
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from afb829e to 257fd96 Compare November 3, 2026 01:43
@blacksmith-sh

This comment has been minimized.

@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from 257fd96 to 70d6df2 Compare November 3, 2026 01:56
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch 2 times, most recently from 0bc3e52 to e1ededc Compare November 3, 2026 02:07
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from 70d6df2 to ba5e3a3 Compare November 3, 2026 02:07
@blacksmith-sh

This comment has been minimized.

@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from ba5e3a3 to 090bfb1 Compare November 3, 2026 02:28
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch from e1ededc to a4a9303 Compare November 3, 2026 02:28
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from 090bfb1 to e94b0b5 Compare November 3, 2026 03:06
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch from a4a9303 to 2c444ee Compare November 3, 2026 03:06
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from e94b0b5 to aafc1a7 Compare November 3, 2026 03:21
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch 2 times, most recently from 5fe5144 to e14cc6b Compare November 3, 2026 03:58
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch 2 times, most recently from 08bf58d to dd75a74 Compare November 3, 2026 04:07
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch from e14cc6b to 817b252 Compare November 3, 2026 04:07
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from dd75a74 to 9964d53 Compare November 3, 2026 04:11
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch 2 times, most recently from 03715de to ae221cc Compare November 3, 2026 04:24
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch 2 times, most recently from db41ff7 to 65c1dbc Compare November 3, 2026 04:38
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch from ae221cc to 92f7d71 Compare November 3, 2026 04:38
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from 65c1dbc to 63c0955 Compare November 3, 2026 05:16
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch 2 times, most recently from 1545499 to cab8b8c Compare November 3, 2026 05:52
@zkochan
zkochan force-pushed the pnpr/sql-metadata-conformance branch from 63c0955 to 88fcffa Compare November 3, 2026 05:52
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch from cab8b8c to efadc9b Compare November 3, 2026 06:06
Base automatically changed from pnpr/sql-metadata-conformance to main November 3, 2026 06:41
pnpr links libsql's SQLite for the embedded replica, and rusqlite brought
a second bundled SQLite that defines the same symbols. The build linked
only while libsql's archive came first on the link line, so pnpr-libsql
loaded pnpr-error ahead of libsql to keep that order, and rusqlite, built
against SQLite 3.51 headers, then ran on libsql's 3.45 code.

Every crate that used rusqlite now uses libsql-rusqlite, rusqlite's API
over libsql's SQLite, from the same libsql revision. That includes
pnpm-store-dir, whose store index pnpr's resolver opens, so rusqlite and
libsqlite3-sys leave the dependency graph and pnpr-libsql drops its
link-order workaround. The fork has no `Connection::total_changes`, so
the store-index tests read `total_changes()` through SQL.

libsql-ffi applies WASI flags only for the `wasm32-wasi` target, so the
wasm builds pass the flags rusqlite's build added for every WASI target
through `LIBSQLITE3_FLAGS`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zkochan
zkochan force-pushed the pnpr/single-sqlite branch from efadc9b to d0e8bd5 Compare November 3, 2026 06:44
@zkochan

zkochan commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Status: the stack below has merged, and this PR now targets main. It stays a draft until a maintainer decides one question.

Whether the pnpm CLI's store index moves to libsql's SQLite. Single SQLite in pnpr needs pnpm-store-dir on it too, since pnpr's resolver opens a StoreDir; with only the pnpr crates moved, the pnpr binary fails to link on duplicate SQLite symbols. Moving pnpm-store-dir changes pnpm's SQLite from 3.51.3 to libsql's 3.45.1 fork, which:

  • builds with LIBSQL_CHECKPOINT_ONLY_FULL, so a reader on an old snapshot blocks WAL autocheckpoints of the store index, and
  • does not compile for wasm32-wasip1-threads (libsql keeps WAL under WASI, but its shared-memory code still calls mmap). That needs a change to libsql-ffi in the pnpm/libsql fork.

Everything else is done: Rust CI and TS CI pass on all three platforms at d0e8bd5, rusqlite and libsqlite3-sys are out of Cargo.lock, the pnpr binary carries one SQLite, and pnpr-libsql no longer orders its dependencies. The WebContainers job fails on the wasm build as described.

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

@zkochan

zkochan commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Parked as a draft. This works, but moving everything onto one SQLite costs the pnpm CLI more than it gains pnpr:

  • pnpm-store-dir would move from upstream SQLite 3.51 to libsql's 3.45.1 fork. The store index is on every install's hot path.
  • The fork only checkpoints when it can take the whole WAL. One slow reader blocks the store index's automatic checkpoints, so the WAL can keep growing during concurrent installs.
  • The wasm build needs a libsql-ffi patch in our fork, because the fork calls mmap under WASI.

pnpr links today through the documented dependency-order workaround in pnpr-libsql. That workaround is fragile, and inside the pnpr binary rusqlite (built against 3.51) runs on libsql's 3.45 code. So the current state isn't free either.

Revisit this when one of these happens:

  • libsql rebases onto a current SQLite;
  • pnpr stops opening the store index through rusqlite;
  • the link-order workaround breaks.

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

@zkochan

zkochan commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Closing. The problem is still on main, but this approach now costs more than when it was parked:

  • chore(cargo): bump rusqlite from 0.39.0 to 0.42.0 #18278 (rusqlite 0.42) worked around a fresh link break by bundling SQLite through libsqlite3-sys. Inside the pnpr binary, rusqlite is now built against SQLite 3.54 headers and runs on libsql's 3.45 code.
  • Main added pnpm-ffi-sqlite and a WASI-specific store-index lease, so moving to libsql-rusqlite would migrate more code and still needs a libsql-ffi WASI patch.
  • The pnpm CLI's store index would still drop to libsql's 3.45 fork with full-WAL-only checkpoints.

Duplicate SQLite symbols already fail the link in Rust CI, as they did on #18278. A one-SQLite binary check would only repeat that, so none is added. This is tracked for a revisit if libsql rebases onto a current SQLite, pnpr stops opening the store index through rusqlite, or the current workaround breaks.


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

@zkochan zkochan closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants