Skip to content

Share more sandbox and Mergify candidate test assertions - #1900

Merged
mergify[bot] merged 3 commits into
mainfrom
lean178/575-dedupe-sandbox-candidate-v2
Nov 26, 2026
Merged

mergify[bot] merged 3 commits into
mainfrom
lean178/575-dedupe-sandbox-candidate-v2

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Share more sandbox and Mergify candidate test assertions

Acceptance

  • Keep identity, bounded execution, isolation, retry and diagnostic proofs, including all opt-in IntelFlo parity cases.
  • Remove at least 40 net test lines with zero source changes.
  • Compare executed source lines and arcs before and after, then pass one full slotted check.

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 532acded2377

  • 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.

Assertion audit

I listed the distinct assertions in each changed or combined test and checked their surviving locations independently of coverage.

  • The bwrap argument test retains private path and environment checks, exact shell arguments, memory capped by the host, and file limits converted to bytes. Both default and constrained cases run.
  • The real write-isolation test still rejects writes to the checkout and Git metadata, verifies both denied files stay absent, and asserts two successful commands in the permitted sandbox.
  • The stage-reporting tests are kept unchanged from main after Redact forwarded credentials from check diagnostics #1745 added credential redaction assertions. Probe and dirty-input timeout tests retain their exact diagnostic, error suppression and dirty-check success assertions.
  • Receipt tests still check the original pass, reuse identity, preserved shard marker and bounded tail, the original input key and head, and fresh execution after changing the runner target or executable bytes.
  • The successful candidate tree test retains the approved source scope, observed fetch and plumbing, proxy scope and exact decoded auth header. The forged-event cases still reject against an unmodified server snapshot, and the non-race tests retain no backoff or retry, typed errors and exact source reread counts.
  • The candidate rebuild and Git process tests still assert their separate success, retry budget, error-bound, wait and kill outcomes. Every IntelFlo parity case and its opt-in fixture remain present.

Review

eowca and others added 2 commits November 26, 2026 14:12
Co-Authored-By: Codex <noreply@openai.com>
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 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.

Comment thread tests/test_candidate.py
observed_transport = set()

def isolated_fetch(argv, **kwargs):
if environ.get("HTTPS_PROXY") == "http://proxy.invalid:8080" and "git" in argv:

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: 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.

Comment thread tests/test_sandbox.py Outdated

monkeypatch.setattr(sandbox, "_run_one", run_stage)
report = sandbox.run_checks(cfg, git_repo, progress=events.append, status=status)
if early:

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: 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.

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

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: 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.

@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 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.

Comment thread tests/test_candidate.py
with pytest.raises(CandidateError, match="Git object/size bound exceeded"):
git("test-command")
else:
bound = pytest.raises(CandidateError, match="Git object/size bound exceeded")

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: 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.

@eowca
eowca marked this pull request as ready for review November 26, 2026 14:14
@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 faf7ea6 at 14:22 UTC

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

So far

  • ✅ Entered the queue Thu 26 Nov, 14:15 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1929
  • ✅ Merged 14:22 · faf7ea6 · 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 faf7ea6 into main Nov 26, 2026
18 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/575-dedupe-sandbox-candidate-v2 branch November 26, 2026 14:23
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.

1 participant