"""Client deadlines must accommodate receive scanning without claiming timeout refusal.""" import subprocess from pathlib import Path import sys sys.path.insert(0, str(Path(__file__).parent.parent / "scripts")) import repo_sync as module def test_push_budget_covers_admitted_scanner(monkeypatch, tmp_path): observed = {} def run(argv, **kwargs): observed.update(argv=argv, **kwargs) return subprocess.CompletedProcess(argv, 0, "", "") monkeypatch.setattr(module.subprocess, "run", run) ok, _ = module.push_ff(tmp_path) assert ok assert 90 < observed["timeout"] <= 180 assert "--force" not in observed["argv"] def test_timeout_is_unverified_without_retry_or_child_output(monkeypatch, tmp_path): calls = [] def run(argv, **kwargs): calls.append(argv) raise subprocess.TimeoutExpired(argv, kwargs["timeout"], output="private diagnostic fixture") monkeypatch.setattr(module.subprocess, "run", run) ok, message = module.push_ff(tmp_path) assert not ok assert "remote outcome unverified" in message assert "inspect the remote ref" in message assert "private diagnostic fixture" not in message assert len(calls) == 1