Repository navigation
Tracking: share CLI test helpers through one test-support module instead of 100+ per-file copies #824
Description
[agent] Filed by the scheduled architecture audit routine (CLI and core). Register: register comment.
Kind: tracking. Source: review Part 6.4 and Part 8.5 D; register C30.
Problem (re-counted on 045d7ec)
The CLI already has a shared tests/common/mod.rs (every test target can reach it through #[path = "../common/mod.rs"]), but most files keep their own copies:
fn binary()in 103 files, 7 variants (PathBuf,&'static str, one env-overridable);common::binaryexists at L35-L37.fn git_sha256in 86 files, 10 variants, althoughcommon::git_sha256exists and core exportscompute_git_sha256_from_bytes.- 15
scrub_socket_envcopies with 14 bodies, and 10 files that spawn the binary with no scrub at all. This one is a correctness problem, not just duplication: on045d7ecan ambientSOCKET_DRY_RUN=trueturns 18 of the 19 unscrubbedrepair_vendor_e2etests red while every scrubbed test in the same target is unaffected (details in Spawn every CLI test child through one hermetic Command builder; 10 test files inherit ambient SOCKET_* today #823). - xorshift64* is written four times in core (
test_rng.rs,oracle_support.rs,npm_crawler/oracle.rs,patch/copy_tree.rs);test_rngis the intended shared one. - The VEX e2e helpers are split across
vex_e2e_common,vex_pdm_hatch_common,vex_pipenv_pip_common,vex_pypi_real_commonandcommon/yarn_classic_vex.rs.
Target design
One test-support surface: tests/common for the CLI (it already reaches every target), which can later become a socket-patch-test-support dev crate if core and CLI tests need to share it. It owns the hermetic Command builder, binary(), git_sha256 (delegating to core), the envelope parsers and the seeded RNG. Each child deletes the copies it replaces, and none touches production code.
Children (in order)
- Spawn every CLI test child through one hermetic Command builder; 10 test files inherit ambient SOCKET_* today #823 Spawn every CLI test child through one hermetic
Commandbuilder; delete the 15scrub_socket_envcopies and cover the 10 unscrubbed files. - Replace the 103 private
binary()withcommon::binary(mechanical;e2e_redirect_pnpm_build.rskeeps its env override as a named helper). - Replace the 86 private
git_sha256withcommon::git_sha256, built oncompute_git_sha256_from_bytes. - Route core's three private xorshift copies through
test_rng. - Merge the VEX e2e helper modules.
Only the first child is filed; the rest are mechanical and can be filed as the first lands.
Acceptance criteria
- Each child lands as its own PR, with all tests green.
- At the end,
grep -rn "fn binary()\|fn git_sha256\|fn scrub_socket_env" crates/socket-patch-cli/testsmatches onlytests/common.
Dependencies
Unblocked. C31 (fewer test executables) and #793 (RunCtx, removing #[serial]) are easier after it.
Activity
audit-core: C28 rejected, C30 decomposed (#824, #823), C47 test herme…
mikolalysenko commentedon Oct 5, 2026
[agent] Triaged:
priority:p3(tracking issue for a test-only refactor). Not a duplicate; first child is #823.Generated by Claude Code
mikolalysenko commentedon Oct 8, 2026
[agent] Claiming this issue for the architecture refactor routine (highest leverage: children 2–3 collapse about 100 per-file copies of
binary()andgit_sha256ontotests/common, and every other ranked candidate overlaps an open PR). Branch: arch-refactor/824-shared-test-helpers. Claim-ID: 2026-10-08T09:56:12Z-ef7154Slice: children 2 and 3 together (they edit the same files), limited to the test files no open PR changes. #823 (the scrub copies) is left alone, because its guard file
spawn_env_hygiene.rsis changed by #1049.Generated by Claude Code
mikolalysenko commentedon Oct 8, 2026
[agent] Draft PR: #1124.
Generated by Claude Code
Use common's binary() and git_sha256 in tests
mikolalysenko commentedon Oct 9, 2026
[agent] Claiming this issue for the architecture refactor routine (highest leverage: children 2–3 slice 2 collapses about 60 more per-file copies of
binary()andgit_sha256ontotests/common; every higher-ranked production candidate overlaps an open PR). Branch: arch-refactor/824-shared-test-helpers-2. Claim-ID: 2026-10-09T09:56:03Z-7243dfSlice: the 40 standalone and directory test files on
PENDING_PRIVATE_HELPERSthat no open PR changes. The four shared modules (vendor_ecosystem_fixtures,vex_e2e_common,vlt_hosted_common,vlt_vendor_common) and the 27 files changed by open PRs stay listed.Generated by Claude Code
mikolalysenko commentedon Oct 9, 2026
[agent] Draft PR: #1258 (children 2–3, slice 2: 40 files, 31
binary()and 25git_sha256copies). Remaining after it: the 27 files changed by open PRs and the 4 shared modules (vendor_ecosystem_fixtures,vex_e2e_common,vlt_hosted_common,vlt_vendor_common), plus children 1, 4 and 5.Generated by Claude Code
mikolalysenko commentedon Oct 9, 2026
[agent] Claiming this issue for the architecture refactor routine (highest leverage: the only free slice left. Children 2–3 slice 3 collapses about 8 more per-file copies of
binary()andgit_sha256ontotests/common, and every higher-ranked production candidate overlaps one of the 81 open PRs). Branch: arch-refactor/824-shared-test-helpers-3. Claim-ID: 2026-10-09T18:56:49Z-4c9e1aSlice: the five files on
PENDING_PRIVATE_HELPERSthat no open PR changes:e2e_vex_redirect.rs,get/global_packages_e2e.rs,mode_migration_npm.rs,scan_rollout_e2e.rsandvendor_ecosystem_fixtures/mod.rs(its two includers also takemod common).vex_e2e_common,vlt_*_commonand the files that open PRs change stay listed.Generated by Claude Code
mikolalysenko commentedon Oct 9, 2026
[agent] Draft PR: #1366 (children 2–3, slice 3: 5 files). Remaining after it: the files changed by open PRs, the shared modules
vex_e2e_common,vlt_e2e_common,vlt_hosted_commonandvlt_vendor_common(not every includer declaresmod common), and children 1, 4 and 5.Generated by Claude Code
refactor: record PR #1366 (#824 slice 3)
mikolalysenko commentedon Oct 11, 2026
[agent] Taking over the stale claim on this issue (the last slice, #1366, merged 2026-10-09 and no PR has followed). Claiming slice 4: move the 17 test files in
PENDING_PRIVATE_HELPERSthat no open PR touches ontocommon::binary/common::git_sha256. Files changed by open PRs (#1398's scan/ and repair/ files) and the four shared*_commonmodules stay pending. Branch: agent/fix-ci-test-helper-copies. Claim-ID: 2026-10-11T21:50:54Z-78c337Generated by Claude Code
mikolalysenko commentedon Oct 11, 2026
[agent] Draft PR: #1402 (slice 4: 17 files). Still pending after it: the four scan/ and repair/ files that #1398 changes, and the shared modules
vex_e2e_common,vlt_e2e_common,vlt_hosted_commonandvlt_vendor_common.Generated by Claude Code
Drop duplicate cache_env module in two tests
mikolalysenko commentedon Oct 12, 2026
[agent] Claiming slice 5 of this issue (CI/test-infra lane). #1398 merged, so the four
repair/andscan/files it held (repair/covgap_commands_repair.rs,repair/covgap_commands_repair_vendor.rs,repair/repair_invariants.rs,scan/covgap_commands_fetch_stage.rs) are free; they move ontocommon::binary/common::git_sha256. The four shared*_commonmodules stay pending. Branch: agent/fix-ci-test-helper-copies-5. Claim-ID: 2026-10-12T01:51:17Z-2e9d22Generated by Claude Code
mikolalysenko commentedon Oct 12, 2026
[agent] Draft PR: #1410 (slice 5: the four repair/ and scan/ files). Still pending after it: the shared modules
vex_e2e_common,vlt_e2e_common,vlt_hosted_commonandvlt_vendor_common.Generated by Claude Code
Share test helpers in repair and scan tests
Tidy comments and imports after helper move
mikolalysenko commentedon Oct 12, 2026
[agent] Claiming slice 6, the last one (CI/test-infra lane; slice 5 merged in #1410): move the four shared modules on
PENDING_PRIVATE_HELPERS(vex_e2e_common,vlt_e2e_common,vlt_hosted_common,vlt_vendor_common) onto one sharedbinary()/git_sha256and drop the pending list. Branch: agent/fix-ci-test-helper-copies-6. Claim-ID: 2026-10-12T16:51:23Z-4c1266Generated by Claude Code
mikolalysenko commentedon Oct 12, 2026
[agent] Draft PR: #1439 (slice 6: the four shared
*_commonmodules; deletesPENDING_PRIVATE_HELPERS).Generated by Claude Code
Share binary/git_sha256 in the last test modules