From c61748694b388f8561992d4b19a7397ebc121407 Mon Sep 17 00:00:00 2001 From: Vijit Singh Date: Thu, 16 Jul 2026 21:30:06 -0500 Subject: [PATCH 1/2] fix(e2e-real): standalone perf gate must exit nonzero on a regression (#214 follow-up) Co-Authored-By: Claude Fable 5 --- tests/e2e-real.sh | 16 +++++++++++----- tests/run.sh | 26 ++++++++++++-------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/tests/e2e-real.sh b/tests/e2e-real.sh index f40651e..a183acf 100755 --- a/tests/e2e-real.sh +++ b/tests/e2e-real.sh @@ -630,13 +630,15 @@ perf() { bad "perf: bench failed" printf '%s\n' "$out" | tail -3 >&2 "$RIGFORGE" start >/dev/null 2>&1 || true - return 0 + summary "perf" + return fi "$RIGFORGE" start >/dev/null 2>&1 || true hr="$(printf '%s' "$out" | grep -oiE '[0-9.]+ H/s' | tail -1 | grep -oE '[0-9.]+')" if [ -z "$hr" ]; then bad "perf: no hashrate parsed from bench output" - return 0 + summary "perf" + return fi if [ -n "${E2E_PERF_RECORD:-}" ]; then # #214: judge BEFORE writing — recording is the only perf run most rigs ever get, and a @@ -645,7 +647,8 @@ perf() { if [ -f "$bl" ] && ! _perf_judge "$hr" "$bl" "$hist" "$tol"; then if [ -z "${E2E_PERF_FORCE:-}" ]; then bad "perf: NOT recorded — the measurement regressed (see above). Fix the regression, or consciously re-record with E2E_PERF_FORCE=1." - return 0 + summary "perf" + return fi printf ' \033[1;33m∙\033[0m E2E_PERF_FORCE=1 — recording a REGRESSED measurement as the new baseline\n' fi @@ -657,14 +660,17 @@ perf() { # dirty tracked files — say so now, not at the next deploy. printf ' \033[1;33m∙\033[0m collect: %s and %s\n' "$bl" "$hist" printf ' \033[1;33m∙\033[0m after they are committed upstream, reset this rig or the next tag deploy aborts: git checkout -- tests/perf-baselines/\n' - return 0 + summary "perf" + return fi if [ ! -f "$bl" ]; then printf ' \033[1;33m∙\033[0m no baseline for %s — measured %s H/s; record with E2E_PERF_RECORD=1 and commit tests/perf-baselines/\n' "$(hostname)" "$hr" - return 0 + summary "perf" + return fi # The bad lines inside the judge already counted any failure; nothing more to decide here. _perf_judge "$hr" "$bl" "$hist" "$tol" || true + summary "perf" } case "${1:-}" in diff --git a/tests/run.sh b/tests/run.sh index 24b9e9a..9fe6a66 100644 --- a/tests/run.sh +++ b/tests/run.sh @@ -5599,11 +5599,15 @@ fi # paths — no root, no /var/lock — with background subshells as the competing "suites". # #214: perf recording judges BEFORE it writes — the recording run is the only perf gate most # rigs ever get, so a regressed measurement must fail the phase and leave the baseline untouched -# (E2E_PERF_FORCE=1 is the conscious override). Helpers extracted from e2e-real.sh the same way -# the rig_lock tests do it; ok/bad/phase and the bench are stubbed. -echo "== unit: e2e-real perf record gate (#214) ==" +# (E2E_PERF_FORCE=1 is the conscious override). #267: the harness must exercise the REAL +# summary/exit plumbing (ok/bad/summary extracted verbatim from e2e-real.sh, same as the rig_lock +# tests do it below) rather than reimplement it — only phase and the bench are stubbed. +echo "== unit: e2e-real perf record gate (#214/#267) ==" PJ="$(mktemp -d "$SANDBOX/pj.XXXXXX")" -sed -n '/^_perf_judge()/,/^}/p' "$ROOT/tests/e2e-real.sh" >"$PJ/fns.sh" +sed -n '/^ok() {$/,/^}/p' "$ROOT/tests/e2e-real.sh" >"$PJ/fns.sh" +sed -n '/^bad() {$/,/^}/p' "$ROOT/tests/e2e-real.sh" >>"$PJ/fns.sh" +sed -n '/^summary() {$/,/^}/p' "$ROOT/tests/e2e-real.sh" >>"$PJ/fns.sh" +sed -n '/^_perf_judge()/,/^}/p' "$ROOT/tests/e2e-real.sh" >>"$PJ/fns.sh" sed -n '/^perf()/,/^}/p' "$ROOT/tests/e2e-real.sh" >>"$PJ/fns.sh" cat >"$PJ/rigforge-stub" <<'EOF' #!/usr/bin/env bash @@ -5611,22 +5615,16 @@ cat >"$PJ/rigforge-stub" <<'EOF' exit 0 EOF chmod +x "$PJ/rigforge-stub" -run_perf() { # env: STUB_BENCH_HS E2E_PERF_RECORD E2E_PERF_FORCE; prints output; rc = #bad calls +run_perf() { # env: STUB_BENCH_HS E2E_PERF_RECORD E2E_PERF_FORCE; prints output; rc = perf()'s real summary/exit ( cd "$PJ" || exit 9 HERE="$PJ" RIGFORGE="$PJ/rigforge-stub" - BADS=0 - ok() { echo "OK: $1"; } - bad() { - echo "BAD: $1" - BADS=$((BADS + 1)) - } + PASS=0 + FAIL=0 phase() { :; } source "$PJ/fns.sh" - set +e - perf - exit "$BADS" + perf 2>&1 ) } host="$(hostname)" From dfb839812537981c2066690e574e8a3973c51f88 Mon Sep 17 00:00:00 2001 From: Vijit Singh Date: Thu, 16 Jul 2026 21:32:12 -0500 Subject: [PATCH 2/2] fix(e2e-real): standalone perf gate must exit nonzero on a regression (#214 follow-up) Co-Authored-By: Claude Fable 5 --- tests/run.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index 9fe6a66..2e4dbcf 100644 --- a/tests/run.sh +++ b/tests/run.sh @@ -5604,11 +5604,7 @@ fi # tests do it below) rather than reimplement it — only phase and the bench are stubbed. echo "== unit: e2e-real perf record gate (#214/#267) ==" PJ="$(mktemp -d "$SANDBOX/pj.XXXXXX")" -sed -n '/^ok() {$/,/^}/p' "$ROOT/tests/e2e-real.sh" >"$PJ/fns.sh" -sed -n '/^bad() {$/,/^}/p' "$ROOT/tests/e2e-real.sh" >>"$PJ/fns.sh" -sed -n '/^summary() {$/,/^}/p' "$ROOT/tests/e2e-real.sh" >>"$PJ/fns.sh" -sed -n '/^_perf_judge()/,/^}/p' "$ROOT/tests/e2e-real.sh" >>"$PJ/fns.sh" -sed -n '/^perf()/,/^}/p' "$ROOT/tests/e2e-real.sh" >>"$PJ/fns.sh" +sed -n '/^ok() {$/,/^}/p; /^bad() {$/,/^}/p; /^summary() {$/,/^}/p; /^_perf_judge()/,/^}/p; /^perf()/,/^}/p' "$ROOT/tests/e2e-real.sh" >"$PJ/fns.sh" cat >"$PJ/rigforge-stub" <<'EOF' #!/usr/bin/env bash [ "$1" = bench ] && echo "${STUB_BENCH_HS:-10000.0} H/s"