remove --preserve-state on a manifest-less hosted npm project silently restores the pin without the documented hosted_state_not_preservable note
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
crates/socket-patch-cli/src/commands/remove.rs の remove_hosted_only(1337 行付近)から始め、その後、770 行付近にある manifest ベースの hosted パスと比較します。hosted-only モードで --json の有無それぞれについて remove --preserve-state を再現し、出力を CLI_CONTRACT.md および rollback --preserve-state と比較します。両方のサポート対象出力モードで hosted_state_not_preservable の注記が表示されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
[agent] Found by the scheduled npm bug-hunt routine (ledger #302).
Summary
In v5, a project patched by a bare scan (hosted mode) has no .socket/manifest.json. On such a project, socket-patch remove <purl> --preserve-state restores the hosted pin to the upstream registry and deletes the .npmrc. So the patch is gone, even though the user asked to preserve state.
The command never tells the user this. There's no "hosted wiring has no preservable local state" note on stderr, and no warnings[] in --json (the envelope has no warnings key at all). rollback --preserve-state on the same project correctly emits hosted_state_not_preservable.
Severity is low. The behaviour (restoring anyway) is what's documented; only the advisory is missing. But --preserve-state exists so the user can expect to re-apply later, and here it silently doesn't preserve.
Repro (Linux, npm 12.1.0, main 2463257)
A local mock of the patch API serves pkg:npm/[email protected]. SPA="--api-url … --org o --api-token fake --patch-server-url …".
echo '{"name":"t","version":"1.0.0","private":true,"dependencies":{"left-pad":"1.3.0"}}' > package.json
npm install
socket-patch scan $SPA # hosted: package-lock.json + .npmrc rewritten, no .socket/
socket-patch remove pkg:npm/[email protected] --preserve-state $SPA
# The following hosted patch will be unwound and removed:
# - pkg:npm/[email protected]
# Restored pkg:npm/[email protected] to its upstream registry entry
# (no "no preservable local state" note)
socket-patch scan $SPA
socket-patch remove pkg:npm/[email protected] --preserve-state $SPA --json # status success, events[hosted_reverted], no warnings key
socket-patch scan $SPA
socket-patch rollback --preserve-state $SPA --json # warnings: [reinstall_required, hosted_state_not_preservable] <- correct
It reproduces on 2 of 2 runs.
Expected vs actual
- Expected: CLI_CONTRACT.md's warning table, row
hosted_state_not_preservable, says: "rollback--preserve-state(v5.0): hosted pins were restored to upstream anyway … (remove --preserve-stateprints the same note on stderr.)". The--preserve-state (opt-out, both rollback and remove)section says the same: "a preserve run still restores them to upstream — surfaced as thehosted_state_not_preservablewarning". - Actual: the note is printed only on the manifest-backed
removepath. The hosted-only path, which is the default v5 shape, prints nothing.
| Project shape | remove --preserve-state note |
|---|---|
| Hosted-only (no manifest), Linux npm 12.1.0 | missing (stderr and JSON) |
rollback --preserve-state, same project |
present |
Suspect code
crates/socket-patch-cli/src/commands/remove.rs:1337 (remove_hosted_only). Its doc comment says "--preserve-state still unwinds — hosted has no preservable local state". But the Note: hosted wiring has no preservable local state … eprintln only exists in the manifest-backed hosted leg (remove.rs:770).
- 主要言語
- Rust
- スター
- 8
- フォーク
- 0
- 平均マージ
- 18時間 4分
- マージ済み PR(30日)
- 70
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SocketDev/socket-patch のほかの issue
-
agent:triaged bug bughunt pm:composer priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
SocketDev/socket-patch#515 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
agent:triaged bug bughunt pm:npm priority:p1
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
SocketDev/socket-patch#464 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
agent:triaged bug bughunt pm:uv priority:p1
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
SocketDev/socket-patch#408 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
agent:triaged bug bughunt pm:yarn-berry priority:p1
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
SocketDev/socket-patch#370 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Hosted Gradle snippet is always Groovy DSL, so pasting it into a build.gradle.kts fails to compileオープンagent:triaged bug bughunt pm:gradle priority:p3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
SocketDev/socket-patch#348 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
SocketDev/socket-patch の issue をすべて見る
似ている issue
-
tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
discover: `sudo RTK_DISABLED=$VAR …` is not detected as a bypass when `sudo` is a transparent prefixオープンarea:cli bug good first issue priority:medium
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
skill:code-review
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
component:sight
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
agentic-os-org/ANOLISA#4115 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信