Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

`apply --check` drift report tells you to run `socket-patch apply` without the `-g` / `--global-prefix` / `--cwd` it was given, so following it patches nothing and exits 0

クローズ 初心者向け
#1,219 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #1325 @mikolalysenko による — マージ済み

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python, rust
領域
cli

調査の方向性

問題のある修正は、crates/socket-patch-cli/src/commands/apply.rs の 674 行付近にある run_check 内の固定された eprintln! です。これは args.common(global、global_prefix、cwd、manifest_path、ecosystems)を無視しています。#777 の修正で scan -g に使われた report_only_hint ヘルパーを手本にし、同じスコープのフラグから apply コマンドを組み立ててください。issue の再現手順の後に、表示された対処コマンドをそのまま実行してコピーが修復され、次の apply --check が終了コード 0 で終われば完了です。

索引モデルが issue の本文から書いたものです。

説明

agent:triaged bug bughunt pm:pipenv priority:p1

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

Summary

When apply --check finds drift, the human report always ends with the fixed line:

Error: Patches are OUT OF SYNC:
  pkg:pypi/[email protected]: patch not applied (an installed copy is still unpatched)
Run `socket-patch apply` to regenerate them.

The suggested command drops every scope flag the check ran with. The check itself is correct (exit 1 on the stale copy), but running the remedy as printed targets a different tree:

  • apply --check -g --global-prefix <site-packages> (the Docker pipenv install --system shape): plain socket-patch apply crawls the cwd project, prints 0 of 1 targeted patch applied, … 1 not found on disk, and exits 0. The global copy stays unpatched. apply -g without the prefix patches the default system interpreter instead. In the sandbox that was the distro's /usr/lib/python3/dist-packages/six.py, which isn't the tree that was checked.
  • apply --check --cwd app (CI running from a parent directory): plain socket-patch apply prints No patch manifest found; nothing to apply. and exits 0. The Pipenv venv stays unpatched.

This is the same class as #464 (the report-only scan -g hint dropped -g), which was fixed in #777. The apply --check report wasn't covered by that fix.

Impact

apply --check is the CI / GitHub-App audit gate (CLI_CONTRACT apply --check row). A user or CI job that follows its remedy gets exit 0 and believes the drift is fixed. The next apply --check fails again, and the installed copy keeps running unpatched bytes in the meantime. There's no false VEX: this is a misleading remedy, not a wrong verdict.

Repro (Linux, main f3c6313, Pipenv 2026.8.0, local mock of the patch API serving a patched six-1.16.0 wheel)

# global / Docker `pipenv install --system` shape
G=$(mktemp -d)/sys; python3.11 -m venv "$G"; SPK=$G/lib/python3.11/site-packages
"$G/bin/pip" install six==1.16.0
cd my-pipenv-project                       # Pipfile + Pipfile.lock pinning six==1.16.0
socket-patch scan -g --global-prefix "$SPK" --mode agent --yes      # patches $SPK/six.py
"$G/bin/pip" install --force-reinstall --no-deps six==1.16.0       # image rebuilt / reinstall
socket-patch apply --check -g --global-prefix "$SPK"               # exit 1, "Run `socket-patch apply` to regenerate them."
socket-patch apply                                                 # the remedy verbatim: exit 0, "1 not found on disk"
head -1 "$SPK/six.py"                                              # still the upstream bytes

# --cwd shape (agent mode, Pipenv WORKON_HOME venv)
socket-patch scan --cwd app --mode agent --yes
(cd app && pipenv run pip install --force-reinstall --no-deps six==1.16.0)
socket-patch apply --check --cwd app       # exit 1, same remedy line
socket-patch apply                         # exit 0, "No patch manifest found; nothing to apply."

I reproduced the -g --global-prefix lane 3 times and the --cwd lane once. In both, the remedy with the original flags (apply -g --global-prefix "$SPK", apply --cwd app) heals the tree, and the next --check exits 0.

Expected vs actual

  • Expected: the remedy names the command that fixes what the check just reported. That means the same scope as the check: -g, --global-prefix <dir>, --cwd <dir>, and --manifest-path / --ecosystems when given. That's how #464 / #777 fixed the scan -g hint. CLI_CONTRACT's apply --check row specifies the Error: Patches are OUT OF SYNC: report, and its purpose is to be acted on.
  • Actual: a fixed string with no scope flags. Following it exits 0 and patches nothing, or patches a different interpreter (-g without the prefix).

OS × version

OS Pipenv Shape Result
Linux 2026.8.0 apply --check -g --global-prefix (pip-installed six, install --system shape) reproduces (×3)
Linux 2026.8.0 apply --check --cwd app (WORKON_HOME venv) reproduces
macOS / Windows not probed the line is a constant string expected to be the same

This isn't Pipenv- or PyPI-specific: every ecosystem's apply --check goes through the same branch.

Suspect code

crates/socket-patch-cli/src/commands/apply.rs:674, in run_check: eprintln!("Run \socket-patch apply` to regenerate them.");doesn't consultargs.common (global, global_prefix, cwd, manifest_path, ecosystems). Compare report_only_hint` after #777.

主要言語
Rust
スター
8
フォーク
0
平均マージ
19時間 21分
マージ済み PR(30日)
421

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SocketDev/socket-patch のほかの issue

SocketDev/socket-patch の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。