Skip to content

Give the offline uv sandbox test a disposable cache - #1774

Merged
mergify[bot] merged 2 commits into
mainfrom
lean178/1268-offline-uv-cache-v2
Nov 26, 2026
Merged

mergify[bot] merged 2 commits into
mainfrom
lean178/1268-offline-uv-cache-v2

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Give the offline uv sandbox test a disposable cache

Context and goal

  • Goal: The offline uv sandbox test leaves the builder's cache untouched.
  • Problem: The test's lock setup and sandbox used the inherited uv cache.
  • Context: Both steps use a pytest-owned cache and the running suite's interpreter. The test still runs startup, venv and read-only checkout assertions inside Bubblewrap.

Closes #1268

Acceptance

  • Lock setup and the sandbox both use disposable cache state and run offline with the suite interpreter.
  • The real Bubblewrap test passes with a disposable home and empty Python download directory, leaving the inherited sentinel and cache contents unchanged.

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 aad7e0dc7a01

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

  • primary, claude, aad7e0d, approve

eowca and others added 2 commits November 26, 2026 10:38
Architecture-Review: unchanged; the test uses its own uv state while exercising the same sandbox boundary.
Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread tests/test_sandbox.py
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),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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()).

Comment thread tests/test_sandbox.py
sandbox_ro=(str(Path(uv).parent), sys.base_prefix),
writable=(str(uv_cache),),
)
report = sandbox.run_checks(cfg, git_repo)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@eowca
eowca marked this pull request as ready for review November 26, 2026 10:08
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as 78be6fc at 10:13 UTC

5 min in the queue, 3 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 10:08 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1794
  • ✅ Merged 10:13 · 78be6fc · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit 78be6fc into main Nov 26, 2026
18 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1268-offline-uv-cache-v2 branch November 26, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Give the offline uv sandbox test a disposable cache

1 participant