Fix vendor --check passing unwired vendored entries (#725) - #730
Conversation
Assisted-by: Claude Code:claude-opus-5-5
`vendor --check` only verified wiring for Maven/Gradle entries. For every other ecosystem it reported "committed artifact and wiring verified" and exited 0 even after `pipenv lock`, `uv lock`, `npm install` or a hand edit pointed the lockfile back at the registry, so a CI gate stayed green while fresh installs got the unpatched package and `vex` refused the same checkout. Each non-JVM entry is now judged by the same vendor-ledger liveness rule `vex` and `scan` use; an unwired entry fails with `vendor_check_failed` and exit 1. Regression tests cover Pipenv, requirements.txt, Poetry, uv, Hatch and npm. Fixes #725 Assisted-by: Claude Code:claude-opus-5-5
68af164 to
46e47d9
Compare
|
BugBot review Generated by Claude Code |
1 similar comment
|
BugBot review Generated by Claude Code |
|
[burn-down agent] Ready for review at head
Generated by Claude Code |
CLI_CONTRACT.md: merged the vendor --check drift sentence to cover both this PR's wiring-liveness rule and main's package-lock rewire drift (#588); mode_migration_pypi.rs: kept this PR's stage_* helpers and #725 vendor --check tests alongside main's #765 and #699 tests. Co-Authored-By: Claude <noreply@anthropic.com>
|
bugbot run Generated by Claude Code |
The npm package-lock check (#589) names the exact unwired lock entry; running the generic liveness rule first replaced that reason, failing e2e_vex_vendor after merging main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01519c1ZV6MhuxyVisVJ5FYz
|
Generated by Claude Code |
|
Follow-up on the Generated by Claude Code |
Brings in the vex_consumed alias test fix (#849) that main's red test/test-release/coverage jobs were waiting on. Co-Authored-By: Claude <noreply@anthropic.com>
|
bugbot run Generated by Claude Code |
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 14a5931. Configure here.
|
Burn-down agent: labeled Ready for review.
Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #725
Summary
socket-patch vendor --checknow fails a vendored entry when the project's lockfile or config no longer points at its.socket/vendor/artifact. Before this change it said "committed artifact and wiring verified" and exited 0 after a relock (pipenv lock,uv lock,poetry lock,npm install, a hand edit). A CI gate built on it stayed green while every fresh install got the unpatched package, andvexrefused the same checkout withvendor_unwired.Root cause
commands/vendor.rs::run_checkchecked every entry's committed artifact bytes, but it checked wiring only for JVM entries (vendor::jvm::apply::check_entry). For npm, PyPI, gem, cargo, Go, Composer and NuGet entries it never looked at the lockfile. The issue reproduced this with Pipenv. The code path is the same for every non-JVM ecosystem, so this fixes all of them.Fix
For each non-JVM entry whose artifact is healthy,
run_checknow asksDiscovery::vendor_entry_live, the shared vendor-ledger liveness rule thatvex(vendor_unwired) andscan(cross-mode takeover) already use. Discovery is built once per run, only when there is a non-JVM entry. An unwired entry producesfailed/vendor_check_failed, with a reason that names the missing.socket/vendor/<eco>/<uuid>wiring and says to re-runsocket-patch vendor. The run exits 1, as CLI_CONTRACT.md already documents for drift. JVM entries keep their own, more detailed layout check.--checkis still offline and read-only: discovery only reads lockfiles. CLI_CONTRACT.md now says that drift includes wiring.No wrapper changes: the npm, PyPI and gem wrappers only dispatch to the binary.
Tests (red → green)
mode_migration_pypi::vendor_check_fails_after_pipenv_relockvendor_check_fails_after_{requirements_rewrite,poetry_relock,uv_relock,hatch_dependency_reset}npm installre-resolves the lock)in_process_vendor::vendor_check_fails_when_lock_no_longer_wires_artifactEach test first checks that the correctly wired project still passes (
vendor_check_ok, exit 0). It then restores the pre-vendor lockfile bytes and expectsvendor_check_failed, exit 1. The Poetry, uv and Hatch fixtures were factored intostage_*helpers that the existing takeover tests now share. That is a pure refactor.Local validation
cargo clippy --workspace --all-features -- -D warnings: clean.cargo fmt: the changed code is rustfmt-clean.mainhas unrelated unformatted hunks, which this PR leaves alone.cargo test --workspace --all-features: the new tests and the touched suites (mode_migration_pypi17/17,in_process_vendor) pass. The remaining local failures also fail on unmodifiedmainin this sandbox: chmod-based write-failure tests are ineffective as root, and self-update fixture tests can't run here. CI is the authority for those.Note
Medium Risk
Changes
vendor --checkoutcomes for previously false-green unwired entries across non-JVM ecosystems, which can flip CI from pass to fail untilsocket-patch vendoris re-run.Overview
vendor --checknow treats missing lockfile/config wiring as drift, aligning the CI gate withvex'svendor_unwiredrule instead of only verifying committed tarball bytes.After artifact (and existing npm/JVM-specific) checks pass, non-JVM ledger entries are validated via one shared
discover_wiringpass andDiscovery::vendor_entry_live. If a relock or hand edit dropped references to.socket/vendor/<ecosystem>/<uuid>while the artifact remains, the run emitsvendor_check_failedwith a wiring reason and exits 1. CLI_CONTRACT.md documents that drift covers wiring as well as the artifact.Regression tests cover npm lock re-resolution and PyPI paths (Pipenv, Poetry, uv, Hatch, requirements.txt); PyPI fixtures were refactored into shared
stage_*helpers for reuse.Reviewed by Cursor Bugbot for commit 14a5931. Configure here.
Generated by Claude Code