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 vendored scans failing on nested npm projects (#1534) by mikolalysenko · Pull Request #1543 · SocketDev/socket-patch Conversation
|
| #1534 symptom | test | main | this PR |
|---|---|---|---|
root vendored scan exits 1 on every run with vendor_lock_entry_not_found |
root_vendored_scan_warns_about_a_nested_projects_copies (2 runs) |
FAIL | ok |
--vex writes no in-run document |
root_vendored_scan_with_vex_writes_the_document |
FAIL | ok |
scan --mode vendored . tools/x stays red |
vendored_scan_of_root_and_nested_path_succeeds |
FAIL | ok |
| control: a package the root also locks is still vendored at the root | package_the_root_also_locks_is_still_vendored_at_the_root |
ok | ok |
| control: a workspace member's stray lock is not a nested project | workspace_member_with_stray_lock_is_not_a_nested_project |
ok | ok |
the remedy path is relative to the shell's directory under --cwd |
warning_names_the_path_from_the_shells_directory |
n/a | ok |
Unit tests: governing_root::tests::nested_npm_project_finds_the_independent_lock_root and
scan::discovery::tests::shell_word_quotes_only_what_the_shell_would_split.
Local checks:
cargo fmt --all -- --check: ok.
cargo clippy --workspace --all-features -- -D warnings: ok.
cargo test -p socket-patch-cli --all-features --test e2e_redirect_npm_build -- --ignored
(real npm): 6 passed.
cargo test --workspace --all-features: every failure from this change is fixed. 10 tests
still fail locally, all for environment reasons:
*_write_failure_* tests, repair_*_unremovable, copy_tree's read-onlyvlt heal_invalidation_failure;e2e_bun_lockb fetches a blob from the live patch API, which isn't reachable here.None of them touch scan's npm discovery. CI runs them as a non-root user.
/code-review high)Fixed:
Not fixed:
vendor_lock_entry_not_found), as before. This. leg of scan . tools/x still warns about tools/x even though the next legnested_npm_project and ScanPolicy::nested_owner share a walk shape but usenode_modules walk happens only when some patched package is a candidate,NpmCrawlSnapshot would mean threading it through run_scan'snested_npm_project. It runs once per patchedscannedPackages still counts the nested copy. It counts what the crawl found; the🤖 Generated with Claude Code
https://claude.ai/code/session_0165v5yieeSffKsNoz1RbLKx
Generated by Claude Code
Note
Medium Risk
Changes npm discovery and lock-backend inputs for hosted/vendored scans; behavior is gated and covered by e2e tests, but wrong nested/root attribution could skip patching or still mis-wire locks.
Overview
Fixes #1534: root scan --mode hosted / vendored no longer treats patched npm packages that live only under a nested, independent npm project (own lockfile, not a workspace member) as root lock targets.
Behavior: After patch discovery, hosted/vendored root scans call nested_project_skips, which uses nested_npm_project to attribute crawled copies to nested lock roots, drops those purls when the root lock does not list them and the root install has no other copy, and emits one nested_project_skipped warning per nested project with a copy-pasteable socket-patch scan --mode <mode> <dir> path (shell-relative, POSIX-quoted when needed). Exit/status stay success instead of vendor_lock_entry_not_found / partial failure; in-run VEX no longer omits attestations for the root-only work.
Docs: New nested_project_skipped row in CLI_CONTRACT.md and npm crawl note in docs/ecosystems.md.
Tests: scan_nested_project_e2e.rs plus unit tests for nested_npm_project and shell_word.
Reviewed by Cursor Bugbot for commit 695464d. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
f24ccbd to
8b0102e
Compare
A root scan --mode vendored over a repository with an independent nested npm project (tools/x with its own lock) fails every run with vendor_lock_entry_not_found and drops its in-run VEX (#1534). These tests capture that, plus the scan . tools/x form and two controls: a package the root also locks, and a workspace member's stray lock. Assisted-by: Claude Code:claude-opus-5-5
Hosted and vendored scans rewire only the scan root's lockfiles, but the crawl also reads node_modules of nested, independent npm projects. A vendored root scan handed those copies to the root lock backend, which refused them, so the run failed with exit 1 every time and wrote no in-run VEX, with a remedy (npm install) that could not clear it. Now a patched npm package is left out of a hosted or vendored run when the root's lockfiles do not list it, its copy sits in a nested project with its own lock (not a workspace member whose lock is ignored), and the root's own install has no copy. One nested_project_skipped warning per project names it and the PATH to pass. Exit and status unchanged. Fixes #1534 Assisted-by: Claude Code:claude-opus-5-5
Review follow-ups for the nested_project_skipped warning: - the PATH it suggests is relative to the directory the command runs in (or absolute), not to a PATH-list leg or --cwd, and is quoted when a shell would split it; - an unreadable node_modules keeps every package the root's instead of dropping one the root may install; - npm purls are classified through Ecosystem::from_purl, the remedy spells each mode out so the remedy-command check parses it, and the e2e reads the envelope through common::envelope. 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.
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 695464d. Configure here.
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 an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Rootscan --mode vendored exits 1 forever and drops its in-run VEX when a nested independent npm project installs a patched package the root lock doesn't have (hosted mode only warns)
There was an error while loading. Please reload this page.