From c1ef58bf340b4389d7c599a88fb0871df74d43cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davor=20Raci=C4=87?= Date: Sat, 25 Jul 2026 09:49:33 +0200 Subject: [PATCH 1/2] test(win32): drop the redundant CR from the cmd launcher (#292 review) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Path.write_text` uses `newline=None`, so `\n` is already translated to CRLF on Windows — the explicit `\r` put `\r\r\n` on disk. `cmd` tolerates it for a one-line launcher, but it is a parse hazard the moment the helper grows labels or `goto`, and it is the same defect the per-OS script in the previous commit was written to avoid. --- tests/conftest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 274fc56e..cf6beb82 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -64,7 +64,9 @@ def write_script_launcher(directory: Path, name: str, body: str) -> Path: sidecar.write_text(body, encoding="utf-8") if sys.platform == "win32": launcher = directory / f"{name}.cmd" - launcher.write_text(f'@"{sys.executable}" "{sidecar}" %*\r\n', encoding="utf-8") + # `\n`, not `\r\n`: write_text translates it to the CRLF cmd wants, so an + # explicit `\r` would land on disk doubled (`\r\r\n`). + launcher.write_text(f'@"{sys.executable}" "{sidecar}" %*\n', encoding="utf-8") else: launcher = directory / name launcher.write_text( From 8d06aa5694f918b784976ca71c95ed03077a225b Mon Sep 17 00:00:00 2001 From: pbean Date: Sat, 25 Jul 2026 20:39:57 -0700 Subject: [PATCH 2/2] test(win32): use a portable no-op verify command (#292) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The env-fault escalation test wrote a POSIX check.sh into its VerifyPolicy tuple. Verify commands run shell=True, so on Windows cmd hands that path to ShellExecute: with no .sh association it pops the interactive file picker mid-run, and with one it launches the associated app and returns success. Neither is visible to the test — the fault it asserts comes from an injected SessionResult(env_fault=True) — so CI stayed green. The script was inert scaffolding: written once as `exit 0`, never mutated, referenced by no assertion. It is copy-paste residue from the sibling test_fix_phase_env_fault_escalates_instead_of_looping, which chmods it to 644 mid-run to produce rc=126 — there it is the point. Here the only verify signal is the marker command. So drop the file rather than branch on sys.platform for it, and use conftest's `_OK` for the second command: the host-shell stub block is the sanctioned single platform-detection spot, and no script file means no shell to mis-handle one. No behavior change on any platform — `exit 0` either way. --- tests/test_engine.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_engine.py b/tests/test_engine.py index 78703b72..f3b2ada5 100644 --- a/tests/test_engine.py +++ b/tests/test_engine.py @@ -11,6 +11,7 @@ import pytest from conftest import ( + _OK, _file_exists_cmd, _spec_baseline, committing_crash_state, @@ -4739,9 +4740,6 @@ def test_fix_phase_session_env_fault_escalates(project): burning the remaining dev budget on repair sessions that never ran.""" write_sprint(project, {"1-1-a": "ready-for-dev"}) marker = project.project / "fixed.marker" - script = project.project / "check.sh" - script.write_text("#!/bin/sh\nexit 0\n", encoding="utf-8") - script.chmod(0o755) def dev_with_marker(spec): marker.write_text("ok\n") @@ -4757,7 +4755,10 @@ def breaking_review(spec): policy = Policy( gates=GatesPolicy(mode="none"), notify=QUIET, - verify=VerifyPolicy(commands=(_file_exists_cmd(marker), f'"{script}"')), + # `_OK`, not a script file (#292): verify commands run through the host shell, + # and cmd hands a `.sh` path to ShellExecute instead of running it. Only the + # marker command carries signal here — the escalation is the session's. + verify=VerifyPolicy(commands=(_file_exists_cmd(marker), _OK)), limits=LimitsPolicy(max_dev_attempts=3), # budget left -> must not be spent ) engine, adapter = make_engine(