#!/bin/bash # Pre-deploy determinism check: fetch every production ledger and strictly # replay it against the LOCAL engine. Any refused command is a hard failure. # Run from the repo root before deploying any engine change. set -euo pipefail HOST="${1:-104.236.96.198}" TMP=$(mktemp -d) trap 'rm -rf "$TMP"' EXIT scp -q "root@$HOST:/var/lib/wizwar/rooms/*.jsonl" "$TMP/" fails=0 for f in "$TMP"/*.jsonl; do out=$(npx tsx deploy/replay-verify.mjs "$f" 2>&1 | tail -1) case "$out" in FAIL*) echo "$out"; fails=$((fails+1));; esac done count=$(ls "$TMP" | wc -l | tr -d ' ') echo "--- $count ledgers checked, $fails failures" [ "$fails" -eq 0 ]