Site deploy checks: grep -c in place of grep -q on every piped read (grep -q exits on the first match and the writer fails under pipefail)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-08 08:44:32 +00:00
parent 1ad79979c9
commit 103ceb0f3c

View file

@ -32,11 +32,11 @@ post_checks() { # one pass: prints the first mismatch as "field: detail" and ret
n=$(printf '%s' "$j" | python3 -c 'import sys,json; print(json.load(sys.stdin)["state"]["network"])' 2>/dev/null || echo "?")
[ "$n" = "$LIVE_NETWORK" ] || { echo "api/live network: $n (want $LIVE_NETWORK)"; return 1; }
idx=$(curl -fsS "${nc[@]}" --max-time 20 "$SITE/?x=$RANDOM" 2>/dev/null) || { echo "index: not reachable"; return 1; }
for m in "${INDEX_STRINGS[@]}"; do printf '%s' "$idx" | /usr/bin/grep -qF -- "$m" || { echo "index string missing: \"$m\""; return 1; }; done
for m in "${INDEX_STRINGS[@]}"; do printf '%s' "$idx" | /usr/bin/grep -cF -- "$m" >/dev/null || { echo "index string missing: \"$m\""; return 1; }; done
# the page is read into a variable first: `curl | grep -q` under pipefail reads false on a MATCH (grep closes the pipe, curl exits 56;
# three false DEPLOY REDs on 7 and 8 October 2026)
local legal; legal=$(curl -fsS "${nc[@]}" --max-time 20 "$SITE$LEGAL_PAGE?x=$RANDOM" 2>/dev/null) || { echo "$LEGAL_PAGE: not reachable"; return 1; }
printf '%s' "$legal" | /usr/bin/grep -qiF -- "$LEGAL_STRING" || { echo "legal string missing on $LEGAL_PAGE: \"$LEGAL_STRING\""; return 1; }
printf '%s' "$legal" | /usr/bin/grep -ciF -- "$LEGAL_STRING" >/dev/null || { echo "legal string missing on $LEGAL_PAGE: \"$LEGAL_STRING\""; return 1; }
local miners; miners=$(curl -fsS "${nc[@]}" --max-time 20 "$SITE/miners?x=$RANDOM" 2>/dev/null) || { echo "miners: not reachable"; return 1; }
rows=$(miners_rows "$miners")
[ "${rows:-0}" -ge "$MINERS_MIN_ROWS" ] || { echo "miners rows: ${rows:-0} (want at least $MINERS_MIN_ROWS)"; return 1; }