mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 10:48:20 +00:00
The native Windows soak could never start its server, so that gate had never actually measured anything. The root cause was the harness, not the daemon: an MSYS filesystem FIFO feeding a native Windows process delivers empty stdin (reproduced 5/5), while a Bash anonymous coprocess carries the full JSON-RPC initialize exchange to the same protected payload, and the failing daemon log showed an orderly client disconnect rather than a daemon-side eviction. The soak now uses a named coprocess on native Windows only, duplicating its endpoints to stable fd3/fd4 and closing the originals so closing fd3 still delivers EOF; POSIX keeps the FIFO path. The coproc syntax sits inside eval because macOS system Bash 3.2 must still parse this file even though only MSYS2 Bash 5 executes that branch. With transport repaired the next exact failure surfaced: native Windows Python cannot open an MSYS /c/... diagnostics path. Both consumers now pipe the file through stdin, the pattern already established elsewhere in the repo, and the soak recovery contract forbids reintroducing a direct native-Python open. Also on the release path: - The smoke fixture server no longer fsyncs before atomically publishing its port. This is ephemeral readiness signalling, not crash-durable state, and the macOS Intel runner failed inside that durability sync. When the contract does fail it now reports the observable state -- waited, exit status, port file, staged temp files, interpreter, startup log -- because the previous verdict named nothing on the one runner we cannot reproduce locally. - The POSIX publication test hook no longer compiles into Windows builds, fixing an exact -Werror unused-variable failure. The setter keeps a parameter-consuming Windows stub because it is public API. - The Wine leg assembles the real release layout (payload plus canonical launcher) and version-checks both, running the launcher through cmd so it has a Windows-visible parent. The unsupported Wine soak is removed: Wine stays a fast compile/package/version check, and native Windows is authoritative for daemon, locking, ACL and process-lifetime semantics. - run.sh soak-windows routes to the native Windows VM, which validates the payload, builds the protected per-user temp root, stamps ACLs, and refuses success without a completion summary. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
73 lines
2.6 KiB
Bash
73 lines
2.6 KiB
Bash
#!/usr/bin/env bash
|
|
# Static contract for the daemon crash/restart assertions in the soak harness.
|
|
# Source-contract patterns intentionally retain shell variables literally.
|
|
# shellcheck disable=SC2016
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
soak="$ROOT/scripts/soak-test.sh"
|
|
|
|
for required in \
|
|
'json_rpc_response_ok()' \
|
|
'and "result" in message' \
|
|
'diagnostics_start_count()' \
|
|
'DAEMON_PID=$(diagnostics_json_value pid)' \
|
|
'Idle daemon CPU:' \
|
|
'SOAK_PROJECT_VALUE="$SOAK_PROJECT"' \
|
|
'SOAK_PROJECT_VALUE=$(cygpath -m "$SOAK_PROJECT")' \
|
|
'SOAK_PROJECT_JSON=$(python3 -c' \
|
|
'mcp_response_project()' \
|
|
'PROJ_NAME=$(mcp_response_project "$MCP_LAST_RESPONSE")' \
|
|
'FAIL: soak DACL normalize' \
|
|
'FAIL: soak DACL stamp' \
|
|
'FAIL: soak child DACL reset' \
|
|
'SOAK_NATIVE_WINDOWS=false' \
|
|
"eval 'coproc CBM_SOAK_SERVER {" \
|
|
'SERVER_PID=$CBM_SOAK_SERVER_PID' \
|
|
'start_mcp_server truncate' \
|
|
'start_mcp_server append' \
|
|
'def handle_${i}(request):' \
|
|
'trace_path "{\"project\":\"$PROJ_NAME\",\"function_name\":\"handle_1\",\"direction\":\"both\"}"' \
|
|
'wait_for_daemon_stop "$DAEMON_STOP_COUNT"' \
|
|
'wait_for_daemon_stop "$FINAL_DAEMON_STOP_COUNT"' \
|
|
'wait_for_diagnostics_snapshot "$DIAGNOSTICS_START_COUNT" "$DIAG_FILE_BEFORE_CRASH"' \
|
|
'mcp_call index_repository "{\"repo_path\":$SOAK_PROJECT_JSON}" || PASS=false'; do
|
|
if ! grep -Fq "$required" "$soak"; then
|
|
echo "FAIL: daemon soak recovery contract missing: $required" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
if grep -Fq 'WARN: soak DACL stamp failed' "$soak"; then
|
|
echo "FAIL: native-Windows soak must fail closed when its trusted-root DACL cannot be set" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if grep -Fq '"repo_path":"$SOAK_PROJECT"' "$soak"; then
|
|
echo "FAIL: soak must not send an unconverted host/MSYS project path to a Windows binary" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if grep -Fq "json.load(open('\$DIAG_FILE'))" "$soak" ||
|
|
grep -Fq 'with open(sys.argv[1]' "$soak"; then
|
|
echo "FAIL: native Windows Python must consume diagnostics through stdin, not an MSYS path" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if grep -Fq 'ps -o %cpu= -p "$SERVER_PID"' "$soak"; then
|
|
echo "FAIL: soak idle CPU must not measure only the thin frontend" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$(grep -c '^PASS=true$' "$soak")" -ne 1 ]; then
|
|
echo "FAIL: soak result state must be initialized exactly once" >&2
|
|
exit 1
|
|
fi
|
|
if ! grep -Fq 'tests/test_soak_daemon_recovery_contract.sh' "$ROOT/scripts/test.sh"; then
|
|
echo "FAIL: daemon soak recovery contract is not wired into the test suite" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Daemon soak recovery contract passed"
|