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 -g touching the cwd project's state (#436, #445) by mikolalysenko · Pull Request #446 · SocketDev/socket-patch Conversation
|
| Issue | Regression test | main | this PR |
|---|---|---|---|
#436 get -g --mode hosted|vendored |
get_refuses_project_modes_under_global_scope |
FAIL | pass |
#436 scan -g --mode vendored / --vendor |
scan_refuses_vendored_mode_under_global_scope |
FAIL | pass |
#445 rollback -g, hosted project |
global_rollback_leaves_hosted_project_pins |
FAIL | pass |
#445 remove -g, hosted project |
global_remove_leaves_hosted_project_pins |
FAIL | pass |
#445 rollback -g, vendored project |
global_rollback_leaves_vendored_project_state |
FAIL | pass |
#445 remove -g, vendored project |
global_remove_leaves_vendored_project_state |
FAIL | pass |
#445 reverse, apply -g |
global_apply_patches_a_purl_the_project_vendors |
FAIL | pass |
#445 reverse, scan -g --mode agent |
global_agent_scan_patches_a_purl_the_project_vendors |
FAIL | pass |
| control | project_rollback_restores_the_hosted_pin |
pass | pass |
Red on main: I reverted src/ to main and ran cargo test -p socket-patch-cli --all-features --test global_scope_project_state: 8 failed, the control passed. With the fix: 26/26 passed (including the shared harness self-tests).
Local checks: cargo clippy --workspace --all-features -- -D warnings is clean. In this container a single cargo test --workspace --all-features run hits the disk limit while linking about 200 test binaries, so I ran every cli and core test target in batches instead. All of them pass except about a dozen write-failure tests (*_write_failure_*, *unremovable*, relax_loop_must_not_traverse_symlinked_root). Those tests rely on read-only permissions, which don't apply to root, and the agent container runs as root. Several are in socket-patch-core, which this PR doesn't touch. CI on 92c71ad: 475 checks passed, 6 skipped by workflow conditions, 0 failed.
cargo fmt --all -- --check already fails on main: #277 landed about 120 files that aren't rustfmt-clean, and CI runs no fmt check. This PR's own hunks are rustfmt-stable (I checked them against cargo fmt output). I left the unrelated files alone so the PR stays reviewable.
The wrappers (npm/, pypi/, gem/) only dispatch to the binary, so they need no change.
remove <purl> -g still drops the manifest record you named, even when the project vendors that purl through a legacy manifest-tracked (non-detached) vendor entry. v5 vendored entries are manifest-free, so this doesn't affect them.vex -g and list -g still read cwd lockfile discovery. Neither one writes to the project.🤖 Generated with Claude Code
https://claude.ai/code/session_013tdBJBzhf47finAWKtDQVF
Note
Medium Risk
Changes rollback/remove/apply/scan semantics for -g runs and tightens mode validation; incorrect gating could leave project or global state inconsistent, but behavior is covered by a dedicated test suite.
Overview
Global scope (--global / --global-prefix) no longer reads or mutates the --cwd project’s hosted pins, vendor ledger, or lockfile wiring when the run is only meant to target globally installed packages.
Shared helpers in commands/mod.rs — project_state_in_scope and global_mode_conflict — centralize the rule. get and scan now reject --mode hosted or vendored under global scope (exit 2, aligned with scan’s existing hosted guard). rollback and remove skip hosted/vendored legs and legacy ledger retirement for project state; global rollback still loads the project ledger only to preserve manifest entries for purls the project vendors. apply and agent scan no longer treat the cwd vendor ledger as owning global copies, so they patch globals instead of emitting vendored_ownership_retained.
CLI_CONTRACT.md documents the behavior. New integration tests in global_scope_project_state.rs cover mode guards, rollback/remove isolation, and global apply/scan over project-vendored purls.
Reviewed by Cursor Bugbot for commit 92c71ad. 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
Regression tests for #436 and #445: get/scan refuse hosted and vendored mode under -g, rollback/remove -g leave a hosted or vendored project's wiring and ledgers alone, and apply/scan -g patch the global copy of a purl the project vendors. All but the control fail on main. Assisted-by: Claude Code:claude-opus-5-5
Global installs have no project lockfile, but a global run started inside a project still touched that project: get -g --mode hosted|vendored and scan -g --mode vendored rewired it, rollback -g and remove -g unwound its hosted pins and vendored wiring (on vlt deleting the installed package), and the project's vendor ledger made apply -g and scan -g skip the global copy of a purl the project vendors. One rule now decides this (project_state_in_scope): under global scope get and scan refuse hosted and vendored mode with one shared usage error, rollback and remove skip their hosted and vendored legs and the pre-v5 ledger retirement, and the ledger no longer owns global copies. A global rollback still keeps the project's vendored manifest records. Fixes #436 Fixes #445 Assisted-by: Claude Code:claude-opus-5-5
a418733 to
92c71ad
Compare
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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 92c71ad. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[agent] Ready for review on Reviewer focus: Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[burn-down agent] Ready for review on
Note: Slack announcement could not be sent this run (no Slack send tool available in the agent session); next run will retry. 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.
A NuGet PackageReference project restores into the global packages folder, so a global run's copy of a package the project vendors is the project's own patched install. Since #446, `scan -g --mode agent` and `apply -g` took it over as an agent patch, and `rollback -g` or `remove -g` restored upstream bytes into it. A locked restore never re-extracts it, so the project built unpatched with exit 0 while vex kept attesting. Global runs now leave that copy to the project's vendor ledger when the global folder is one the project restores into: scan skips it as vendored_ownership_retained, apply skips it as vendored, and rollback and remove keep it patched. A global store the project doesn't use is still patched and restored as before. Fixes #489 Assisted-by: Claude Code:claude-opus-5-5
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
rollback -g and remove <purl> -g also unwind the current project's hosted pins and vendored wiring; on vlt they delete node_modules/left-pad too
get -g --mode hosted|vendored and scan -g --mode vendored rewrite the current project's yarn.lock instead of refusing, leaving the global copy unpatched
There was an error while loading. Please reload this page.