GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Share one copy_tree across the test suites by mikolalysenko · Pull Request #1988 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Nov 2, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

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/tests carried ~38 hand-written recursive directory copiers and no shared one. The four hermetic scan suites 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)

  • New tests/common/fs_tree.rs holds copy_tree, reached as common::fs_tree::copy_tree. Modules whose includers don't load common pull it in with #[path = "../common/fs_tree.rs"] mod fs_tree;, the same pattern as oracle.rs.
  • 28 copies deleted:
    • redirect suites: e2e_redirect_{bun,cargo,pnpm,yarn_berry}_build, e2e_redirect_cargo_shapes;
    • vendor suites: e2e_vendor_{bun,cargo,gem,pnpm,pypi,yarn_berry,yarn_classic}_build, e2e_vendor_yarn_classic_dev_flow;
    • yarn4 suites: e2e_yarn4_{pnpm_linker,workspaces}_build;
    • mode migration: mode_migration_{bun,cargo,npm};
    • others: e2e_nuget_dotnet_build, vendor_jvm_cli, in_process_redirect_pdm, e2e_vex_build/poetry;
    • shared modules: composer_e2e_common, maven_build_common, vlt_vendor_common, yarn_berry_common, prebuilt_common, vex_e2e_common/uv.
  • Callers of composer_e2e_common::copy_dir_recursive updated, including one line in docker_e2e_vendor_composer.rs. That file is held by Share one docker test harness (#1968, first slice) #1972, and git merge-tree shows no conflict.
  • Missing-source handling. The two copies that silently skipped a missing source (uv.rs and pdm) are replaced by an is_dir() guard at each of their 5 call sites. The shared helper stays strict, so a missing fixture still panics.
  • New tests/common/scan_proxy.rs holds start_proxy and assert_proxy_served_scans, moved verbatim from e2e_{cargo,composer,maven,nuget}. Those 4 copies are deleted.
  • Diff: +218 / −589 across 39 files, all of them test files.

Not in this slice

These copies are left because open PRs hold their files, or because they are real variants:

  • copies in held files:
    • 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_build and the npm_e2e_common/manifestless copy (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).
  • real variants: the skip-list copy_tree in vex_pypi_real_common and vex_pipenv_pip_real, vex_pipenv_pip_steps (which skips dangling links), golang_e2e_matrix (which makes copies writable), e2e_gradle_agent_build (walkdir), and e2e_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

  • CI is green on all 82 checks, and Bugbot found no issues.
  • cargo check -p socket-patch-cli --tests --all-features is clean. The 3 warnings left (binary, find_event unused) are in files this PR doesn't touch.
  • cargo clippy --workspace --all-features -- -D warnings is clean.
  • 16 suites were run and pass (444 tests): 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} and vendor_jvm_cli.
  • Red→green: when the shared copy_tree was changed to skip files, mode_migration_cargo failed 5 tests.
  • Pre-existing gap: when the proxy mount path was changed to the wrong one, e2e_cargo stayed green. assert_proxy_served_scans counts every request, 404s included. The code moved verbatim, so this PR doesn't change that; I'll note it for the audit.

/code-review high

It raised 7 findings.

  • Fixed:
    • The shared copy followed directory symlinks (path().is_dir()), so a link cycle could recurse forever. It now uses file_type(), as 27 of the 28 copies did.
    • The extra stat per entry goes away with that change.
    • The module doc claimed a re-export that doesn't exist.
  • Not fixed:
    • The consolidation is incomplete: those files are held by the open PRs listed above.
    • No shared_helper_copies guard for copy_tree yet: it would fail on the held copies. Add it in the slice that removes them.
    • duplicate_mod on common/mod.rs's new submodules only fires under clippy --tests, which CI doesn't run. It comes from vlt_e2e_common re-including all of common, which already duplicates every common submodule.
    • No copy_tree_if_present helper: 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 is cfg(unix), the same as its only user, poetry.

🤖 Generated with Claude Code

