Vendored vlt mode makes every later `vlt deploy` fail (vlt 1.7+ refuses file: dependencies), and neither the scan nor the docs say so

未關閉 適合新手
#2,374 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
79/100
Issue 類型
文件
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, node.js, rust

研究方向

閱讀 docs/ecosystems.md 第 1044 行附近有關 vlt 的說明,並比較現有 vendored 模式的限制與此處描述的 vlt deploy 行為。記錄 vlt 1.7+ 會拒絕使用 vendored file: 相依項目進行 deploy,且 hosted 模式可以正常運作。如果新增 scan 警告,請檢查 crates/socket-patch-core/src/vendor/vlt_lock.rs 第 962 行附近的 plan_wiring 和第 1171 行附近的提示;確認 vendored scans 會顯示該警告。

由索引模型根據 Issue 內容生成。

描述

agent:triaged bug bughunt pm:vlt priority:p1

[agent] Found by the scheduled vlt bug-hunt routine (ledger #307).

Summary

vlt deploy <dir> (new in vlt 1.7.0) copies a project or workspace plus its production dependencies into a standalone folder, for example for a Docker image. It refuses outright any file: dependency in the production graph:

Usage Error: vlt deploy does not support file: dependencies
  Found: file~.socket+vendor+npm+aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa+left-pad-1.3.0+node__modules+left-pad

Vendored vlt mode wires every patched direct dependency as exactly such a file:./.socket/vendor/npm/<uuid>/... dependency. So once a vendored scan succeeds (exit 0, success), every later vlt deploy of that project, or of any workspace member that depends on a vendored package, exits 1. The project still installs, builds and loads patched code locally, so nothing points at the cause until the deploy step in CI or the Docker build fails. Neither the scan output nor the vlt docs mention it (docs/ecosystems.md "npm: vlt notes", vendored section, ~line 1044), although they do list other vlt limits there with "use hosted mode for those".

Hosted mode is unaffected: the pinned vlt-lock.json carries into the deploy output, the deployed project loads patched code, and vlt ci inside the output also stays patched. Re-running scan --mode hosted over the vendored project (the takeover) fixes vlt deploy, so the way out exists. Users just aren't told about it.

Impact

Do no harm: a vlt project whose vlt deploy worked before the vendored scan fails it afterwards. The failure is loud, but it shows up in a later CI or Docker stage, not in the scan.

Repro (vlt 1.9.0, main cfc870f)

This uses the mock registry and patch API attached to #1494, started on :18555 and :18556, with the env from #1494.

mkdir app && cd app && git init -q
echo '{"name":"app","version":"1.0.0","main":"index.js","dependencies":{"left-pad":"1.3.0","right-pad":"1.3.0"}}' > package.json
echo '{"config":{"registries":{"npm":"http://127.0.0.1:18555/"}}}' > vlt.json
echo "console.log(require('left-pad'), require('right-pad'))" > index.js
vlt install --allow-scripts :scripts
vlt deploy ../out-before --allow-scripts :scripts   # exit 0
socket-patch scan --mode vendored --yes --json        # exit 0, success
vlt ci --allow-scripts :scripts && node index.js      # patched patched
vlt deploy ../out --allow-scripts :scripts            # exit 1: "vlt deploy does not support file: dependencies"
socket-patch scan --mode hosted --yes --json          # takeover, exit 0
vlt ci --allow-scripts :scripts
vlt deploy ../out2 --allow-scripts :scripts && (cd ../out2 && node index.js)   # exit 0, patched patched

For the workspace shape (root vlt.json workspaces: ["packages/*"], member a → left-pad + b: workspace:*, member b → rp: npm:[email protected]), vlt deploy -w packages/a ../out fails the same way after a vendored scan, and passes (patched) after a hosted scan.

The refusal lives in vlt's deploy command. It throws EUSAGE for any reached node whose DepID tuple type is file, and it does so on purpose: it can't relocate a path dependency.

Expected vs actual
  • Expected: a mode change that breaks a vlt workflow that worked before is either avoided or stated up front. docs/ecosystems.md already lists the vlt cases vendored mode can't serve and points them to hosted mode; vlt deploy belongs on that list. The vendored scan, or at least the docs, should say that vlt ≥ 1.7 vlt deploy refuses vendored (file:) dependencies and that hosted mode works with it.
  • Actual: the scan exits 0 with no warning, and the docs don't mention deploy. The first sign is a failed vlt deploy.
Versions (Linux)
socket-patch vlt vendored → vlt deploy hosted → vlt deploy
main cfc870f 1.9.0 fail (root ×2, workspace ×1) pass, patched (root, workspace)
main cfc870f 1.7.0 fail (not run)
v5.1.0 1.9.0 fail pass, patched
any ≤ 1.6.x n/a (no deploy command) n/a

It isn't a regression in socket-patch: the incompatibility appeared when vlt 1.7.0 added deploy. The behavior comes from vlt itself, so macOS and Windows almost certainly behave the same, but I didn't probe them.

Suspect code / docs
  • crates/socket-patch-core/src/vendor/vlt_lock.rs:962 (plan_wiring), which moves the importer edges and package.json specs to file:. A vlt-specific advisory could go next to vendor_vlt_reinstall_required (vlt_lock.rs:1171).
  • docs/ecosystems.md:1044, the "Vendored: directory artifacts" paragraph of the vlt notes.

Related, same class on other managers: #2263 (pnpm 12 file: refusal), #2326 (vendored gems in Docker layers).


Generated by Claude Code

主要語言
Rust
星號
9
分支
2
平均合併
1 天 5 小時
30 天內合併 PR
232

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

SocketDev/socket-patch 的其他 Issue

查看 SocketDev/socket-patch 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。