Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
test(vm): let the log decide the Windows leg, not the exit status
Martin Vogel2f3399904453
diff --git a/scripts/test.sh b/scripts/test.shindex f9c832a63..992aea837 100755--- a/scripts/test.sh+++ b/scripts/test.sh@@ -278,6 +278,14 @@ bash "$ROOT/tests/test_language_count_contract.sh"echo "=== Step 0x: packaging version-metadata contract ==="bash "$ROOT/tests/test_version_metadata_contract.sh"+# Step 0y: the Windows leg must not decide its verdict from an exit status that+# the ssh/msys2_shell chain can mangle — a channel that turns 0 into 1 can turn+# 1 into 0, and that direction reports a RED Windows leg as green. Runs+# everywhere (it drives synthetic logs, no VM needed) because the guard it pins+# is what every Windows verdict rests on.+echo "=== Step 0y: VM leg verdict contract ==="+bash "$ROOT/tests/test_vm_verdict_contract.sh"+# Verify compiler supports target archverify_compiler "$CC"diff --git a/test-infrastructure/vm/vm-run-tests.sh b/test-infrastructure/vm/vm-run-tests.shindex 2bd76da4f..5e5760741 100644--- a/test-infrastructure/vm/vm-run-tests.sh+++ b/test-infrastructure/vm/vm-run-tests.sh@@ -45,6 +45,50 @@ case "${1:-}" in-h | --help) usage; exit 0 ;;esac+# The leg's verdict, as a function so the contract test can drive the REAL+# logic with synthetic logs instead of a copy of it that can drift+# (tests/test_vm_verdict_contract.sh). See the two-channel note at the call+# site for why the log outranks the exit status.+vm_verdict() {+ local log="$1"+ local rc="$2"+ if ! grep -Eq '[0-9]+ passed' "$log"; then+ echo "GUARD: test runner produced no completion summary — the suites did" \+ "not validly run; treating as failure (runner rc=$rc)" >&2+ return 90+ fi+ local failed_total+ local complete+ failed_total=$(grep -Eo '[0-9]+ failed' "$log" | grep -Eo '^[0-9]+' |+ awk '{s += $1} END {print s + 0}')+ complete=$(grep -c '=== All tests passed ===' "$log")+ if [ "${failed_total:-0}" -gt 0 ]; then+ echo "GUARD: the log reports $failed_total failed test(s) (runner rc=$rc)" >&2+ return 1+ fi+ if [ "$complete" -eq 0 ]; then+ echo "GUARD: the log has a summary but no completion marker — the leg" \+ "stopped before the end (runner rc=$rc)" >&2+ return 1+ fi+ if [ "${rc:-1}" -ne 0 ]; then+ echo "GUARD: every suite passed and the run completed, but the exit status" \+ "came back as $rc — the ssh/msys2_shell chain lost it. Reporting the" \+ "log's verdict; see the two-channel note in vm-run-tests.sh." >&2+ fi+ return 0+}++# Verdict-only mode for the contract test: decide a log WITHOUT a VM.+if [ "${1:-}" = "--verdict" ]; then+ if [ $# -ne 3 ]; then+ echo "usage: vm-run-tests.sh --verdict <log> <rc>" >&2+ exit 2+ fi+ vm_verdict "$2" "$3"+ exit $?+fi+RUNNER="${CBM_VM_RUNNER:-}"# Per-run identity. The VM holds ONE checkout (/c/cbm), so two concurrent runs@@ -172,4 +216,18 @@ if ! grep -Eq '[0-9]+ passed' "$LOG"; then"not validly run; treating as failure (runner rc=$rc)" >&2exit 90fi-exit "$rc"++# TWO independent channels decide this leg, because neither is trustworthy+# alone. The exit status travels ssh -> cmd.exe -> msys2_shell.cmd, and that+# chain loses it: on 2026-09-18 a leg that printed "7925 passed, 0 failed" and+# "=== All tests passed ===" still exited 1, while the identical work run+# through win.sh's other entry reported 0. A channel that can turn 0 into 1 can+# turn 1 into 0 — and THAT direction is a false green, a red Windows leg+# reported as passing, which is the failure this guard exists to prevent.+#+# So the LOG decides the test outcome (the runner writes it locally; it cannot+# be mangled in transit) and rc decides what the log cannot see. Green requires+# zero reported failures AND the completion marker that scripts/test.sh prints+# as its last statement — a leg that stopped early has a summary but no marker.+vm_verdict "$LOG" "$rc"+exit $?