Skip to content

Commit e7ca4ce

Browse files
committed
audit-cli-tests: e2e_pypi*, e2e_redirect_{bun..gradle}, golang_production; T70-T73; 5 carried rows
Assisted-by: Claude Code:claude-opus-5-5
1 parent 78f118d commit e7ca4ce

5 files changed

Lines changed: 117 additions & 35 deletions

File tree

‎coverage/files.tsv‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,16 @@ crates/socket-patch-cli/tests/e2e_maven.rs 331 audit-cli-tests cbbbdb9 2026-11-0
156156
crates/socket-patch-cli/tests/e2e_npm.rs 762 audit-cli-tests cbbbdb9 2026-11-02 - delete has_command L42, git_sha256_file L53, assert_run_ok L87, write_package_json L113, npm_run L96 (T55); dead assert L416-420; merge save_only L510 into dry_run L250; stale comments L73, L586-587 (default refuses, not warn-overwrite); 7 #[ignore] live tests never in CI, silent skips; has_cve L201 ignores id (gem L529 drift); ci.yml L1498 dead e2e_npm gate
157157
crates/socket-patch-cli/tests/e2e_nuget.rs 297 audit-cli-tests cbbbdb9 2026-11-02 - L148-151 contains(scannedPackages: {n}) unterminated: 10-19 pass n=1 (T69) -> parse JSON; identical-operand && L226, L285; inline parse_found_count L79; drop always-project_dir cwd param of assert_json_scanned; legacy test L268 aliases NUGET_PACKAGES to packages/ -> empty dir; start_proxy/assert_proxy (T64); ~15 comment lines
158158
crates/socket-patch-cli/tests/e2e_nuget_dotnet_build.rs 1217 audit-cli-tests cbbbdb9 2026-11-02 - delete copy_tree L320 (= prebuilt_common L722, T64); local assert_omitted L407 -> vex_e2e_common; stale --vendor-source build docs L18-22, L904 (code passes service); module doc overclaims VEX L1-2; Backend Option always Some; patched-fixture preamble x4 -> helper; 5 env.to_string().contains(code) -> codes_in; solution test re-implements fresh_checkout L1192; DOTNET_SPAWN narration L94-107
159-
crates/socket-patch-cli/tests/e2e_pypi.rs 895 audit-cli-tests - -
160-
crates/socket-patch-cli/tests/e2e_pypi_bytecode.rs 221 audit-cli-tests - -
161-
crates/socket-patch-cli/tests/e2e_pypi_multi_copy.rs 290 audit-cli-tests - -
162-
crates/socket-patch-cli/tests/e2e_redirect_bun_build.rs 1917 audit-cli-tests - -
163-
crates/socket-patch-cli/tests/e2e_redirect_cargo_build.rs 1066 audit-cli-tests - -
164-
crates/socket-patch-cli/tests/e2e_redirect_cargo_shapes.rs 1559 audit-cli-tests - -
165-
crates/socket-patch-cli/tests/e2e_redirect_composer_build.rs 1009 audit-cli-tests - -
166-
crates/socket-patch-cli/tests/e2e_redirect_gem_build.rs 4771 audit-cli-tests - -
167-
crates/socket-patch-cli/tests/e2e_redirect_gem_stale_install.rs 1881 audit-cli-tests - -
168-
crates/socket-patch-cli/tests/e2e_redirect_gradle_build.rs 2288 audit-cli-tests - -
159+
crates/socket-patch-cli/tests/e2e_pypi.rs 895 audit-cli-tests fd86ff2 2026-11-02 - delete local git_sha256_file/assert_run_ok (T55); has_python3 skip has no REQUIRED gate (T50); fold 5 `nontrivial` blocks + hash loops into 2 helpers; merge dry_run and save_only (same flow); save_only counter counts unchecked files; global scan: assert the pydantic-ai purl in packages[]; drop macOS re-checks; ~30 comment lines (v3-v5 history, stale _ssrf.py)
160+
crates/socket-patch-cli/tests/e2e_pypi_bytecode.rs 221 audit-cli-tests fd86ff2 2026-11-02 - inline python_on_path, stage_patch; share the dupkit fixture with e2e_pypi_multi_copy (T73); `let Some(py) else return` skip needs a REQUIRED gate (T50); PYTHON_VARS overlaps multi_copy by 7 names: one hermetic Extra::Python; ~4 comment lines
161+
crates/socket-patch-cli/tests/e2e_pypi_multi_copy.rs 290 audit-cli-tests fd86ff2 2026-11-02 - local envelope -> common::envelope; re-apply asserts only the exit code: assert 0 applied events; rollback --json is never parsed: assert a rolled-back event per copy; share dupkit with e2e_pypi_bytecode (T73); ~6 "Apply used to" history lines
162+
crates/socket-patch-cli/tests/e2e_redirect_bun_build.rs 1917 audit-cli-tests fd86ff2 2026-11-02 - bun toolchain block -> shared module (T70); inline 6 single-caller fns; drop wrappers bun/run_socket/bun_hosted_project; v1 leg final proj/bun.lock assert and L1396 precondition cannot fail; 3 asserts redundant before assert_eq; npmrc warning by substring (C32); tamper oracle accepts any "hash"; split 440-line bun_hosted_project_with; stale ledger docs; ~70 comment lines; T55 T64 T72
163+
crates/socket-patch-cli/tests/e2e_redirect_cargo_build.rs 1066 audit-cli-tests fd86ff2 2026-11-02 - move cargo/sparse_index_rel/find_registry_crate/build_patched_crate/stage_fixture to cargo_e2e_matrix, locked_version/package_block -> parse_lock (T71); sha256_hex -> common (T55); ledger asserts -> assert_no_hosted_ledger; drop no-op strip_manifest/strip_ledgers; fix (1)/(2) labels; 4b `if let Some(pristine)` makes the check optional; ~40 comment lines
164+
crates/socket-patch-cli/tests/e2e_redirect_cargo_shapes.rs 1559 audit-cli-tests fd86ff2 2026-11-02 - inline 8 single-caller fns (build_crate, router, urlencoding_decode, contest_after_scan, ...); Shape::default (15 literals, ~120 lines); split 365-line run_shape; unwind accepts a trailing newline for every shape, scope it to config-unterminated; contest VEX ignores exit code and greps; vex argv x2; stale ledger doc; ~40 comment lines ("Bug B/H/F/K"); T64 T71
165+
crates/socket-patch-cli/tests/e2e_redirect_composer_build.rs 1009 audit-cli-tests fd86ff2 2026-11-02 - inline setup_vtag_project, locked_version, zip_top, composer_release (drifted copy of composer_major, unwrap_or(0) picks a branch silently); one composer.lock reader (x3 here + e2e_vendor_composer_build); 2 tamper assert_ne!(patched) cannot fail: assert absent; GetUuid arm checks no status/applied; fix step comments; no-ledger assert x3; ~15 comment lines; T72
166+
crates/socket-patch-cli/tests/e2e_redirect_gem_build.rs 4861 audit-cli-tests fd86ff2 2026-11-02 - 16 refusal tests end in assert!(fx.is_none()) that cannot fire: one table test over an enum result; inline 8 single-caller fns; drop run_socket/bundle wrappers; sha256_hex -> common (T55); split 787-line redirect_scanned_project, 28-arm argv match -> `_`; ~8 in-file copies; hand-rolled vex -> run_vex; ~120 history comment lines; C32 T64 T69 T73
167+
crates/socket-patch-cli/tests/e2e_redirect_gem_stale_install.rs 1881 audit-cli-tests fd86ff2 2026-11-02 - grow hosted_scan_json, drop 11 hand-copied scan argv lists (~200 lines); 9 `if let Ok(doc)` VEX checks pass when no file is written; attestation by doc.contains -> assert_attested; one test drops exit code; force/redownload check only greps both words; hosted_pinned -> hosted_pins (T64); converged_lock dup; header lists 7 of 22 tests; ~35 comment lines
168+
crates/socket-patch-cli/tests/e2e_redirect_gradle_build.rs 2288 audit-cli-tests fd86ff2 2026-11-02 - codes()/snippet_code() iterate json["warnings"] twice; inline 5 single-caller fns + wrappers mount_api/stage_manifest/codes/sfx; Cell::vex ignores exit code, missing doc = 0 statements; assert_fails_loud ~only checks !ok; dead locking() match; `let _ = stderr`; takeover test drops scan code; mount_grants forks hosted_maven_common::mount_api (T72); jar fixtures (T73)
169169
crates/socket-patch-cli/tests/e2e_redirect_maven_build.rs 521 audit-cli-tests - -
170170
crates/socket-patch-cli/tests/e2e_redirect_npm_build.rs 1418 audit-cli-tests - -
171171
crates/socket-patch-cli/tests/e2e_redirect_pnpm_build.rs 2224 audit-cli-tests - -
@@ -263,6 +263,7 @@ crates/socket-patch-cli/tests/get/global_packages_e2e.rs 611 audit-cli-tests - -
263263
crates/socket-patch-cli/tests/get/main.rs 33 audit-cli-tests - -
264264
crates/socket-patch-cli/tests/global_scope_project_state.rs 1442 audit-cli-tests - -
265265
crates/socket-patch-cli/tests/golang_e2e_matrix/mod.rs 406 audit-cli-tests - -
266+
crates/socket-patch-cli/tests/golang_production/mod.rs 224 audit-cli-tests fd86ff2 2026-11-02 - drop #[path] re-mounts of cache_env/hermetic/oracle (parents mount common); narrow #![allow(dead_code)]; `action == "redirected"` is not an envelope action and mode is unchecked: assert applied + details.mode; copy_tree (T64); helper for go-run-compare x6; parent comments still call golang unsupported (T68)
266267
crates/socket-patch-cli/tests/gradle_agent_cli.rs 1363 audit-cli-tests - -
267268
crates/socket-patch-cli/tests/gradle_build_common/mod.rs 791 audit-cli-tests - -
268269
crates/socket-patch-cli/tests/help_text_hygiene.rs 337 audit-cli-tests - -
@@ -766,6 +767,8 @@ crates/socket-patch-core/src/vendor/gem.rs 9222 audit-core - -
766767
crates/socket-patch-core/src/vendor/go_build_list.rs 387 audit-core - -
767768
crates/socket-patch-core/src/vendor/go_consumer_sync.rs 1240 audit-core - -
768769
crates/socket-patch-core/src/vendor/go_mod_edit.rs 2637 audit-core - -
770+
crates/socket-patch-core/src/vendor/go_native_vendor.rs 1049 audit-core - -
771+
crates/socket-patch-core/src/vendor/go_sum_backup.rs 409 audit-core - -
769772
crates/socket-patch-core/src/vendor/go_sum_edit.rs 884 audit-core - -
770773
crates/socket-patch-core/src/vendor/go_workspace.rs 2022 audit-core - -
771774
crates/socket-patch-core/src/vendor/golang.rs 2934 audit-core - -

