Repository navigation
Bound Git subprocesses in architecture checks and source builds - #1697
Conversation
Architecture-Review: unchanged; Git commands retain their existing outputs and fail through the current check when Git times out. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on 121c081cd0ed1ec6c0eaaf35c0b6308c7c096909, 22.2s: request_changes (0 critical, 1 important, 1 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.
| return | ||
|
|
||
| tracked = subprocess.check_output(["git", "ls-files", "-z"], cwd=root) | ||
| tracked = subprocess.check_output(["git", "ls-files", "-z"], cwd=root, timeout=60) |
There was a problem hiding this comment.
suggestion: Duplicated 60 s literal instead of a named budget
The task asks for the existing 60-second Git budget (GIT_TIMEOUT in src/loopzero/cli.py:34 and src/loopzero/sandbox.py:29). These standalone entry points can't reasonably import loopzero, so copying the value is understandable. However, hatch_build.py:16 and scripts/check_architecture_docs.py:27 each use a bare 60. A module-level GIT_TIMEOUT = 60 in each file would make the shared budget easy to find, and tests could patch it (see the testing finding).
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on 90054edc59aa2a9cdd15c8f0d9603d569c2da931, 19.3s: 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.
|
|
||
| @pytest.mark.parametrize("entry", ["architecture", "sdist"]) | ||
| def test_direct_git_timeout(tmp_path, monkeypatch, capsys, entry): | ||
| def stalled_git(argv, *, timeout, **kwargs): |
There was a problem hiding this comment.
suggestion: Test replaces subprocess.run, so it never runs a stalled Git shim
The acceptance criteria ask for "a stalled local Git shim" that triggers the timeout. This test instead monkeypatches subprocess.run to raise TimeoutExpired right away. It does check that timeout=60 reaches subprocess.run, including through check_output in hatch_build.py:16, and that main() and the hook surface the timeout on their error paths. It never runs a real process, though, so it would not catch a Git call that skips subprocess.run (for example Popen or os.system) or a timeout that fails to kill the child. Smallest fix: keep the mock-based assertions and add one case that puts a git script running sleep first on PATH, then patches the 60-second constant or wraps subprocess.run to pass a short timeout. If the mock is the intended level of coverage, reword the acceptance item to match.
| assert run(git_repo, "not-a-revision").returncode == 1 | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("entry", ["architecture", "sdist"]) |
There was a problem hiding this comment.
suggestion: One parametrized test covers two unrelated entry points through an if/else
Each entry value runs a completely different body, and the sdist hook test sits in the architecture-docs test module. Two plain test functions, test_architecture_git_timeout and test_sdist_hook_git_timeout, would be easier to read and would make failures clearer. They could share the stalled_git fake as a fixture. This is only a structural cleanup.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Bound Git subprocesses in architecture checks and source builds
Context and goal
Closes #1664
Acceptance
Base
main @ bf1002c
Validation
Recorded for
14d51707c4f7uv 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 0Review
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.