#!/bin/sh # Build + RUN the SIGPIPE integration probe: a client that hangs up mid-response # must not kill the server. Pure C11, no Python, no third-party anything. # # This is an INTEGRATION probe — it needs a running engram, and it needs the PID # so it can tell "still serving" from "restarted by a supervisor underneath me". # Point it at a SCRATCH instance, never at production: # # cp -Rc ~/.neuron/engram /tmp/engram-scratch # APFS clone, instant # EL_SINGLETON_DIR=/tmp ENGRAM_DATA_DIR=/tmp/engram-scratch \ # ENGRAM_STORE=1 ENGRAM_API_KEY=ntn-user-2026 ENGRAM_BIND=":18753" ./engram & # lsof -nP -iTCP:18753 -sTCP:LISTEN # confirm YOUR pid owns the port # ./engram/test/run_http_sigpipe_test.sh 18753 # # NEGATIVE CONTROL (invariant §8.6 — no test without one). This probe was shown # to FAIL on the pre-change build before the fix was accepted. Measured, same # data, same endpoint, same probe: # unpatched -> SERVER DIED 43.3s after the hang-up (exit 1) # patched -> survived 2 rounds, still listening, still serving (exit 0) # To reproduce the failing side, build the runtime at the parent commit and run # this against it. set -e HERE=$(cd "$(dirname "$0")" && pwd) CC=${CC:-cc} PORT=${1:?usage: run_http_sigpipe_test.sh [rounds] [settle_seconds]} PID=${2:?usage: run_http_sigpipe_test.sh [rounds] [settle_seconds]} ROUNDS=${3:-2} SETTLE=${4:-45} TMP=$(mktemp -d) $CC -std=c11 -Wall -Wextra -O2 "$HERE/test_http_sigpipe.c" -o "$TMP/probe" "$TMP/probe" "$PORT" "$PID" "$ROUNDS" "$SETTLE"