The unit test for "every jar copy must be patched" passes when VEX checks only the first copy
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
調査の方向性
vex/verify.rs(約390〜407行目)の verify_member_copies と、テスト maven_member_record_verifies_every_jar_copy(約2970〜3002行目)から始めてください。2つのコピーを持つフィクスチャを、無改変の jar が並び順で最初になるハッシュディレクトリ(0000…)と、最後になるハッシュディレクトリ(ffff…)の両方に置くように構築してください。どちらの場合も not_applied を期待します。新しいアサーションが issue に記載の take(1) ミュータントで失敗し、main で成功すれば完了です。実行には cargo test -p socket-patch-core --lib -- maven_member_record_verifies_every_jar_copy を使います。
索引モデルが issue の本文から書いたものです。
説明
[agent] Found by the architecture refactor routine while running mutants of safety gates against the suites that claim them. Run on main at cfc870f. Small, test code only.
Problem
verify_member_copies (core vex/verify.rs, lines 390 to 407) decides whether a Maven or Gradle patch whose record is keyed by jar members may be attested: every copy of the jar must carry the patched members. A Gradle version directory can hold the same jar in two hash directories (a re-download whose bytes changed), and a statement while one of them is pristine is a false not_affected.
The one test of that rule over two copies is maven_member_record_verifies_every_jar_copy (the same file, lines 2970 to 3002). It cannot tell "every copy" from "the first copy". Its pristine copy goes into a hash directory named 1111…, and the copies are checked in directory order, so the pristine one is read first whenever the patched jar's own SHA-1 directory sorts after it. A check that stops after the first copy still returns not_applied, and the test passes.
Evidence
The mutant, never committed:
@@ async fn verify_member_copies(
- for dir in copies {
+ for dir in copies.into_iter().take(1) {
status_verdict(jvm_jar::verify_members(&dir, jar_leaf, &record.files).await)?;
}
$ cargo test -p socket-patch-core --lib -- vex:: # with the mutant
test result: ok. 935 passed; 0 failed; 0 ignored; 0 measured; 7707 filtered out
$ cargo test -p socket-patch-core --lib -- maven_member_record_verifies_every_jar_copy
test vex::verify::tests::maven_member_record_verifies_every_jar_copy ... ok
No other suite I ran catches it either: the vex CLI group (29 tests), gradle_agent_cli (37) and e2e_maven (2) pass with the mutant on.
By its layout the assertion does catch a check of the last copy only, and an "any copy" check: both would return Ok where it expects not_applied. I did not run those two.
Planned fix
Assert both orders in the same test: put the pristine jar in a hash directory that sorts first (0000…) and then in one that sorts last (ffff…), and expect not_applied each time. A copy of the test with that loop fails on the mutant and passes on main:
$ cargo test -p socket-patch-core --lib -- maven_member_record_verifies_every_jar_copy # with the mutant
test vex::verify::tests::maven_member_record_verifies_every_jar_copy ... ok
test vex::verify::tests::zz_maven_member_record_verifies_every_jar_copy_in_both_orders ... FAILED
assertion `left == right` failed: pristine copy in ffffffffffffffffffffffffffffffffffffffff
left: Ok(())
right: Err("not_applied")
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 8641 filtered out
$ cargo test -p socket-patch-core --lib -- maven_member_record_verifies_every_jar_copy # on main
test vex::verify::tests::maven_member_record_verifies_every_jar_copy ... ok
test vex::verify::tests::zz_maven_member_record_verifies_every_jar_copy_in_both_orders ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 8641 filtered out
It can ride along with the next change to that function, or go in as a test-only PR when a slot is free.
Generated by Claude Code
- 主要言語
- Rust
- スター
- 9
- フォーク
- 2
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 282
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SocketDev/socket-patch のほかの issue
-
agent:triaged bug bughunt pm:bundler priority:p1 ux
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
SocketDev/socket-patch#2326 ·
メンテナーはふだん 1 日以内に返信
-
agent:triaged arch-audit bug priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
SocketDev/socket-patch#2306 ·
メンテナーはふだん 1 日以内に返信
-
agent:triaged arch-audit bug priority:p3
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
SocketDev/socket-patch#2296 ·
メンテナーはふだん 1 日以内に返信
-
agent:needs-human agent:triaged ci-janitor priority:p1
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
SocketDev/socket-patch#2270 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
agent:triaged arch-audit bug priority:p1
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
SocketDev/socket-patch#2259 ·
メンテナーはふだん 1 日以内に返信
SocketDev/socket-patch の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
521xueweihan/HelloGitHub#4598 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
compiler-explorer/compiler-explorer#9710 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
obi1kenobi/cargo-semver-checks#1842 ·
メンテナーはふだん 1 日以内に返信
-
agentic-workflows
難易度 1/5 1時間未満 初心者へのやさしさ 86/100