‎doc/05-tests.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Part 5
22

3-
_Last checked against main @ cbbbdb9 on 2026-11-02 by audit-core._
3+
_Last checked against main @ fd86ff2 on 2026-11-02 by audit-cli-tests._
44

55
Tests:Fake tests (asserting on their own mocks, recomputing expected values with the code under test, unable to fail, claiming more than they check), mock overuse where a tempdir or a real install is cheap, sentence-matching assertions, duplicate tests, and real coverage gaps. Per-directory tallies and the fixes that landed.
66

@@ -113,4 +113,9 @@ _Last checked against main @ cbbbdb9 on 2026-11-02 by audit-core._
113113
- Weak oracles: nuget's unterminated `scannedPackages: {n}` substring passes 10–19 for 1; `!a && !a` ×5 {{T69}}; ~40 sentence `.contains` on `--json` stdout (C32); Go drift and refusal tests assert only a non-zero exit.
114114
- Silent or never-run: `e2e_npm` (7) and `e2e_gem` (3) are `#[ignore]`d live tests, never in CI, that skip without a REQUIRED gate {{T50}}; the go<1.22 sub-gate skips without a line.
115115
- Scaffolding: Go harness copied across 5 suites {{T65}}; no Go `Extra` in `hermetic` and process-wide `set_var` {{T66}}; hosted/vendored production near-fork {{T68}}; Gradle world setup ×4 and victim helpers ×2.
116+
- **Tally for `e2e_pypi*` (3), `e2e_redirect_{bun,cargo,cargo_shapes,composer,gem,gem_stale_install,gradle}_build`, `golang_production` (11 files, 16.2K lines, audit-cli-tests 2026-11-02 16:20Z): about 53 fake or weak tests.**
117+
- Can't fail: gem's 16 refusal tests end in `assert!(fx.is_none())` after a fixture that returns `None` or panics; bun's v1 leg re-reads a `bun.lock` nothing touched since the fixture checked it; composer's two tamper `assert_ne!(patched)` where the server never serves the patched bytes; `golang_production` accepts `action == "redirected"`, which no event carries.
118+
- Pass when the output is missing: 9 gem stale-install VEX checks (`if let Ok(doc)`), cargo-shapes contest and gradle `Cell::vex` (missing doc = 0 statements, exit code ignored); gradle `assert_fails_loud` checks little beyond `!ok`.
119+
- Weak oracles: gradle `codes()` reads `warnings` twice; cargo-shapes unwind accepts a trailing newline for every shape; ~15 more sentence or raw-JSON `.contains` (C32).
120+
- Scaffolding: bun toolchain ×3 {{T70}}; cargo fixture helpers ×3-4 beside `cargo_e2e_matrix` {{T71}}; hosted API mocks hand-mounted in ~120 files {{T72}}; two-suite fixture copies {{T73}}; `golang_production` re-mounts `common` modules under `#[path]`.
116121
- **Coverage gaps:** a lockfile-only calm skip and a genuine miss serialize identically (`skipped`/`package_not_installed`), and an apply no-matching-variant miss emits no event, so the JSON tests can't check either (executed; C13); no offline round-trip test of the cargo matrix's `Cargo.lock` codec.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
[agent] 2026-11-02: architecture audit (audit-cli-tests)
2+
3+
`main` @ `fd86ff2`. Since `cbbbdb9`, ten PRs merged: the `args.rs` sweep #1842 and fixer and CI-janitor PRs. None of them resolves an open T issue. I read 11 files, 16,201 lines, all of them complete with no `partial`: `e2e_pypi`, `e2e_pypi_bytecode`, `e2e_pypi_multi_copy`, `e2e_redirect_bun_build`, `e2e_redirect_cargo_build`, `e2e_redirect_cargo_shapes`, `e2e_redirect_composer_build`, `e2e_redirect_gem_build` (4,861 lines), `e2e_redirect_gem_stale_install`, `e2e_redirect_gradle_build`, and the new `golang_production/mod.rs`.
4+
- **Manifest sync:** added 3 new files: `tests/golang_production/mod.rs` (mine), plus core `vendor/go_native_vendor.rs` and `vendor/go_sum_backup.rs` (audit-core's, unaudited).
5+
- **Steering:** no maintainer comments.
6+
- **How the files were read:** five parallel readers. Before filing, I re-checked the bun and cargo helper copies myself with md5 of the normalized fn bodies, and confirmed by grep that `"redirected"` is not an event action and that the gem file has 16 `is_none()` asserts.
7+
- **Not run:** nothing was built or executed this run. No finding below is marked executed.
8+
9+
### Per file
10+
Counts are single-caller helpers / wrappers / deletable comment lines / fake or weak tests. Each file's cleanup list is in its `notes` column.
11+
12+
| File | Lines | Counts | Note |
13+
|---|---|---|---|
14+
| `e2e_pypi.rs` | 895 | 0 / 2 / ~30 / 5 | dry_run and save_only run the same flow; the counter counts files it never checked. |
15+
| `e2e_pypi_bytecode.rs` | 221 | 2 / 0 / ~4 / 1 | Silent skip with no REQUIRED gate (T50). |
16+
| `e2e_pypi_multi_copy.rs` | 290 | 0 / 1 / ~6 / 2 | Its `--json` rollback output is never parsed. |
17+
| `e2e_redirect_bun_build.rs` | 1917 | 6 / 3 / ~70 / 6 | Bun toolchain ×3 (T70); the v1 leg's last assert can't fail. |
18+
| `e2e_redirect_cargo_build.rs` | 1066 | 5 / 3 / ~40 / 3 | Fixture helpers ×4 (T71); 4b's check is optional. |
19+
| `e2e_redirect_cargo_shapes.rs` | 1559 | 8 / 2 / ~40 / 2 | `run_shape` is 365 lines; the unwind tolerance is too wide. |
20+
| `e2e_redirect_composer_build.rs` | 1009 | 4 / 1 / ~15 / 5 | Tamper `assert_ne!` can't fail. |
21+
| `e2e_redirect_gem_build.rs` | 4861 | 8 / 3 / ~120 / 9 | 16 `is_none()` asserts can't fire; a 787-line fixture. |
22+
| `e2e_redirect_gem_stale_install.rs` | 1881 | 1 / 1 / ~35 / 12 | 9 VEX checks pass when no file is written; argv ×11. |
23+
| `e2e_redirect_gradle_build.rs` | 2288 | 7 / 4 / ~15 / 7 | `codes()` reads `warnings` twice (confirmed); `Cell::vex` ignores the exit code. |
24+
| `golang_production/mod.rs` | 224 | 1 / 0 / ~1 / 1 | `#[path]` re-mounts of `common`; checks an impossible `"redirected"` action. |
25+
26+
### Structural findings
27+
- **T70 → [#1992](https://github.com/SocketDev/socket-patch/issues/1992) (new).** The bun toolchain block is copied across `e2e_redirect_bun_build`, `e2e_vendor_bun_build` and `mode_migration_bun`.
28+
- Six helpers are md5-identical in all three suites (`parse_bun_version` 59beb239, `bun_required` 87d11bab, `pinned_bun_version` f0a8041d, `expected_lock_version` 302e2a61, `fixture_install_args` f599907c, `packages_line` 9864c4c9).
29+
- The three `bun_toolchain` copies differ only in the suite name.
30+
- **T71 → [#1993](https://github.com/SocketDev/socket-patch/issues/1993) (new).** The cargo suites re-write their fixture helpers beside `cargo_e2e_matrix`, which they already include.
31+
- `cargo` ×4 (f9f7f391), `sparse_index_rel` ×3 (c5573a49) and `find_registry_crate` ×4 (07d0421e; the shapes copy has drifted to fbb0ccc2).
32+
- `locked_version` ×3 (b933fd5b) and `package_block` ×3 (312981d4) hand-parse `Cargo.lock`, although `parse_lock` already reads it.
33+
- **T72 (to verify, new).** The hosted patch-API mocks are hand-mounted in 122 test files (counted by grepping for `patches/by-package`). The by-package block is identical in bun and composer, and npm differs only in a constant's name. Gradle `mount_grants` is a fork of `hosted_maven_common::mount_api`: it adds multiple grants, `server.reset()` and global constants. This needs a design (one `mount_hosted_api`) before it can be filed.
34+
- **T73 (to verify, new).** Fixtures copied between pairs of suites:
35+
- pypi `dupkit` (bytecode and multi_copy; `stage_patch` differs only in its vuln and description);
36+
- JVM `central_file`/`pristine_jar`/`patch_jar` (gradle redirect and agent, md5-identical);
37+
- the `ruby -e 'puts Gem.ruby_api_version'` probe ×7, where gem_build L1629 drops the status check;
38+
- `percent_decode` ×3.
39+
- **More evidence for existing rows:**
40+
- **T55:** `sha256_hex` (7de5c5fd) is identical in 6 files that include `common`. `e2e_pypi` keeps `git_sha256_file` and `assert_run_ok` byte-for-byte.
41+
- **T64:** `hosted_pinned` is md5-identical in gem_stale and hosted_production, and appears in 10 files by name. `copy_dir_recursive` adds a drifted gem copy (2fe2a6f1), and `golang_production` adds a 21st copy-tree body.
42+
- **T68:** `golang_production` (#1698) merged the two Go legs into one `delivery(mode)`. `has_command`/`pm_command`/`tool` are still md5-identical in both suites, and the parents' comments still call golang "unsupported".
43+
- **T69:** gradle `codes()` iterates `[&json["warnings"], &json["warnings"]]`, and its doc names a `redirect` block that carries no warnings. gem_build `contains("mirror_overrides_source")` follows a check on a longer string that contains it.
44+
- **T50:** pypi_bytecode `let Some(py) else return` and the two bundler < 2.2 `println!` + `return` in gem_build skip with no REQUIRED gate.
45+
- **C32:** about 15 more sentence or raw-JSON `.contains` asserts.
46+
47+
### Carried rows reconciled (5)
48+
- **C32:** `filed #1089` (still open).
49+
- **C33:** `filed #948`. CLI_CONTRACT.md is now 611 KB.
50+
- **C48:** `filed #1067`. [pdm_site.rs L314](https://github.com/SocketDev/socket-patch/blob/fd86ff211cae896fef2b0e20375f71e6cb52a38b/crates/socket-patch-core/src/crawlers/python_crawler/pdm_site.rs#L314) still keeps its own `tokio::time::timeout`.
51+
- **C68:** `filed #426`, the only one of the 9 bugs still open.
52+
- **C69:** `filed #761, #836`. Both are still open.
53+
54+
### Register refresh
55+
- No T issue closed. #1849 closed #1832, which is the sibling's row.
56+
- To stay under 15K characters, I shortened the problem cells of 14 rows: T06, T08, T10, T12, T16, T19, T21, T24, T30-T32, T34, T42, T46, T47, T51, T57 and T65.
57+
58+
### Ruled out
59+
- **Cargo, bun, composer and gradle skips:** they go through gated helpers (`cargo_available`, `bun_toolchain`, `composer_e2e_common::skip`, `gradle_skip`), so they are not silent.
60+
- **`#[ignore]` on pypi, composer, gem and gradle:** each is backed by a CI job or a documented on-demand run.
61+
- **Composer rollback reaching packagist and `golang_production` using the live proxy:** both are intended, so neither is T53.
62+
- **T61 and T67:** neither applies to the files read this run.
63+
- **`md5_hex` in gem vs maven:** not a copy; ruby shell-out vs pure Rust.
64+
- **`mount_api`'s `view_budget`:** it has a real `Some(1)` caller.
65+
66+
### Next files
67+
`e2e_redirect_maven_build` (521), `e2e_redirect_npm_build` (1418), `e2e_redirect_pnpm_build` (2224), `e2e_redirect_rush_sim` (734), `e2e_redirect_uv_build` (111), `e2e_redirect_vlt_build` (1706), `e2e_redirect_yarn_berry_build` (1056), `e2e_redirect_yarn_classic_build` (1929), `e2e_safety_*` (7 files, 5,133 lines). About 14.8K lines.
68+
69+
---
70+
_Generated by [Claude Code](https://claude.ai/code)_

0 commit comments

Comments
 (0)