GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix vendored scans failing on nested npm projects (#1534) by mikolalysenko · Pull Request #1543 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 14, 2026 •
edited by cursor Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Fixes #1534

Summary

Some repositories hold an independent npm project below the root, such as tools/x/ with
its own package-lock.json and node_modules. A root scan --mode vendored in such a
repository used to fail on every run (exit 1, partialFailure) and skip the in-run VEX.
It now leaves that project's packages to that project's own run and prints a
nested_project_skipped warning naming the PATH to pass. The exit code and status are
unchanged.

Root cause

The scan crawls every node_modules below the root, including a nested project's.
Agent and report-only scans assign each crawled copy to the project that owns it
(judge_nested_roots, #554). Hosted and vendored scans skip that step, so a vendored scan
passed tools/x's copy of left-pad to the root's package-lock.json backend. The root
lock has no entry for it, and the backend treats a missing entry as the hard
vendor_lock_entry_not_found refusal. The suggested fix (npm install) can't clear that,
so the run fails every time. Hosted mode only skipped the package (redirect_unconfirmed).

Fix

  • core hosted::governing_root::nested_npm_project(scan_root, copy) finds the nearest
    directory below the scan root, above the copy's first node_modules, that is its own
    npm-family lock root. A workspace member whose lock its package manager ignores
    (member_stray_lock, Hosted and vendored scans run from an npm workspace member that has a stray package-lock.json of its own rewrite that lock, which npm ignores, and report success while npm installs the unpatched package and VEX attests not_affected #1094/Hosted and vendored scans from a Bun workspace member with a stray bun.lock / bun.lockb pin that ignored lock, exit 0, and lock-only VEX attests not_affected while Bun installs the unpatched package #1101/Hosted and vendored scans from a vlt workspace member with a stray vlt-lock.json write to that lock, which vlt ignores, and exit 0 (vendored VEX then attests not_affected while vlt ci fails) #1134) does not count, because the root's lock installs
    that member.

  • cli scan::discovery::nested_project_skips runs after the patch query in hosted and
    vendored root scans. It drops a patched npm purl only when all three hold:

    1. the root's lock inventory doesn't list it;
    2. its crawled copy is in a nested project;
    3. no node_modules in the root's own install has another copy. The crawl keeps one copy
      per purl, so this check stops a package the root also installs from being dropped. If a
      tree can't be read, every package stays with the root.

    Each nested project gets one nested_project_skipped run warning that names the purls,
    the directory, and the command to run (socket-patch scan --mode vendored tools/x). The
    path is relative to the shell's directory, so it's correct under --cwd and on PATH-list
    legs, and it's quoted when needed.

  • Docs: a CLI_CONTRACT.md code-table row, and a paragraph in docs/ecosystems.md
    ("npm: which node_modules trees are crawled").

Test evidence

New crates/socket-patch-cli/tests/scan/scan_nested_project_e2e.rs, run with
cargo test -p socket-patch-cli --all-features --test scan scan_nested_project_e2e.
On main with the tests committed, 3 fail (red); with the fix, all pass (green).

#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:

    • the sandbox runs as root, so read-only and write-failure injection has no effect. This
      covers the *_write_failure_* tests, repair_*_unremovable, copy_tree's read-only
      parent, and vlt 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.

Review (/code-review high)

Fixed:

  • the suggested PATH was relative to the leg's directory and wasn't quoted;
  • errors fell open and dropped packages; they now keep every package with the root;
  • the plural wording is computed once.

Not fixed:

  • An independent nested project with no lock of its own is not detected. Agent mode's Agent-mode scan ignores socket.yml includePaths / ignorePaths (and the built-in tests/ default) for nested npm projects, patching every nested project's node_modules #554
    rule uses lock markers too, and without a lock there is no project boundary to read. A root
    vendored scan still refuses such a copy (vendor_lock_entry_not_found), as before. This
    is a narrower case than the one reported, which has a lock.
  • The . leg of scan . tools/x still warns about tools/x even though the next leg
    patches it. The warning is accurate for that leg, and silencing it would mean passing sibling
    PATHs into each leg.
  • nested_npm_project and ScanPolicy::nested_owner share a walk shape but use
    different rules. Agent mode doesn't exclude stray-lock members. Unifying them would change
    agent-mode ownership, which is out of scope here.
  • The second node_modules walk happens only when some patched package is a candidate,
    which is rare. Reusing NpmCrawlSnapshot would mean threading it through run_scan's
    agent path.
  • No per-directory memoization in nested_npm_project. It runs once per patched
    candidate, not once per crawled package.
  • scannedPackages still counts the nested copy. It counts what the crawl found; the
    copy just isn't selected. The in-run VEX test confirms the copy isn't attested.

🤖 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
Start fix for #1534
8b0102e
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko
Mikola Lysenko (mikolalysenko) force-pushed the agent/fix-vendored-nested-project-copies branch from f24ccbd to 8b0102e Compare October 14, 2026 18:23
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 14, 2026
Root scan --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) #1534
Closed
Claude (claude) added 2 commits October 14, 2026 18:33
@claude
Test vendored scans over nested npm projects
c3da1ad
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
@claude
Leave nested npm projects' copies to their run
2c3e064
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
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 14, 2026
Swarm health manager log #1382
Open
@claude
Name the nested project's PATH from the shell
695464d
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
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 14, 2026 19:18
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 14, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 14, 2026
View reviewed changes
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit fc1b4f9 Oct 14, 2026
86 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-vendored-nested-project-copies branch October 14, 2026 20:00
This was referenced Oct 14, 2026
CI performance dashboard #1182
Open
Root scan --mode vendored still exits 1 forever and drops its in-run VEX when a nested npm project has no lockfile (package-lock=false); the #1534 fix only covers nested projects with their own lock #1554
Closed
CI perf (settings): slow Depot 16-core hosts since 10-13 15:20 add ~1.5–2.5 min to the merge-queue critical path (~0.6k Linux job-min/day) #1512
Open
Fix lockless nested npm projects in root scans (#1554) #1591
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@Tanmay182003 Tanmay Singla (Tanmay182003) Tanmay182003 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Root scan --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)

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mikolalysenko @Tanmay182003 @claude
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.