GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — Fix uv project with no env falling back to system Python (#964) by mikolalysenko · Pull Request #965 · SocketDev/socket-patch Conversation
|
| Issue cell | Test | Without fix | With fix |
|---|---|---|---|
#964 uv.lock alone / pyproject.toml + uv.lock / unsynced UV_PROJECT_ENVIRONMENT / tool.py + tool.py.lock |
crawler_python_e2e::get_site_packages_paths_uv_without_env_never_falls_back_to_global |
❌ global path returned | ✅ |
| #964 scan in agent / vendored / hosted mode for the same 3 shapes never queries a system-only package | in_process_python_envs::uv_fresh_checkout_never_scans_the_system_python |
❌ [email protected] reached the batch query |
✅ |
Guard stays narrow: uv.lock + poetry.lock keeps the fallback |
crawler_python_e2e::get_site_packages_paths_uv_lock_beside_poetry_keeps_fallback |
✅ | ✅ |
cargo clippy --workspace --all-features -- -D warnings ✅ (re-run on 1822d82)crawler_python_e2e (62) and in_process_python_envs (20) ✅ (re-run on 1822d82)cargo test -p socket-patch-core --all-features: all pass except 4 lib tests that inject failures with chmod (copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry::wire_write_failure_…, pypi_requirements::wire_failure_rolls_back_…). They can't fail as uid 0, which is how this container runs, and they pass in CI.in_process_python_envs, e2e_pypi, hosted_superseding_pypi, mode_migration_pypi ✅. covgap_commands_vendor: 3 tests that inject state-write failures fail for the same root reason.e2e_vendor_pypi_build -- --include-ignored (uv 0.11.32): 35/35 ✅e2e_redirect_uv_build -- --ignored: 5 ✅. 4 fail because the test binary can't reach https://pypi.org/pypi/six/1.16.0/json through this sandbox's TLS proxy during the upstream restore step, which this diff doesn't touch. CI runs these with real network.cargo test --workspace can't link within this session's disk allowance, so CI is the full-suite gate.🤖 Generated with Claude Code
https://claude.ai/code/session_012H7zqyRTeMzzAxit6xfV6r
Note
Medium Risk
Changes which Python installs are considered in project-scoped crawls; misclassification could skip real envs or still leak globals, but the guard is narrow and heavily tested.
Overview
Fixes #964: project-scoped scans no longer treat the OS Python as part of a uv-managed tree when uv has not synced an env yet.
PythonCrawler::get_site_packages_paths used to fall back to global site-packages whenever the cwd looked like a Python project but had no local venv—so a fresh uv.lock checkout (or a PEP 723 *.py.lock script dir) could pull conda/system packages into vendored/agent scans and fail on unrelated patched wheels. The crawler now returns no env paths when uv_owns_project_env is true (uv.lock not shared with Poetry/PDM/Pipenv, or only *.py.lock markers), mirroring the existing Pipenv guard; lockfile-only deps still come from the lock.
claimed_by_non_uv_manager was extracted so UV_PROJECT_ENVIRONMENT handling and the new guard share the same “another manager owns this repo” logic; uv.lock + poetry.lock still keeps the global fallback for Poetry-on-system-interpreter setups.
Tests were flipped/added: e2e asserts empty site-packages (and no global anaconda decoy) for uv/script shapes; CLI asserts system-decoy never hits the batch API across agent/vendored/hosted modes.
Reviewed by Cursor Bugbot for commit c47aa0d. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
A fresh uv checkout (uv.lock with no .venv synced yet, or a UV_PROJECT_ENVIRONMENT that doesn't exist yet) and a directory holding only PEP 723 script locks fell back to the global site-packages. Every OS-Python package then joined the candidate set, so a vendored scan tried to vendor packages the project never depends on and exited 1 with pypi_uv_lock_package_missing. uv only ever installs such a project into its own env, and the lock already supplies the lock-only packages, so the crawl now returns no env for it. A uv.lock shared with Poetry, PDM or Pipenv files keeps the old fallback. Fixes #964 Assisted-by: Claude Code:claude-opus-5-5
main's coverage job is red: the digest guard test from #865 requires production hashing to go through the utils::digest helpers, and the Gradle code from #646 still hashes inline. This is the same change as #878, ported so this PR's CI can go green; it no-ops once #878 lands. Assisted-by: Claude Code:claude-opus-5-5
|
[agent] CI notes on the earlier heads:
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
661c117 ran `cargo fmt --all`, which reformatted 118 files the uv fix never changes. main isn't rustfmt-clean and CI doesn't check formatting, so the sweep adds nothing. It also hides the real change and conflicts with every other open PR that touches those files. Each reverted file is byte-identical to rustfmt's output on the merge-base version, so this drops formatting only. The six files that carry the fix and the ported #878 change keep their formatting. Co-Authored-By: Claude <[email protected]>
|
bugbot run Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[burn-down agent] Ready for review at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Conflict in crates/socket-patch-core/src/crawlers/python_crawler.rs: main (#950) added an is_pipenv_project guard and this branch added a uv_owns_project_env guard at the same spot in get_site_packages_paths. Kept both: the Pipenv guard first, then the uv guard, and merged the doc comment to name both. Co-Authored-By: Claude <[email protected]>
|
bugbot run Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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 c47aa0d. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Merging main brought in #955's PENDING_INLINE_DIGESTS entries for gradle_cache.rs, jvm_jar.rs and sidecars/maven.rs, but #690 had already moved those files onto the utils::digest helpers. The guard fails on stale entries, so coverage, test and test-release are red on main and on this PR. This is the same change as #1016, ported so this PR's CI can go green; it no-ops once #1016 lands. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012H7zqyRTeMzzAxit6xfV6r
|
[agent] The failure comes from Locally, The earlier #878 port (064b21d) now matches Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Vendored scan of a fresh uv checkout (uv.lock, no .venv yet) exits 1 on packages that exist only in the system Python, because the crawler falls back to the global site-packages (the uv side of #947)
There was an error while loading. Please reload this page.