Repository navigation
Share more sandbox and Mergify candidate test assertions - #1900
Conversation
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on 9bcf2c6322c996de4f88533c51615cc4ffbeef7c, 61.6s: approve (0 critical, 0 important, 3 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.
| observed_transport = set() | ||
|
|
||
| def isolated_fetch(argv, **kwargs): | ||
| if environ.get("HTTPS_PROXY") == "http://proxy.invalid:8080" and "git" in argv: |
There was a problem hiding this comment.
suggestion: Transport-scope check depends on a hard-coded proxy value that only one test sets
The tree_candidate fixture checks fetch and plumbing environments only when environ["HTTPS_PROXY"] is exactly http://proxy.invalid:8080. It checks observed_transport at line 310 only under the same condition. The value is spelled out in three places, and only test_vanished_squash_parent_passes_real_tree_attestation sets it. If someone later changes or removes that setenv line, the auth-header and proxy-scope check is skipped without any failure. The removed standalone test failed loudly in that case. The logic is correct today for both main and trunk. Smallest fix: define a module constant such as PROXY = "http://proxy.invalid:8080". Then either let attest(..., check_transport=True) set it with monkeypatch, or have the vanished test also assert observed_transport == {"fetch", "plumbing"}, so the check can't vanish silently.
|
|
||
| monkeypatch.setattr(sandbox, "_run_one", run_stage) | ||
| report = sandbox.run_checks(cfg, git_repo, progress=events.append, status=status) | ||
| if early: |
There was a problem hiding this comment.
suggestion: Early-failure case adds branches and an early return to the parametrized heartbeat test
The early-failure parameter changes the command, overrides the FIRST_HEARTBEAT_DELAY=0.03 set by heartbeat_log back to 30.0 (the production default in src/loopzero/sandbox.py:34), skips the _run_one wrapper, swaps the status sink, and returns before every shared assertion. It shares no assertions with the other two cases. Merging it saves about 3 lines but leaves one test that runs two different scenarios through if early branches, which is harder to read and change. The assertions are kept and behave the same as before, so this doesn't block. If the 40-line budget allows, consider keeping the early-failure test separate and without heartbeat_log, as it was.
| assert receipt["head"] == git(git_repo, "rev-parse", "HEAD").strip() | ||
| [result] = receipt["results"] | ||
| assert result["reused_from"] == original.head | ||
| assert original.ok and result["reused_from"] == original.head |
There was a problem hiding this comment.
suggestion: original.ok is now asserted after its saved report has been reused
Moving assert original.ok into the later reused_from assertion means a failed first run is caught only after _save_report and a second run_checks call. Coverage is the same, but the failure message is harder to read: the error points at the reuse line instead of the original pass. This saves only one line. Consider keeping the check right after the first run, or using the cache_check fixture, which already asserts report.ok.
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on 532acded2377595b0e6b350c4a6a52f780b448b9, 13.1s: approve (0 critical, 0 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.
| with pytest.raises(CandidateError, match="Git object/size bound exceeded"): | ||
| git("test-command") | ||
| else: | ||
| bound = pytest.raises(CandidateError, match="Git object/size bound exceeded") |
There was a problem hiding this comment.
suggestion: Build the pytest.raises context only when it is used
bound = pytest.raises(...) is created on every run, but it is only entered when outcome == "bound". In the other cases an unused RaisesContext is built and thrown away. The test still behaves the same, but whoever reads it next has to check that. You could build it inline instead: with (pytest.raises(CandidateError, match=...) if outcome == "bound" else nullcontext()):. That matches the error line above it and keeps the line count.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Share more sandbox and Mergify candidate test assertions
Acceptance
Notes
Coverage.py 7.17.5 recorded the two focused modules independently with branch tracing, subprocess tracing and relative paths. Comparing the combined raw sets across identical source at a472c8f gave 2,081 lines, 4,617 arcs and zero differences across 15 loopzero modules. Both focused suites passed and the nine optional IntelFlo parity cases kept their existing opt-in skip.
Base
main @ f106753
Validation
Recorded for
532acded2377uv 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.Assertion audit
I listed the distinct assertions in each changed or combined test and checked their surviving locations independently of coverage.
Review