https://claude.ai/code/session_011f9aeP5DtGe4XN7J3Vprc7

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
Start T64: one shared copy_tree for test suites
c96eae0
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) added refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code arch-refactor PR opened by the scheduled architecture refactor routine labels Nov 2, 2026
Claude (claude) added 3 commits November 2, 2026 13:08
@claude
Share one copy_tree across the test suites
79aa884
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
@claude
Share the scan suites' mock public proxy
f81c50c
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
@claude
Keep copy_tree from following dir symlinks
ef8e862
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
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review November 2, 2026 13:27
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Nov 2, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Mikola Lysenko (mikolalysenko) pushed a commit that referenced this pull request Nov 2, 2026
@claude
refactor: T64 slice 1 in #1988
76434fd
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Nov 2, 2026
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

Burn-down agent: labeled Ready for review.

  • Head: ef8e862bf6baa77229d630a795f9b24b2cdbd166, no conflicts with main (cbbbdb9).
  • CI: all 82 check runs on the head are success/skipped (ci-ok green). No main-wide failures.
  • Bugbot: reviewed ef8e862, no findings.
  • Reviewer focus: test-only change. The shared tests/common/fs_tree.rs::copy_tree is strict (a missing source panics); the 5 call sites that used to skip a missing source now have explicit is_dir() guards.
  • Slack announcement not sent this run (Slack send unavailable); the next run will retry.

Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

Final review brief

What it does: Test-only refactor. It replaces 28 hand-written recursive directory copiers in crates/socket-patch-cli/tests with one shared common::fs_tree::copy_tree. It also moves the byte-identical mock public proxy of the 4 hermetic scan suites into common::scan_proxy. +218/−589 across 39 test files, and no production code changes.

Risk: low. Only test code changes. The one behaviour change is deliberate: yarn_berry_common::copy_dir used to follow directory symlinks and now panics on them, like the other 27 copiers. It only copies .socket and the yarn zip cache, which hold no directory links. The two copiers that skipped a missing source silently (uv.rs, pdm) now have an is_dir() guard at each call site.

Look here:

  • common/fs_tree.rs:14: the shared copier. It uses DirEntry::file_type(), which doesn't follow links, so a file symlink is copied as the file and a directory symlink panics.
  • common/scan_proxy.rs:9: the moved proxy and hermeticity guard.
  • yarn_berry_common/mod.rs:71: the only copier whose symlink semantics changed.
  • common/mod.rs:54: the new submodules.

Verified:

  • I read the full diff. None of the removed copiers recreated symlinks or skipped paths: the removed code has no read_link, is_symlink or skip-list.
  • CHANGELOG.md is untouched.
  • ci-ok and clippy are green on the head, and the PR reports 82/82 checks green. Bugbot found no issues. No review threads are unresolved.
  • I ran cargo clippy -p socket-patch-cli --all-targets -- -D warnings locally. It fails on the same 93 test targets as main (pre-existing needless_borrow/duplicate_mod lints that CI doesn't enforce on tests). The branch adds 2 more duplicate_mod hits in e2e_{hosted,vendored}_production, which load common twice. The PR introduces no compile errors.

Changes I made: none.

Open questions: none.

Auto-merge is armed, so approving sends this straight to the merge queue.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) enabled auto-merge November 2, 2026 15:53
Wenxin-Jiang
Wenxin Jiang (Wenxin-Jiang) approved these changes Nov 2, 2026
View reviewed changes

@Wenxin-Jiang Wenxin Jiang (Wenxin-Jiang) left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit b0b24e2 Nov 2, 2026
82 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the arch-refactor/1979-common-copy-tree branch November 2, 2026 17:25
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Nov 4, 2026
Copy test fixture trees through one tests/common::copy_tree: 38 recursive copiers, 20 identical #1979
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@Wenxin-Jiang Wenxin Jiang (Wenxin-Jiang) Wenxin-Jiang approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

arch-refactor PR opened by the scheduled architecture refactor routine Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mikolalysenko @Wenxin-Jiang @claude
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.