Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Vendored PyPI revert drift warnings print the ledger key in Rust debug form: `Pipfile.lock entry for Some("default:six") changed since vendoring`

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

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
rust
領域
tooling

研究方向

錯誤輸出來自 crates/socket-patch-core/src/vendor/state.rs 中 WiringRecord::key 對 Option<String> 鍵使用的 {:?} 格式化。該鍵用於 pypi_pipenv.rs 中的 vendor_lock_entry_drifted 和 pypi_requirements.rs 中的 vendor_revert_line_drifted,pypi_uv.rs 和 common.rs 中也有相同的模式。請先閱讀這四處呼叫位置,以及既有的 vendor_revert_residual_reference 警告,該警告已經直接輸出鍵的原始內容。完成的標準是:drift 警告輸出裸鍵或 None 的佔位符,並且 revert/rollback 測試仍然通過。

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

描述

agent:triaged bug bughunt pm:pipenv priority:p1

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

Summary

When a vendored Pipenv project's recorded wiring has drifted, vendor --revert, remove and rollback warn with the ledger key formatted through {:?} on an Option<String>. The warning, in both human output and --json warning text, shows a Rust Some("…") wrapper instead of the key:

Warning: Pipfile.lock entry for Some("default:six") changed since vendoring; left untouched
Warning: requirements.txt: the vendor line for Some("requirements.txt:1") changed since vendoring; left untouched

Impact

This is cosmetic only. The keep/restore behaviour is correct, nothing is unpatched silently, and VEX isn't affected. But the debug form leaks into user-facing text and into the --json warning messages that CI consumers read. When the key is missing (None, e.g. an older or hand-written ledger), the warning would print entry for None.

Repro (Linux, main 657fce2 / 5.0.1, real Pipenv 2026.9.1, local mock of the patch API serving a patched six-1.16.0 wheel)

cat > Pipfile <<'EOF'
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
six = "==1.16.0"

[requires]
python_version = "3.11"
EOF
pipenv lock
socket-patch scan --mode vendored --yes          # Pipfile.lock six → ./.socket/vendor/pypi/<uuid>/six-…whl
# drift the vendored entry (any field the ledger recorded, e.g. its markers)
sed -i "s/python_version >= '2.7' and/python_version >= '2.8' and/" Pipfile.lock
socket-patch vendor --revert --yes               # Warning: Pipfile.lock entry for Some("default:six") changed since vendoring; left untouched
socket-patch rollback --yes --json | grep -o 'entry for Some[^;]*'   # entry for Some(\"default:six\") changed since vendoring

The requirements.txt variant: vendor with a sibling requirements.txt holding six==1.16.0, then hand-restore that line (or interrupt a remove with SIGKILL after it restored requirements.txt but before it dropped the ledger) and re-run vendor --revert. It prints the vendor line for Some("requirements.txt:1") changed since vendoring.

Expected vs actual

  • Expected: the warning names the entry as the ledger records it (Pipfile.lock entry for default:six …, the vendor line for requirements.txt:1 …). Other warnings in the same code path print keys plainly, e.g. the vendor_revert_residual_reference text.
  • Actual: Some("default:six") / Some("requirements.txt:1").

OS × version

OS Pipenv vendor --revert rollback remove
Linux 2026.9.1 reproduces (×2) reproduces (×2) reproduces (requirements.txt variant)
macOS / Windows not probed: the string formatting is platform-independent

No bisect, because the format strings predate the current history.

Suspect code

WiringRecord::key is Option<String> (crates/socket-patch-core/src/vendor/state.rs:143), and these format it with {:?}:

  • crates/socket-patch-core/src/vendor/pypi_pipenv.rs:569 (vendor_lock_entry_drifted)
  • crates/socket-patch-core/src/vendor/pypi_requirements.rs:601 (vendor_revert_line_drifted)
  • the same pattern at crates/socket-patch-core/src/vendor/pypi_uv.rs:991 and crates/socket-patch-core/src/vendor/common.rs:826 (not exercised here; they likely show the same leak for uv and the other common.rs users)

A fix along the lines of rec.key.as_deref().unwrap_or("<unknown>") with {} would cover all four.

主要語言
Rust
星號
8
分支
1
平均合併
16 小時 18 分鐘
30 天內合併 PR
587

環境準備

  • 沒有 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 摘要。