diff --git a/apps/evo-dev-session/main.cpp b/apps/evo-dev-session/main.cpp index f0e6839..cbfaae9 100644 --- a/apps/evo-dev-session/main.cpp +++ b/apps/evo-dev-session/main.cpp @@ -358,10 +358,10 @@ int trace(const Args& a) { sample.result = ms(now); sample.status = static_cast(e.result.status); if (e.result.status != IntentStatus::admitted) { - ++resolved; std::printf("trace rejected sequence=%llu status=%u\n", static_cast(e.sequence), static_cast(e.result.status)); + return failed("intention rejected"); } } else if (e.kind == Kind::outcome) { auto& sample = samples[e.sequence - 1]; diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index 7e26c9a..62c9ed0 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -4150,3 +4150,18 @@ format check; Windows MSVC 19.44 preset `quic` build and CTest 4/4 (binary rebui timestamp checked). Not done: wiring into evo-server and the engineering client, the durable control lease (10.3c), an impairment-relay run of the login path. + +## 2026-10-03 — M10.1 trace safety corrections + +The trace runner now requires a new output directory, creates it with owner-only +permissions, and leaves existing paths untouched. A rejected intention now makes +`evo-dev-session trace` return failure; the runner records each local run's status and +fails the experiment if any run fails. + +Executed: GCC 13 Linux Release build of `evo-dev-session` in an isolated +`build/network-wsl` directory; network CTest 1/1; clang-format-19 check for the changed +C++ file; Bash syntax check; temporary-directory check confirmed an existing output +directory is refused and its marker file preserved. `git diff --check` passed. +Not done: no end-to-end trace against a server deliberately configured to reject an +intention; no Docker/Gitea run. The return path is compile-checked but rejection is not +covered by a dedicated application integration test. diff --git a/tools/network/session-trace.sh b/tools/network/session-trace.sh index f45f4ff..9301cc0 100644 --- a/tools/network/session-trace.sh +++ b/tools/network/session-trace.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # M10.1 session timing traces (ADR-0089) on one Linux/WSL2 host, no cluster access. # -# tools/network/session-trace.sh [build-dir] +# tools/network/session-trace.sh [build-dir] # # build-dir (default build/m97-postgres) must be configured with EVO_BUILD_POSTGRES=ON and # EVO_BUILD_NETWORK=ON; .cache/postgres/install comes from tools/prepare-postgres.sh. @@ -14,12 +14,26 @@ # grants-24.bin. Server CPU/RSS is sampled each second; /metrics is captured. # Development credentials and grants are created fresh in ; never reuse them. set -euo pipefail -[ $# -ge 1 ] || { echo "usage: $0 [build-dir]" >&2; exit 2; } +umask 077 +[ $# -ge 1 ] || { echo "usage: $0 [build-dir]" >&2; exit 2; } root="$(cd "$(dirname "$0")/../.." && pwd)" -out="$1" +requested_out="$1" +if [[ -e "$requested_out" || -L "$requested_out" ]]; then + echo "session-trace: output path already exists; choose a new directory: $requested_out" >&2 + exit 2 +fi +out_parent="$(dirname -- "$requested_out")" +out_leaf="$(basename -- "$requested_out")" +case "$out_leaf" in + ''|.|..) echo "session-trace: output must name a new directory" >&2; exit 2 ;; +esac +mkdir -p -- "$out_parent" +out_parent="$(cd -- "$out_parent" && pwd -P)" +out="$out_parent/$out_leaf" +mkdir -- "$out" || { echo "session-trace: cannot create output directory: $out" >&2; exit 2; } build="${2:-$root/build/m97-postgres}" say() { echo "$(date -u +%H:%M:%S) $*"; } -rm -rf "$out"; mkdir -p "$out"; out="$(cd "$out" && pwd)" +out="$(cd "$out" && pwd -P)" cmake --build "$build" --target evo-server evo-dev-session evo-world-clone --parallel 6 > "$out/build.log" 2>&1 || { say "build failed (see $out/build.log)"; exit 1; } prefix="$root/.cache/postgres/install" @@ -62,17 +76,27 @@ say "server ready" echo "$(date +%s.%N) $(ps -o %cpu=,rss= -p "$pid" 2> /dev/null)"; sleep 1 done ) > "$out/cpu.log" & { lscpu | grep -E "Model name|^CPU\(s\)"; free -m | head -2; uname -r; } > "$out/hardware.txt" +trace_failures=0 run() { # name subject intents interval-ms local status=0 - "$build/evo-dev-session" trace --connect 127.0.0.1:17401 --server-name dev-region.evolution.test \ + if "$build/evo-dev-session" trace --connect 127.0.0.1:17401 --server-name dev-region.evolution.test \ --ca "$out/creds/dev-ca.pem" --grants "$out/grants-$2.bin" --intents "$3" --interval-ms "$4" \ - --out "$out/$1.csv" --timeout 300 > "$out/$1.txt" 2>&1 || status=$? - say "$1 exit=$status" + --out "$out/$1.csv" --timeout 300 > "$out/$1.txt" 2>&1; then + say "$1 exit=0" + else + status=$? + trace_failures=1 + say "$1 exit=$status" + fi } run linux-250ms 21 120 250 run linux-100ms 22 200 100 run linux-1000ms 23 30 1000 curl -s http://127.0.0.1:19101/metrics > "$out/metrics-after-linux.txt" || true +if (( trace_failures != 0 )); then + say "one or more local traces failed; see per-run logs in $out" + exit 1 +fi ip -4 addr show eth0 2> /dev/null | awk '/inet /{print $2}' | cut -d/ -f1 > "$out/wsl-ip.txt" || true touch "$out/server-up" say "waiting up to 10 min for $out/client-done"