fix(claude_hooks): skip binary downloads and bypass bazelisk in tests#684
Draft
agentydragon wants to merge 1 commit intodevelfrom
Draft
fix(claude_hooks): skip binary downloads and bypass bazelisk in tests#684agentydragon wants to merge 1 commit intodevelfrom
agentydragon wants to merge 1 commit intodevelfrom
Conversation
The e2e tests in test_session_start.py each run the full session_start
hook with an isolated XDG_CACHE_HOME. This caused every test to download
bazelisk (~30MB) and mkcert (~10MB) from GitHub, making the 5 e2e tests
exceed the 300s medium test timeout on slow connections.
Fix:
- Add ENV_INSTALL_MKCERT constant to settings.py (parallel to the
existing ENV_INSTALL_BAZELISK / ENV_INSTALL_NIX constants).
- Set INSTALL_BAZELISK=0, INSTALL_MKCERT=0, INSTALL_NIX=0 in
_setup_hook_env to skip all binary downloads in tests.
- With INSTALL_BAZELISK=0, the hook falls back to shutil.which("bazelisk")
as BAZELISK_PATH. When the inner bazel build runs, bazelisk reads
.bazelversion (7.6.0) and tries to download that version from GitHub
through the mock proxy, which rejects it → TimeoutError.
- Add _find_cached_bazel_binary() to locate a pre-downloaded Bazel binary
from bazelisk's download cache (XDG_CACHE_HOME/bazelisk/downloads/).
Set SYSTEM_BAZEL to that binary before isolating XDG_CACHE_HOME so the
hook writes it as BAZELISK_PATH; the wrapper then execs the real Bazel
binary directly, bypassing bazelisk version resolution entirely.
https://claude.ai/code/session_0126q6Mf9xdKsYR6NzAH6WgT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The e2e tests in test_session_start.py each run the full session_start hook with an isolated XDG_CACHE_HOME. This caused every test to download bazelisk (~30MB) and mkcert (~10MB) from GitHub, making the 5 e2e tests exceed the 300s medium test timeout on slow connections.
Fix:
https://claude.ai/code/session_0126q6Mf9xdKsYR6NzAH6WgT