Repository navigation
Description
Found by the defect-hotspots skill (pnpm/pnpm#17021) on 2026-10-17 over 90 days of main (086165da7a). The root cause comes from reading the commits and code; it was not reproduced. The design steps are proposals for a maintainer to settle.
Loop: Pinned pnpm switch (about 17 fixes)
Property. Before handing off to the pinned pnpm, the running pnpm reads the pin and a known small set of settings and flags the same way from every entry point. It tolerates everything else, and recording the pin never fails the command.
Members. pnpm/pnpm#14838, pnpm/pnpm#16360, pnpm/pnpm#16362, pnpm/pnpm#16437, pnpm/pnpm#16469, pnpm/pnpm#16479, pnpm/pnpm#16498, pnpm/pnpm#16564, pnpm/pnpm#16587, pnpm/pnpm#16597, pnpm/pnpm#16648, pnpm/pnpm#16676, pnpm/pnpm#16785, pnpm/pnpm#16826, pnpm/pnpm#16919, pnpm/pnpm#17003, pnpm/pnpm#16405. Earlier members of the same loop: pnpm/pnpm#14457, pnpm/pnpm#14468, pnpm/pnpm#14531, pnpm/pnpm#14626, pnpm/pnpm#14637, pnpm/pnpm#14641, pnpm/pnpm#14753, pnpm/pnpm#15206, pnpm/pnpm#16280, pnpm/pnpm#16601. Parity drift still open: pnpm/pnpm#16319 (trustPolicy).
Flaw.
- The pre-switch pass loads the full config under the running pnpm's schema:
load_pre_command_configand v11loadConfigOrSwitchToPinnedPnpm. Nothing defines which settings it may honor, so failures were patched with retry paths (unreadable_settings.rs,skip_unreadable_settings,switchPastUnreadableConfig). - Three switch-input builders with hand-written flag allowlists:
from_cli_args,--version, and the unparsed argv scan. - A separate pin reader in self-update,
project_pins_pnpm. It probably missespackage.yamland workspace-root pins; this is unverified. - Every command records the pin, so
--versionandruninherit install's failure modes.
Design change.
- An explicit
BootstrapSettingsfield list, loaded leniently per key. Strict validation runs after the decision to continue. - One argv reader with a flag table derived from clap.
- One pin locator.
- Record the pin only for install-family commands. This needs a maintainer decision.
- A v11 mirror, which also settles Project
trustPolicyis applied when switching to thepackageManagerpnpm version pnpm#16319.
Tests.
- Equivalence across the three input builders over generated argvs.
- A coverage test that classifies every global clap arg as bootstrap or after-switch.
- A nightly cross-version matrix: outer pnpm {11.latest, oldest 12.x, 12.latest, HEAD} × pin {10, 11, HEAD via local pnpr} × setting source × platform. Current tests only run HEAD switching down, never an older outer pnpm with a newer project.
The shared test harnesses that cover this loop and the others are tracked in #141.
Written by an agent (Claude Code, claude-opus-5-5).
Activity
zkochan commentedon Oct 17, 2026
pnpm/pnpm#17026 does step 3, "One pin locator".
PinRootsis now the only pin locator, and the pre-command pass andpnpm self-updateboth use it. That fixes a real bug:self-updateread onlypackage.jsonin--dir. So it missed the workspace root's pin when run in a workspace package, and missed pins inpackage.yamlorpackage.json5. pnpm v11 already got this right.This only covers part of the issue. Still open:
BootstrapSettings(step 1), the unified argv reader (step 2), recording the pin only for install-family commands (step 4, needs a maintainer decision), the v11 mirror and pnpm/pnpm#16319 (step 5), and the proposed tests.Written by an agent (Claude Code, claude-opus-5-5).
fix(self-update): read the project pin where the pre-command pass rea…
zkochan commentedon Oct 17, 2026
pnpm/pnpm#17035 does step 2, "One argv reader with a flag table derived from clap". The
--versionscan and the scan of a rejected command line now read their flags throughBootstrapArgv, a clap struct that flattens the same groups the parsed path reads. It also adds the two tests the issue proposes: one checks that the three readers agree on generated argvs, and one makes every global clap flag declare whether it is read before the switch or after it.Still open:
BootstrapSettings(step 1), recording the pin only for install-family commands (step 4, needs a maintainer decision), the v11 mirror with pnpm/pnpm#16319 (step 5), and the nightly cross-version matrix.Written by an agent (Claude Code, claude-opus-5-5).
refactor(pre-command): read the bootstrap flags through one clap-deri…
zkochan commentedon Oct 17, 2026
Maintainer decisions on the two open items:
trustPolicyto the pinned pnpm, as v12 does. fix: apply trustPolicy to the pnpm version a project pins pnpm#17038 does that.Still open: step 1,
BootstrapSettings(an explicit list of settings loaded leniently per key before the switch), and the nightly cross-version matrix, which #141 tracks.Written by an agent (Claude Code, claude-opus-5-5).
fix: apply trustPolicy to the pnpm version a project pins (#17038)
zkochan commentedon Oct 17, 2026
pnpm/pnpm#17045 does step 1. The pass reads settings in tiers. It reads none when no candidate manifest pins pnpm or a runtime. It reads only
PIN_DECISION_SETTINGSto decide. It reads every setting this pnpm can read only to switch or to record the pin. Strict validation and the config warnings move to the command's own load. The retry path is gone.With that, every step of this issue is done or decided against (step 4). The nightly cross-version matrix is tracked in #141. Possible v11 follow-up: v11 likely has the same
--versionfailure on an unreadable setting under a satisfied pin. It's unverified and noted in the PR.Written by an agent (Claude Code, claude-opus-5-5).
fix(pre-command): read only the settings the pinned pnpm switch decid…
zkochan commentedon Oct 17, 2026
pnpm/pnpm#17045 (merged) covers step 1 for pnpm v12.
The v11
--versionfollow-up is now verified and open as pnpm/pnpm#17049. In v11,pnpm --versionexited 1 when the globalconfig.yamlcould not be parsed, even under a pin the running pnpm satisfied. With the PR, a failed load on a bare--versionfalls back to the settings pnpm can read, and the existing pin handling decides from them.Once that merges, every step here is done or decided against. The nightly cross-version matrix stays with #141.
Written by an agent (Claude Code, claude-opus-5-5).
fix: print the version past a setting pnpm cannot read (#17049)
zkochan commentedon Oct 17, 2026
Done. Every step here has landed or was decided against:
pnpm --versionpast an unreadable setting in v11: fix: print the version past a setting pnpm cannot read pnpm#17049, with tests in test: cover a mismatched pin on the version fallback pnpm#17052.trustPolicyfor the pinned pnpm in v11: fix: apply trustPolicy to the pnpm version a project pins pnpm#17038.The nightly cross-version matrix stays with #141.
Written by an agent (Claude Code, claude-opus-5-5).
test: expand equivalence, convergence, and v11/v12 differential harne…