Repository navigation
Share one copy_tree across the test suites - #1988
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Twenty-eight suites and shared test modules each carried their own recursive directory copier. They now use common::copy_tree, from the new tests/common/fs_tree.rs; modules whose includers don't load common pull that file in by #[path], as with oracle.rs. The two missing-source copies (vex_e2e_common/uv.rs, in_process_redirect_pdm) become an is_dir() guard at each call site. The shared copy follows symlinks to directories, as yarn_berry_common's did; every other copy panicked there, so no passing test changes. Assisted-by: Claude Code:claude-opus-5-5
e2e_cargo, e2e_composer, e2e_maven and e2e_nuget each defined a byte-identical start_proxy and assert_proxy_served_scans. Both now live in tests/common/scan_proxy.rs. Assisted-by: Claude Code:claude-opus-5-5
27 of the 28 replaced copiers checked entry.file_type(), which does not follow symlinks; only yarn_berry_common followed them. Following them lets a link cycle in an installed tree recurse until the stack overflows. The shared copy now checks file_type() like the majority. yarn_berry_common copies .socket and the yarn zip cache, which hold no directory links. The module doc no longer claims a re-export. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ef8e862. Configure here.
Assisted-by: Claude Code:claude-opus-5-5
|
Burn-down agent: labeled Ready for review.
Generated by Claude Code |
Final review briefWhat it does: Test-only refactor. It replaces 28 hand-written recursive directory copiers in Risk: low. Only test code changes. The one behaviour change is deliberate: Look here:
Verified:
Changes I made: none. Open questions: none. Auto-merge is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Reviewed ef8e862bf6baa77229d630a795f9b24b2cdbd166. Checked shared fixture copy semantics, optional-source guards, imports and proxy-helper consolidation across migrated suites. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.
LLM Description written by Claude Code:claude-opus-5-5
Refs #1979 (T64, slice 1). Living document: Part 5, tests.
Why
crates/socket-patch-cli/testscarried ~38 hand-written recursive directory copiers and no shared one. The four hermeticscansuites also each defined a byte-identical mock public proxy. This PR adds one shared copy of each and deletes the duplicates in the files no open PR holds.Changes (test-only)
tests/common/fs_tree.rsholdscopy_tree, reached ascommon::fs_tree::copy_tree. Modules whose includers don't loadcommonpull it in with#[path = "../common/fs_tree.rs"] mod fs_tree;, the same pattern asoracle.rs.e2e_redirect_{bun,cargo,pnpm,yarn_berry}_build,e2e_redirect_cargo_shapes;e2e_vendor_{bun,cargo,gem,pnpm,pypi,yarn_berry,yarn_classic}_build,e2e_vendor_yarn_classic_dev_flow;e2e_yarn4_{pnpm_linker,workspaces}_build;mode_migration_{bun,cargo,npm};e2e_nuget_dotnet_build,vendor_jvm_cli,in_process_redirect_pdm,e2e_vex_build/poetry;composer_e2e_common,maven_build_common,vlt_vendor_common,yarn_berry_common,prebuilt_common,vex_e2e_common/uv.composer_e2e_common::copy_dir_recursiveupdated, including one line indocker_e2e_vendor_composer.rs. That file is held by Share one docker test harness (#1968, first slice) #1972, andgit merge-treeshows no conflict.uv.rsandpdm) are replaced by anis_dir()guard at each of their 5 call sites. The shared helper stays strict, so a missing fixture still panics.tests/common/scan_proxy.rsholdsstart_proxyandassert_proxy_served_scans, moved verbatim frome2e_{cargo,composer,maven,nuget}. Those 4 copies are deleted.Not in this slice
These copies are left because open PRs hold their files, or because they are real variants:
e2e_vendored_production(Fix Go patch delivery, audits, and reinstalls #1698, Scrub color env in hermetic test children #1964);e2e_vendor_golang_build(Fix Go patch delivery, audits, and reinstalls #1698);e2e_bun_lockb(Fix bun.lockb nightly e2e reaching the live blob API #1905);e2e_redirect_gem_build(Fix hosted gem block mixing CRLF Gemfile endings (#1831) #1841);e2e_redirect_yarn_classic_build(Fix yarn classic copy identity read two ways (#1951) #1984);e2e_redirect_npm_build,e2e_vendor_npm_buildand thenpm_e2e_common/manifestlesscopy (Fix CRLF bin e2e failing under npm 11 on macOS #1896, Fix npm overrides to a URL treated as registry (#1965) #1966, Fix npm v2 revert half-reverting the lock (#1937) #1938);docker_e2e_vendor_{maven,nuget}(Share one docker test harness (#1968, first slice) #1972).copy_treeinvex_pypi_real_commonandvex_pipenv_pip_real,vex_pipenv_pip_steps(which skips dangling links),golang_e2e_matrix(which makes copies writable),e2e_gradle_agent_build(walkdir), ande2e_embedded_vex(one level only).hosted_pin_count, which overlaps e2e_hosted_production and e2e_vendored_production are a near-fork: 11 identical helpers, a copied PURL/UUID catalog and hand-rolled VEX checkers beside vex_e2e_common #1983.Evidence
cargo check -p socket-patch-cli --tests --all-featuresis clean. The 3 warnings left (binary,find_eventunused) are in files this PR doesn't touch.cargo clippy --workspace --all-features -- -D warningsis clean.e2e_{cargo,composer,maven,nuget},e2e_redirect_cargo_build,e2e_redirect_cargo_shapes,e2e_redirect_yarn_berry_build,e2e_vendor_cargo_build,e2e_vendor_yarn_berry_build,e2e_yarn4_workspaces_build,in_process_redirect_pdm,mode_migration_{bun,cargo,npm}andvendor_jvm_cli.copy_treewas changed to skip files,mode_migration_cargofailed 5 tests.e2e_cargostayed green.assert_proxy_served_scanscounts every request, 404s included. The code moved verbatim, so this PR doesn't change that; I'll note it for the audit./code-review highIt raised 7 findings.
path().is_dir()), so a link cycle could recurse forever. It now usesfile_type(), as 27 of the 28 copies did.shared_helper_copiesguard forcopy_treeyet: it would fail on the held copies. Add it in the slice that removes them.duplicate_modoncommon/mod.rs's new submodules only fires underclippy --tests, which CI doesn't run. It comes fromvlt_e2e_commonre-including all ofcommon, which already duplicates every common submodule.copy_tree_if_presenthelper: keeping the helper strict keeps missing fixtures loud. The 5 guards are explicit where a hosted flow commits no.socket/.Behavior change
None. No assertions change. Only
yarn_berry_common's copy followed directory symlinks, and its two uses (.socket, the yarn zip cache) contain none.Risk
Low: test-only. No
cfg(windows)/cfg(unix)logic changed.e2e_vex_build's include iscfg(unix), the same as its only user,poetry.🤖 Generated with Claude Code
https://claude.ai/code/session_011f9aeP5DtGe4XN7J3Vprc7