GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix pnpm member settings written to an ignored nested pnpm-workspace.yaml (#880, #881) by mikolalysenko · Pull Request #888 · SocketDev/socket-patch Conversation
|
| Issue | Test | Without fix | With fix |
|---|---|---|---|
| #880 | in_process_redirect_pnpm::hosted_scan_from_pnpm_member_with_own_lock_never_nests_trust_config |
FAIL: exit 0 (left Some(0), right Some(1)) |
ok |
| #880 | in_process_redirect_pnpm::hosted_scan_from_pnpm_member_respects_root_trust_opt_out |
FAIL: nested pnpm-workspace.yaml created |
ok |
| #880 | governing_root::tests::pnpm_member_with_own_lock_needs_the_root_to_trust_it (unit) |
n/a (new code path) | ok |
| #881 | vendor::pnpm_lock::tests::workspace_member_with_its_own_lock_is_refused_before_any_write (wet, dry run, preflight) |
FAIL: vendoring proceeded | ok |
| shared | utils::pnpm_workspace::tests::* |
n/a | ok |
pnpm_member_with_own_lock_or_lockless_root_is_left_alone now gives its root file trustLockfile: true, so it keeps testing what its name says (no lock-elsewhere refusal).
cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-cli --all-features --test in_process_redirect_pnpm: 18/18 pass.e2e_redirect_pnpm_build -- --ignored --skip pnpm_pinned_matrix (real pnpm): 8/8 pass. e2e_vendor_pnpm_build: 24/24 pass, plus the ignored pinned matrix with SOCKET_PATCH_PNPM_E2E_VERSION=10.28.0: 1/1 pass.cargo test --workspace --all-features --no-fail-fast: everything passes except 12 tests that inject write failures with chmod 0o555 / read-only parents. The sandbox runs as root, so those writes succeed: covgap_commands_vendor ×3, in_process_redirect ×3, repair ×2, and core copy_tree / vlt_heal / pypi_poetry / pypi_requirements. None touch pnpm settings, and CI runs them as non-root. The 13th, the digest guard, is fixed by the Route Gradle digests through utils::digest #878 port.cargo fmt: main itself isn't rustfmt-clean with the pinned 1.93.1 toolchain (466 diffs), so only this PR's own hunks are formatted.No wrapper changes are needed (npm/, pypi/ and gem/ only dispatch the binary).
🤖 Generated with Claude Code
https://claude.ai/code/session_018d82ZH8U4XqGShmX3UgoEx
Note
Medium Risk
Changes hosted/vendored preflight and refusal paths for pnpm workspace members with own locks; behavior shifts from silent nested files to fail-closed errors until root trustLockfile is set.
Overview
Fixes pnpm workspace members that use per-package locks (sharedWorkspaceLockfile: false): hosted and vendored runs no longer create a nested pnpm-workspace.yaml in the member (pnpm ignores it and only reads settings from the ancestor root file).
Hosted adds a pre-write refusal (redirect_pnpm_settings_elsewhere) when the member has a v9 lock but the root pnpm-workspace.yaml does not yet set trustLockfile (unless the user passes --no-trust-lockfile-config). After the root trusts the lock—or explicitly opts out—pins proceed and trust warnings reference the root file, not a nested scaffold.
Vendored refuses the same layout with vendor_pnpm_settings_elsewhere because overrides: cannot be applied in the member; remedy is --mode hosted.
Shared helper governing_workspace_file resolves which workspace YAML governs a project; CLI_CONTRACT.md documents both codes.
Also routes Gradle/JVM SHA1/SHA256 hashing through shared utils::digest helpers (CI guard / #878 port).
Reviewed by Cursor Bugbot for commit 83c5105. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
pnpm reads settings (overrides, trustLockfile) only from the nearest pnpm-workspace.yaml above a project. A workspace member with its own lock but no settings file of its own is governed by the root's file, and any file socket-patch creates inside the member is ignored. Add utils::pnpm_workspace::governing_workspace_file so hosted and vendored modes can tell that layout apart from a standalone project. Refs #880, #881 Assisted-by: Claude Code:claude-opus-5-5
In a pnpm workspace with sharedWorkspaceLockfile: false, vendored mode run from a member wrote the override into the member's package.json and a new nested pnpm-workspace.yaml. pnpm reads overrides only from the workspace root's file, so on pnpm 11/12 frozen installs failed with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH and a plain pnpm install silently reinstalled the unpatched package, while the scan reported success. The run now refuses before any write (dry runs and the pre-download preflight included) with vendor_pnpm_settings_elsewhere, naming the governing root file and pointing at hosted mode. Fixes #881 Assisted-by: Claude Code:claude-opus-5-5
Hosted mode run from a pnpm workspace member with its own lock created a nested pnpm-workspace.yaml holding trustLockfile: true. pnpm ignores a member's settings file, so every root install on pnpm 11/12 failed with ERR_PNPM_TARBALL_URL_MISMATCH while the scan reported success and told users to commit the file. The hosted pre-check now refuses such a member before any takeover or write with redirect_pnpm_settings_elsewhere, naming the root file to add trustLockfile: true to. Once the root file trusts the lock, or explicitly opts out, the member is pinned, no nested file is created, and the trust warning names the root file. --no-trust-lockfile-config still pins without the key. Both new refusal codes are documented in CLI_CONTRACT.md. Fixes #880 Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[agent] The Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
test (windows-latest) failed two ways: - governing_workspace_file returned the canonicalized path, so the refusal named \\?\C:\Users\runneradmin\...\pnpm-workspace.yaml. That is a spelling users never type, and it didn't match the test's raw tempdir path (C:\Users\RUNNER~1\..., an 8.3 short name). - The CLI tests matched paths against a JSON dump of the warnings, which doubles every Windows backslash. governing_workspace_file now strips the verbatim prefix (without_verbatim_prefix, string-level and unit-tested on every host). The tests compare against that canonical spelling and read warning text unescaped. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018d82ZH8U4XqGShmX3UgoEx
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 83c5105. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[agent]
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Burn-down agent: labeled Ready for review at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Main's #888 added the pnpm settings-elsewhere refusal next to the workspace-member checks this branch adds. Both checks are kept: the package.json workspace refusal runs after the pnpm lock check, then the trustLockfile settings refusal. The CLI contract row and the CLI tests from both sides are kept, and the new unit tests pass the trust flag that refusal() takes now. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LYxnnBSxyMahcBX9SZag9L
#888 made hosted and vendored modes refuse a pnpm project with its own v9 lock and no pnpm-workspace.yaml of its own whenever any ancestor held a pnpm-workspace.yaml (redirect_pnpm_settings_elsewhere, vendor_pnpm_settings_elsewhere). governing_workspace_file took the nearest ancestor file without asking whether its `packages:` globs list the project. pnpm 11.28+ and 12 install a directory the nearest file does not list (an examples/ app, a checkout under an unrelated workspace) standalone: its own lock, and settings read only from its own pnpm-workspace.yaml. So both refusals pointed at remedies that do nothing, and neither mode could patch a project 4.0.0 handled. governing_workspace_file now reads the nearest regular ancestor file (FIFO-safe reader) and returns it only when it lists the project, as probed on pnpm 11.28.5 and 12.10.1: - no `packages:`, a null or an empty list: root-only workspace, so no; - otherwise some pattern matches and no `!` pattern does (pnpm's globber treats every negation as an ignore, wherever it sits). A file that does not parse, or a pattern with braces, classes or extglobs the matcher does not model, still counts as listing the project, so #880/#881 stay refused. With no governing file, hosted creates the project's own pnpm-workspace.yaml with trustLockfile: true and vendored wires its override there, as before #888. The glob matcher used by the package.json workspaces check (#884) moves to utils/workspace_globs.rs so both checks share it. CLI_CONTRACT.md scopes both codes to members listed by the root's `packages:` globs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Vendored scan from a pnpm 11/12 workspace member with its own lock writes the override into a nested member pnpm-workspace.yaml that pnpm ignores, so the root frozen install fails and a plainpnpm install silently reinstalls the unpatched package
Hosted scan from a pnpm 11/12 workspace member with its own lock writes trustLockfile into a nested member pnpm-workspace.yaml that pnpm ignores, so the root install fails with ERR_PNPM_TARBALL_URL_MISMATCH
There was an error while loading. Please reload this page.