Skip to content

Fix the Windows venv layout of a scan discovery test (#2149) - #2176

Merged
Mikola Lysenko (mikolalysenko) merged 3 commits into
mainfrom
agent/fix-scan-discovery-venv-test-windows-layout
Nov 20, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 3 commits into
mainfrom
agent/fix-scan-discovery-venv-test-windows-layout

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-fable-5-2

Fixes #2149

Summary

Two scan tests staged a Unix venv (lib/python3.x/site-packages) on
every platform. On Windows the Python crawler reads a venv's packages
from Lib/site-packages, so the staged package was invisible there.
Both tests now stage the layout the crawler reads on the platform they
run on. Test-only: 2 files, no product code, no test skipped or loosened.

Test Effect of the Unix layout on Windows
scan_project_discovery_e2e::agent_scan_names_a_python_project_below_with_its_own_venv fails on every Windows run: "no projects_not_scanned warning" (#2149)
in_process_scan::scan_ignores_ambient_virtual_env passes vacuously: the decoy venv holds nothing the crawler can find, so the guard for the VIRTUAL_ENV scrub cannot fail

Root cause

The product code is platform-aware (find_site_packages_under in
python_crawler.rs reads <venv>/Lib/site-packages on Windows). The
fixtures were not. In the discovery test, svc therefore had no install
directory of its own, and the scan had nothing to name as not scanned.
The second test was found by the code review of this diff: same wrong
assumption, but it hid a missing guard instead of failing.

Evidence

  • Linux, local: cargo test -p socket-patch-cli --test scan scan_project_discovery
    10 passed; cargo test -p socket-patch-cli --test in_process_scan scan_ignores_ambient_virtual_env
    1 passed. The Unix path of both fixtures is unchanged.
  • Windows: the red side is the failure Windows: agent_scan_names_a_python_project_below_with_its_own_venv fails (test builds a Unix venv layout) #2149 records on main's
    scheduled runs. The green side is a workflow_dispatch CI run with
    os=windows on this branch (run 44711932605, head 9caa51b):
    agent_scan_names_a_python_project_below_with_its_own_venv ... ok in
    test (windows-latest, 2) and scan_ignores_ambient_virtual_env ... ok
    in test (windows-latest, 1). The scan test binary, which failed on
    main (237 passed; 1 failed), has no failure left.
  • rustfmt --check on both files is clean, and
    cargo clippy --locked -p socket-patch-cli --all-features -- -D warnings
    (CI's form) is clean.
  • /code-review high: no finding in the diff; its one pre-existing
    finding (the second test) is fixed here.

Notes

  • The two Windows shards of that dispatch run are still red, on tests
    that fail the same way in main's scheduled run of 2026-11-20 (head
    6579162) and that this PR does not touch:

    • gem_refresh::tests::an_unwind_names_no_rerun_for_a_shared_home
      (shard 1): the expected text joins paths with /, the product with
      the platform separator.
    • 10 tests of e2e_gem_native_ext_build (the Java gem cases) and 2 of
      get_update_summary_e2e (shard 2).
      They are not required checks; ci-ok and clippy are green. I found
      no open issue for them.
  • cargo clippy -p socket-patch-cli --all-targets --all-features -- -D warnings
    reports errors in test support modules on main too (for example
    "file is loaded as a module multiple times" under tests/common).
    None is in a file this PR touches, and CI's clippy job does not use
    --all-targets. Not changed here.

https://claude.ai/code/session_011f9aeRBdeH3QaHTL2ZTJ4H


Generated by Claude Code

Refs #2149.

Assisted-by: Claude Code:claude-fable-5-2
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
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
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review November 20, 2026 09:35
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

bugbot run


Generated by Claude Code

@cursor

cursor Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Test fixture path changes only; no runtime behavior modified.

Overview
Fixes Windows CI failures in two scan tests that staged Python venv packages under Unix-only paths (lib/python3.x/site-packages). The Python crawler already looks at Lib/site-packages on Windows, so those fixtures were invisible there.

Both scan_ignores_ambient_virtual_env and agent_scan_names_a_python_project_below_with_its_own_venv now pick site_packages with cfg!(windows) before creating .dist-info trees, matching what production discovery reads on each OS. Test-only; no product or assertion changes.

Reviewed by Cursor Bugbot for commit 9caa51b. Configure here.

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] test (windows-latest, 1) and test (windows-latest, 2) on this head come from the os=windows dispatch run I started to verify the fix (run 44711932605). They are red, but not on this PR's tests:

  • Fixed here and now passing on Windows: scan_project_discovery_e2e::agent_scan_names_a_python_project_below_with_its_own_venv (shard 2) and in_process_scan::scan_ignores_ambient_virtual_env (shard 1).
  • Still failing, and failing the same way in main's scheduled run of 2026-11-20 on 6579162 (run 44682782099): gem_refresh::tests::an_unwind_names_no_rerun_for_a_shared_home (shard 1; the expected text joins paths with /), 10 Java gem tests in e2e_gem_native_ext_build and 2 in get_update_summary_e2e (shard 2). This PR touches none of them, and I found no open issue for them.

ci-ok and clippy are green.


Generated by Claude Code

@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] PR shepherd: review brief for the approver

What it does. Two scan tests built a Unix venv (lib/python3.x/site-packages) on every platform. On Windows the crawler reads <venv>/Lib/site-packages, so one test failed (#2149) and the other passed without testing anything. Both now build the layout the crawler reads on the platform they run on. Test-only, 2 files, no product code.

Risk: low. Only test fixtures change, and the Unix path of each is byte-for-byte the same as before. Nothing ships to users.

Look here

Verified

Changes I made: none.

Open questions: none.


Generated by Claude Code

@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Nov 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 20, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] The merge queue dropped this PR on a network error, not on a test. In the queue's CI run (44758585595) the hosted-e2e job failed in its "Setup npm-family package managers" step: the download of yarn@4.6.0 through corepack was cut off (TypeError: terminated from Node's fetch), before any code of this repository was built or run. ci-ok failed only because that job did, and the rest of the run was cancelled.

This PR changes two test fixtures and nothing that step uses. Its head is unchanged (9caa51b), it is approved and mergeable, and auto-merge was turned off by the dequeue. It needs to be put back in the merge queue; I have not re-armed auto-merge myself.


Generated by Claude Code

Merged via the queue into main with commit 1530c38 Nov 20, 2026
128 of 131 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-scan-discovery-venv-test-windows-layout branch November 20, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: agent_scan_names_a_python_project_below_with_its_own_venv fails (test builds a Unix venv layout)

3 participants