Repository navigation
Conversation
pnpm 12.8.0 doubled the statx calls of a hot-store install (pnpm#17500) while the timing check stayed within tolerance: on a warm page cache a stat costs about a microsecond, so 67k extra calls move a 1 s install by less than the 5% noise allowance. When HEAD and main are compared, the harness now runs every install twice more, untimed, under `strace --follow-forks --summary-only`, and the run script stores the per-syscall counts in the report. The comparison adds a "Same-run syscall check" table: 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. A syscall whose two identical runs differ by more than that is reported unstable and not gated. The workflow also takes `head_ref`/`main_ref` dispatch inputs, so a past regression can be benchmarked with the current harness, and an `INTEGRATED_BENCHMARK_RUNNER` repository variable, so forks without Blacksmith runners can run it. Assisted-by: Claude:claude-opus-5-5
…links pnpm#17502 stopped the hardlink mode check from stat'ing a store file once per link, but it still stats each file once before its first link. The store verifier has read the same inode's mode a moment earlier in the same install, so an offline install of a large workspace still makes about 100k `statx` calls, against 54k in 12.7.0 (pnpm#17500). `pnpm_fs::file_mode` now keeps a process-wide map from store path to the mode last read for it. The verifier records the mode of each file it passes, and `source_has_desired_mode` reads the map before falling back to one read of its own, which it then records too. This replaces the set of linkable paths from pnpm#17502. A warm store with verify-store-integrity on goes back to one stat per blob, the 12.7.0 count; with it off, each blob is still stat'ed only once however many packages link it. The mode comparison itself is unchanged. The map is process-global because the verifier and the importer run in different install-scoped contexts, the same reason the CAS write locks live in `pnpm_fs`. Threading the mode down to `import_indexed_dir` instead would change the `FilesMap` shape at a dozen call sites across five crates. Unlike the set it replaces, a mismatched mode is remembered too: such an entry keeps being copied, now without a re-stat. A blob rewritten by another process under a different umask after this process first read it is noticed only by the next process. Assisted-by: Claude:claude-opus-5-5
…a failed check The syscall tolerance rounded 2% of main up, so a change one call above 2% of a base that is not a multiple of 50 passed (main 10001, HEAD 10202). Round it down: an integer change exceeds 2% of main exactly when it exceeds the floor of it. The harness checks its diagnostics after the traced runs. When that check failed, the runner returned before attaching the counts, so the report job threw "Expected 2 syscall count runs" and hid every table. Attach them on a failed exit too, and log why when they cannot be read. Assisted-by: Claude:claude-opus-5-5
…in_ref on main - A dispatch with head_ref measured another revision than the branch it names, so skip the Bencher upload for it. - On main the benchmark runs HEAD alone, so a main_ref compared nothing without saying so. Fail the revisions step with a message instead. - Refresh the apt index before installing strace. Assisted-by: Claude:claude-opus-5-5
- The observed store mode survives a rewrite with equal bytes, but not a mode change by another process's atomic rewrite or a chmod through a hardlink. Say so where the map is defined. - pnpr targets' syscall counts cover the client only: the server starts before the trace. - Lead the changeset with what users see, and limit the 12.7.0 parity claim to the default verify-store-integrity. Assisted-by: Claude:claude-opus-5-5
The comment workflow runs main's compare script on a PR's artifacts. Once this lands, a PR still on the old harness uploads reports without `syscalls`, and the script threw "Expected 2 syscall count runs", so the PR got no comment at all. Show "Not recorded by this run's harness" rows for those reports and keep the timing check. Counts that are present but partial or invalid still fail. Assisted-by: Claude:claude-opus-5-5
The unstable check ran before the regression check, so any run-to-run disagreement above the tolerance hid a regression of any size: main [1000, 1000] against HEAD [3000, 3100] passed as unstable. Gate first when HEAD's fewest calls exceed main's most by more than the tolerance plus the spread, a gap noise alone cannot open. A noisy syscall with a smaller gap stays unstable, and a stable one is gated exactly as before. Assisted-by: Claude:claude-opus-5-5
…table rows The previous commit added the identical-run spread to every row's threshold, so a spread within the tolerance loosened the stable gate: main [1000, 1040] vs HEAD [1091, 1091] passed although its rise of 51 exceeds the tolerance of 50. The spread now widens the gate only when it exceeds the tolerance, as the rendered description states. The description also says the listed row is the largest change relative to its tolerance, which is how it is chosen. Assisted-by: Claude:claude-opus-5-5
…ess runs Nothing removed `<target>/SYSCALL_COUNTS.<round>.txt` between runs, so a harness that failed before its traced runs in a reused work env had the previous run's counts attached to its report without a word. The runner now removes the round files of every target before starting the harness. The test of an initial failure ran in the default `bench-work-env` relative to the working directory, so it could rewrite a developer's real report there. It now uses a temporary directory, and the test of malformed counts writes them from the harness stub like the harness does. Assisted-by: Claude:claude-opus-5-5
…ommit The revisions step wrote `$(git rev-parse ...)` through echo, so a ref that did not resolve wrote an empty SHA and the step passed. The build then checked out the dispatched ref as HEAD and cached its binary under a key with an empty revision, which a later dispatch with another bad ref would restore. The step now fails and names the ref. The input descriptions say a SHA or origin/<branch>, since a fresh clone has no local branch of that name to resolve. Assisted-by: Claude:claude-opus-5-5
The comment claimed the traced runs' events never mix with the timed runs' in BENCHMARK_OUTPUT.ndjson. They do: the traced runs execute the same install script, which appends to that file. What the ordering keeps apart is the diagnostics, written from the file before the traced runs. Assisted-by: Claude:claude-opus-5-5
A blob that fails verification (missing, wrong size, digest mismatch) is re-fetched, and the re-fetch may land a new inode carrying this process's mode. The mode recorded when the blob last passed stayed in OBSERVED_STORE_MODES, so a long-lived process (pnpr) could hardlink the new inode where a copy with the wanted mode was needed. The verifier now drops the entry on every failing branch; the importer stats the new inode on its next import. Assisted-by: Claude:claude-opus-5-5
This was referenced Nov 1, 2026
The release note pointed at pnpm#17500, which pnpm#17502 closed. The remaining statx gap this change closes is tracked in pnpm#17543. Assisted-by: Claude:claude-opus-5-5
Assisted-by: Claude:claude-opus-5-5
verify_modified_file grew to 41 lines with the recorded-mode calls, one past perfectionist::overly_long_function's limit; the size check now reads metadata.len() in place, with no behaviour change. The changeset says `stat` calls, since cspell does not know statx. Assisted-by: Claude:claude-opus-5-5
Pass the head_ref and main_ref dispatch inputs to git rev-parse after
--end-of-options, so no input can be read as a git option. The ^{commit}
suffix already kept every probed option-shaped value from parsing as one;
this makes it explicit.
State in the workflow that vars.INTEGRATED_BENCHMARK_RUNNER also runs fork
PRs, so it must name a hosted or ephemeral runner. Reword two comments to
describe the current contract rather than past runs.
Assisted-by: Claude:claude-opus-5-5
The verifier records a blob's mode without the CAS write lock. A thread whose read predates another thread's failed verification of the same blob could record the old mode after the failure dropped it, and the importer would then trust it for the re-fetched inode. A failure now leaves a marker instead of removing the entry. A verifier read only fills a path the map does not know yet, so it can overwrite neither the marker nor the fresh stat that later replaces it. Only the importer's own stat clears the marker, so a re-fetched blob costs one stat. Assisted-by: Claude:claude-opus-5-5
Concurrent installs race to create the same directories, so the number of mkdir calls failing with EEXIST varies between identical runs. On this PR's own benchmark run, pacquet's fresh install with a cold cache and hot store made 10,528 to 10,704 mkdir calls on main and 11,049 to 11,061 on HEAD, a change that touches no directory creation, and the syscall gate reported it as a regression. The strace parser now records mkdir and mkdirat as "mkdir (succeeded)" and "mkdirat (succeeded)", the calls minus their errors, and gates those. A new directory created per package still fails the gate. A row whose errors column exceeds its calls is refused. Assisted-by: Claude:claude-opus-5-5
On a head_ref dispatch the checkout holds the tools revision, so the peer-heavy scenario built the TypeScript pnpm@HEAD from it while pacquet@HEAD came from head_ref. The build step now passes a detached worktree at the measured HEAD as --pnpm-repository whenever the two differ. The report header showed github.sha even when head_ref chose another revision, and never named main. It now shows the measured HEAD and the main commit it was compared against. Assisted-by: Claude:claude-opus-5-5
A run on main benchmarks HEAD alone, so its report has no main target to name. Assisted-by: Claude:claude-opus-5-5
A process that changes a store entry's mode during an install (a chmod of the store, a backup restore, a concurrent install linking bins) is not guarded against by the recorded mode, nor by a stat before the link, which the change can land after. State it where the mode is recorded and where it is read. Assisted-by: Claude:claude-opus-5-5
Drop the "no longer reads" contrast and name the setting the way the v12 docs spell it, verifyStoreIntegrity. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the part of pnpm#17500 that pnpm#17502 left in place, and adds the benchmark check that would have caught the 12.8.0 regression before it shipped.
Two commits:
ci(benchmark): gate the same-run comparison on file syscall counts: the long-term fix. The integrated benchmark already compares HEAD and main in one run, but on wall time only, with a 5% noise allowance. The 12.8.0 regression added about 67k warm-cachestatxcalls per install, roughly 1 µs each, so wall time never left that band. This commit counts file syscalls in the same run and fails the check when HEAD makes more than max(2%, 50 calls) beyond main's highest count. Reverting perf(deps-restorer): stat a store file once for the hardlink mode check pnpm/pnpm#17502 on top of it turns the check red (12statxrows, +2.7% to +7.3%), while the timing table reads "Within tolerance".perf(deps-restorer): reuse the store verifier's mode reading for hardlinks: the fix. It bringsstatxback to the 12.7.0 count: 54,251 vs 53,885 calls (1.01x), while main reads 100,215 vs 53,885 calls (1.86x).The gate commit comes first, so this PR's own benchmark run measures the fix with the new check.
The fix
Follow-up to pnpm#17502 for pnpm#17500: closes the remaining
statxgap.pnpm#17502 caches a linkable answer per store path, so a store file shared by several packages is no longer stat'ed once per link. It still stats every store file once before its first link, though the store verifier (
check_pkg_files_integrity) read that same inode's mode a moment earlier in the same install. On the vitest fixture that leaves 100kstatxcalls, against 54k in 12.7.0 (run below).This PR replaces the
DashSet<PathBuf>of linkable paths intarget_mode.rswith a process-wide map from store path to inode mode, kept inpnpm_fs::file_mode:DashSetkept a stale entry here too.source_has_desired_modereads the map first. On a miss it reads the mode once (fs::metadataon unix,copy_permissionson wasi) and records it.store_inode_mode_is_linkableis unchanged, so the umask issue pnpm/pnpm#3807 semantics are unchanged.dashmap.The result:
Why process-global. The verifier and the importer run in different install-scoped contexts. The CAS write locks live in
pnpm_fsfor the same reason. Threading the mode down toimport_indexed_dirinstead would change theFilesMapshape at about a dozen call sites across deps-restorer, package-manager, cli, env-installer and python-installer.Trade-offs:
@pnpm/napiembedder the map holds onePathBuf+u32per distinct store file read.v11 is not affected.
Tests
hardlink_uses_the_mode_the_verifier_recorded(deps-restorer, new): it records the desired mode, sets the file's real mode off it, then links. The link must share the inode, because the recorded mode was used without a stat.careful_path_records_the_mode_of_a_verified_file(store-dir, new): a verified pass records the blob's mode.careful_path_forgets_the_mode_of_a_file_that_went_missingandcareful_path_forgets_the_mode_of_a_file_whose_content_hash_mismatches(store-dir, new): a pass records the mode, then a failed check leaves no mode recorded. Both fail with the verifier change reverted (the old mode is still returned), and all 247 store-dir tests pass with it.hardlink_reuses_a_store_entry_mode_check(from perf(deps-restorer): stat a store file once for the hardlink mode check pnpm/pnpm#17502): kept as is, and still passes.target_mode.rs,check_pkg_files_integrity.rs, the deps-restorerCargo.tomlandCargo.lockrestored from main 896dc10 make both new tests fail, while the perf(deps-restorer): stat a store file once for the hardlink mode check pnpm/pnpm#17502 test passes.cargo test:-p pnpm-deps-restorer: 672 passed.-p pnpm-store-dir: 245 + 2 passed.-p pnpm-fs: 212 passed. 2secure_temp_lockXDG tests fail the same way on the base commit, because of the local sandbox environment.cargo clippy --all-targets -- -D warningsis clean on the three crates.Measurement
Offline frozen
pnpm installof the vitest fixture (da7ce171, 66,952 linked files) on a warm store. All arms run on the same Ubuntu image, interleaved, with medians over n=10 rounds per runner and cgroup CPU.patchedis this change on its pre-pnpm/pnpm#17502 base (f4a1e8c).pr17502is b96f423 andbaseis 4cb926c. The source arms are glibccargo build --release -p pnpm-clibuilds made the same way, and 12.7.0 is the registry binary. Each cell isarm vs 12.7.0.Run 40981503781:
pnpm#17502 recovers 21k of the 67k extra
statxcalls. Its user time rose about as much as its sys time fell, so its user+sys is no better than base. This change bringsstatxback to the 12.7.0 count and sys to 0.99-1.04x. Its user time is also up 0.01-0.05 s against base, from the map lookups.The fix vs post-pnpm/pnpm#17502 main vs 12.7.0
Run 41075659469:
followup= the fix commit (2221b90, same diff as 8d14549 here),main= 896dc10 (contains 63be32b), both built from source with the same flags. Offline warm-store install of vitest@da7ce17 (66,954 files), medians over 10 interleaved rounds, 3 runners.On main, pnpm#17502 still issues about 46k extra
statxper install, one per store file on its first link. This branch removes them, because the store verifier has already read those modes. User time is 0.01-0.02 s above main, from the map lookups.linkatis identical across the source-built arms (66,946).The long-term fix: a syscall-count gate in the benchmark
Adds a syscall-count row to the integrated benchmark's same-run comparison, so a change that multiplies filesystem work fails the check even when wall time does not move.
Why wall time missed pnpm#17500
pnpm 12.8.0 (a90ec21, "materialize imported files at the current umask") added a metadata read of the store file before every hardlink. On a hot store that roughly doubled the
statxcalls of an install. pnpm#17502 removed part of it. Each extra call hits a warm page cache and costs about a microsecond, so tens of thousands of them move a 1 s install by less than the comparison's 5% noise allowance. The information run below shows this today: main still makes 58% morestatxcalls than a candidate fix on the hot-store fresh restore, and the timing table reads "Within tolerance" (−2.1% pacquet, −5.3% pnpr).What changes
integrated-benchmark --count-syscallsruns every benchmarked install twice more after the timed runs. These runs are untimed, start from the same cleanup a timed run starts from, and execute understrace --follow-forks --summary-only. Each run writes<target>/SYSCALL_COUNTS.<round>.txt.run-integrated-benchmark.mjs: when HEAD and main are both benchmarked, passes--count-syscallsto the first run and stores the parsed counts inBENCHMARK_REPORT.jsonassyscalls. A missing or malformed strace table fails the run and names the file. When the harness itself fails after the traced runs, as a failed diagnostics check does, the counts are still attached, so the report keeps its tables. The round files of every target are removed before the harness starts, so a harness that fails earlier never carries a previous run's counts. The parser requires every row to parse and the rows to add up to thetotalrow.compare-integrated-benchmarks.mjs: adds a "Same-run syscall check" table after the "Same-run regression check" table. It gates about 30 file syscalls (stat family, open, link, copy, ioctl, getdents, mkdir, rename, unlink, chmod, symlink, readlink, access):syscallsfrom the JSON embedded in the summary.head_ref/main_refinputs toworkflow_dispatch, so two arbitrary revisions can be compared with the current harness. The harness always comes from the dispatched ref. A dispatch withhead_refskips the Bencher upload, since it measured another revision than the branch it names.main_refis refused when dispatching from main, which benchmarks HEAD alone. Both take a SHA ororigin/<branch>, and a ref that does not resolve fails the dispatch.vars.INTEGRATED_BENCHMARK_RUNNER, falling back toblacksmith-8vcpu-ubuntu-2404, so a fork without Blacksmith runners can run it. Nothing changes upstream.Thresholds
The negative run below compared 24 scenario/engine pairs and found no syscall within tolerance's reach of failing:
statxin fresh-install cold/cold for pacquet (1,640 calls on about 160k, 1.0%). Every other spread is under 0.3% or under 50 calls.access, a few hundredrename) from failing on scheduling-dependent retries.statx(+7%) for reverting perf(deps-restorer): stat a store file once for the hardlink mode check pnpm/pnpm#17502 alone, +28k (+58%) for main vs the candidate fix.Proof runs (fork,
ubuntu-latest)Positive: the gate fails on a reintroduced per-link stat
Run: https://github.com/jclaveau/pnpm/actions/runs/41084341826. HEAD is this branch plus a revert of pnpm#17502 (throwaway branch
ci/syscall-gate-proof-revert-17502). main is this branch. The check fails with 12 syscall regressions, allstatx, while the timing table reports every scenario within tolerance:Timing rows for the same scenarios in the same run:
I first tried the literal pair, a90ec21 against its parent 7679530. It cannot run with today's harness: the September pnpr binary rejects
--packument-ttl, and its revision mock never starts. That is why the proof reverts the remaining part of the regression instead.Negative: the gate passes on a neutral change
Run: https://github.com/jclaveau/pnpm/actions/runs/41084352182 (success). HEAD is this branch, main is
main. All 15 scenarios ran, and the syscall check reported no regression and no unstable row.Information: current main vs a candidate fix
Run: https://github.com/jclaveau/pnpm/actions/runs/41084361972. HEAD is 896dc10 (main after pnpm#17502), main is 2221b90 (jclaveau/pnpm
fix/hardlink-mode-check-per-source, a fix that reads the mode once per source file). It shows what pnpm#17502 left of pnpm#17500:In the same run the timing table shows -2.1% (pacquet) and -5.3% (pnpr) for the hot-store fresh restore, both "Within tolerance".
Tests
node --test .github/scripts/compare-integrated-benchmarks.test.mjs .github/scripts/run-integrated-benchmark.test.mjspasses 30 tests. They cover strace parsing, the 2% and 50-call boundaries, unstable runs, a run spread within the tolerance not widening the gate, stale round files, refusal of missing, partial or invalid counts, and the table rendering. Disabling each guard in turn fails at least one test.Refs pnpm#17500, pnpm#17502. Supersedes #1 and #2, which carry each commit alone.
Assisted-by: Claude:claude-opus-5-5