From 4b35787a65572eb513cf166c211c5fe94cd7c9f3 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 09:22:53 +0000 Subject: [PATCH 1/3] Start fix for Windows venv layout in scan test Refs #2149. Assisted-by: Claude Code:claude-fable-5-2 From 51a78f2e1974ef89138e8bdd10f0197f6c310578 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 09:31:24 +0000 Subject: [PATCH 2/3] Stage the platform's venv layout in a scan test agent_scan_names_a_python_project_below_with_its_own_venv staged a Unix venv (.venv/lib/python3.12/site-packages) on every platform. On Windows the Python crawler reads a venv's packages from Lib/site-packages, so the staged project had no install directory of its own, the scan named no project as not scanned, and the test failed on every Windows run. Stage the layout the crawler reads on the platform the test runs on. Fixes #2149. Assisted-by: Claude Code:claude-fable-5-2 --- .../tests/scan/scan_project_discovery_e2e.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/socket-patch-cli/tests/scan/scan_project_discovery_e2e.rs b/crates/socket-patch-cli/tests/scan/scan_project_discovery_e2e.rs index 064c6fa10..6a1277a7e 100644 --- a/crates/socket-patch-cli/tests/scan/scan_project_discovery_e2e.rs +++ b/crates/socket-patch-cli/tests/scan/scan_project_discovery_e2e.rs @@ -478,7 +478,14 @@ async fn agent_scan_names_a_python_project_below_with_its_own_venv() { std::fs::create_dir_all(root.join(".git")).unwrap(); std::fs::write(root.join(".gitignore"), ".venv/\n").unwrap(); let svc = root.join("svc"); - let dist = svc.join(".venv/lib/python3.12/site-packages/six-1.16.0.dist-info"); + // The venv layout the Python crawler reads on this platform: Windows + // has no per-version directory. + let site_packages = if cfg!(windows) { + svc.join(".venv").join("Lib").join("site-packages") + } else { + svc.join(".venv/lib/python3.12/site-packages") + }; + let dist = site_packages.join("six-1.16.0.dist-info"); std::fs::create_dir_all(&dist).unwrap(); std::fs::write(svc.join(".venv/pyvenv.cfg"), "version = 3.12.0\n").unwrap(); std::fs::write( From 9caa51bad3ff8d373ceafe5ec522b34e28602b97 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 09:34:45 +0000 Subject: [PATCH 3/3] Stage a Windows decoy venv in the scrub guard scan_ignores_ambient_virtual_env planted its decoy venv with the Unix layout on every platform. On Windows the Python crawler reads Lib/site-packages, so the decoy package was invisible whether or not VIRTUAL_ENV was scrubbed, and the guard could not fail there. Stage the layout the crawler reads on the platform, as the scan discovery test now does. Refs #2149. Assisted-by: Claude Code:claude-fable-5-2 --- crates/socket-patch-cli/tests/in_process_scan.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/socket-patch-cli/tests/in_process_scan.rs b/crates/socket-patch-cli/tests/in_process_scan.rs index 4e83ffba4..5afca9e02 100644 --- a/crates/socket-patch-cli/tests/in_process_scan.rs +++ b/crates/socket-patch-cli/tests/in_process_scan.rs @@ -1457,9 +1457,14 @@ async fn scan_ignores_ambient_virtual_env() { mock_batch_empty(&server).await; let decoy = tempfile::tempdir().unwrap(); - let dist_info = decoy - .path() - .join("lib/python3.11/site-packages/decoy_pkg-9.9.9.dist-info"); + // The venv layout the Python crawler reads on this platform (Windows + // has no per-version directory), so the decoy is one it would find. + let site_packages = if cfg!(windows) { + decoy.path().join("Lib").join("site-packages") + } else { + decoy.path().join("lib/python3.11/site-packages") + }; + let dist_info = site_packages.join("decoy_pkg-9.9.9.dist-info"); std::fs::create_dir_all(&dist_info).unwrap(); std::fs::write( dist_info.join("METADATA"),