Fix npm store copies missed by agent apply and vex (#601, #603) - #605
Mikola Lysenko (mikolalysenko) wants to merge 6 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Agent-mode apply and rollback now reach a copy bundled inside another package's pnpm, vlt, Bun or Deno store entry even when the same name@version is installed normally: the resolver probes a skipped store entry's bundled tree (one stat per entry). Agent-mode vex now checks the store peer-variant copies apply patches, so one unpatched copy omits the purl instead of producing a false not_affected. Fixes #601, #603 Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
|
[burn-down agent] Labeled Ready for review at
Generated by Claude Code |
|
Review updated for The correction bounds repeated npm store scans and bundled-directory cycles while preserving every-copy coverage:
All 228 focused tests passed, including multicopy apply/rollback, agent and hosted VEX, crawler oracles, and the new work-count/cycle regressions. The original cycle reproducer exceeded two seconds and now resolves in about 1.44 ms. The 128-copy expanded-input helper measurement improved from about 6.24 s to 224 ms; these are component timings, not whole-command benchmarks. Deterministic tests establish the store-scan bound. The committed files match the tested source. Independent review found no remaining actionable issue; formatting, diff checks, and targeted clippy passed (with the existing macOS No remaining code finding from this review. The Ready label has been restored after all checks completed on the corrected commit. CI note: the initial Windows Bun 1.2.23 job failed because its patch-detail API call timed out before the expected refusal. Artifact |
|
Confirmed on You've said you're preparing the correction on this branch, so I'm not pushing a competing one. The fix I'd propose expands only those additions and leaves the installed paths as they are: for purl in shared.values().flatten() {
let installed_paths = installed.get(purl).cloned().unwrap_or_default();
let mut paths = all.remove(purl).unwrap_or_default();
paths.extend(aliases.remove(purl).unwrap_or_default());
if npm.contains(&purl) {
// `installed` is already store-variant expanded (#603); expand only
// what the alias walk and identity fallback added here.
let added: Vec<PathBuf> = paths
.into_iter()
.filter(|p| !installed_paths.contains(p))
.collect();
let mut merged = installed_paths;
for p in with_store_peer_variant_copies(added).await {
if !merged.contains(&p) {
merged.push(p);
}
}
paths = merged;
}
// ...
}This keeps every-copy verification for agent records, and aliased or fallback copies still get their variants. For a purl with no alias or fallback copies, the store scan count goes back to one. The existing Generated by Claude Code |
|
Cursor (@cursor) review Both review findings are corrected in |
There was a problem hiding this comment.
✅ 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 b92456b. Configure here.
|
Update (23:20 UTC): the Bun patch compatibility workflow on It is still unexplained. If Original reportCI on Generated by Claude Code |
Final-head CI is complete: 452 successful checks, 6 skipped; no failures or pending checks. Bugbot passed, there are no unresolved review threads, and the PR is mergeable.
Fixes #601 and #603. In pnpm, vlt, Bun and Deno layouts, agent
apply,rollbackandvexmust discover every relevant physical copy. Previously, finding a normal installation could hide a copy bundled inside another store entry; agent VEX also omitted peer variants that apply already patched. VEX could therefore attest a package while a consumed copy remained unpatched.The resolver now visits the owning package's bundled
node_moduleseven when its store entry is skipped by the pending-name filter. Agent VEX uses the shared npm store-variant expansion so an unpatched bundled or peer copy prevents attestation.CLI_CONTRACT.mdandCHANGELOG.mddescribe the every-copy behavior.Review corrections preserve that coverage while bounding traversal and repeated work:
node_modulesdirectories separately for importer and store-entry mode. Cyclic bundled links terminate; root-first path choices, legitimate linked copies, and the two different link policies are retained.Validation on
b92456b3:unused_variablesallowed for the existing macOS Python-crawler warning. The final committed files match the tested hashes; independent source/evidence review found no remaining issue, and the commit merges cleanly with main045d7ec7.b92456b3. A Windows Bun 1.2.23 patch-detail API timeout was retried once at the failed-job level; all 49 cases passed on the retry, including the expected workspace refusal.#599, concerning orphaned Bun store entries, remains a separate reachability change.
Note
Medium Risk
Changes npm install discovery and VEX copy sets for security-sensitive apply/verify paths; bounded traversal and deduplication reduce performance and infinite-loop risk but behavior shifts when multiple physical copies exist.
Overview
Fixes #601 and #603 so agent
apply,rollback, andvextreat every physical npm copy that can actually run—not only the “normal” importer-linked install.The npm resolver now walks bundled
node_modulesinside skipped pnpm/vlt/Bun/Deno store entries when the samename@versionwas already found elsewhere, with cycle-safe traversal so bundled trees that link back to ancestors do not hang or drop legitimate copies.with_store_peer_variant_copiescentralizes peer/index/alias store expansion (with one scan per store identity per batch). Manifest copy lookup applies it for npm; hostedvexreuses already-expanded installed paths and only expands new alias paths, avoiding redundant store rescans.Docs (
CHANGELOG,CLI_CONTRACT) state that agent verification must hash every crawler copy, including peer variants and bundled store copies. Regression tests cover apply/rollback on bundled layouts, agent VEX omission when any store copy is pristine, and hosted-merge behavior.Reviewed by Cursor Bugbot for commit b92456b. Configure here.