Repository navigation
Give the offline uv sandbox test a disposable cache - #1774
Conversation
Architecture-Review: unchanged; the test uses its own uv state while exercising the same sandbox boundary. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on aad7e0dc7a01d89c48f97fc0bfbb99ac418946f5, 41.1s: approve (0 critical, 0 important, 2 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| env=(("UV_CACHE_DIR", uv_cache), ("UV_PYTHON_INSTALL_DIR", uv_pythons)), | ||
| sandbox_ro=(str(Path(shutil.which("uv")).parent), uv_pythons), writable=(uv_cache,), | ||
| env=tuple(env.items()), | ||
| sandbox_ro=(str(Path(uv).parent), sys.base_prefix), |
There was a problem hiding this comment.
suggestion: Bound interpreter prefix is not resolved, but UV_PYTHON is
UV_PYTHON is set to Path(sys._base_executable).resolve(), but the sandbox read-only bind uses the unresolved sys.base_prefix. The two can point to different trees. One case is a uv-managed interpreter under ~/.local/share/uv/python, where newer uv versions use a minor-version symlink directory (cpython-3.12-… → cpython-3.12.N-…) as the venv home. bwrap --ro-bind-try would mount that content at the symlink path, while the resolved executable path points into the patch directory, and the sandbox does not expose that directory because /home is hidden. uv run would then fail to find the interpreter inside the sandbox. This is a host-dependent false failure, not a leak. The smallest fix is to derive both values from the same resolved path, for example py = Path(sys._base_executable).resolve() and then bind str(py.parent.parent), or bind str(Path(sys.base_prefix).resolve()).
| sandbox_ro=(str(Path(uv).parent), sys.base_prefix), | ||
| writable=(str(uv_cache),), | ||
| ) | ||
| report = sandbox.run_checks(cfg, git_repo) |
There was a problem hiding this comment.
suggestion: Cache isolation is not asserted by the test
The acceptance criteria say the inherited cache and sentinel stay unchanged. That was only checked by hand. In the test, isolation follows from overriding UV_CACHE_DIR and HOME and from the private sandbox home, but nothing guards against a regression. An example would be a future refactor that drops env=lock_env, which would let uv lock write to the builder's cache again. A cheap guard: monkeypatch the inherited UV_CACHE_DIR and XDG_CACHE_HOME to an empty sentinel directory under tmp_path, then assert it is still empty after uv lock and run_checks. Also assert that uv_cache is non-empty, to show the disposable cache was actually used.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Give the offline uv sandbox test a disposable cache
Context and goal
Closes #1268
Acceptance
Notes
This replaces the offline uv portion of #1338. Main already contains the isolated candidate Git fixture. The baseline test passed but wrote metadata beside a synthetic cache sentinel. The updated test passed in real Bubblewrap and left both the sentinel cache and empty Python download directory unchanged.
Base
main @ 3d70c5a
Base: 3d70c5a
Validation
Recorded for
aad7e0dc7a01uv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 0Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review