#!/bin/bash # run chaos rounds $1..$2 in order; stop on a lost seed A (the brief's stop rule), evidence per round cd "$(dirname "$0")" for n in $(seq $1 $2); do [ -f chaos/STOP ] && { echo "STOP file present — not starting round $n"; exit 0; } python3 -u chaos.py round $n > chaos/round-$(printf %02d $n)-run.txt 2>&1 python3 - "$n" <<'PY' import json, sys n = int(sys.argv[1]) r = json.load(open(f"chaos/round-{n:02d}.json")) rb = r.get("readback") or {} lost = [k for k, v in rb.items() if k == "A" and v is False] print(f"round {n}: action={r['action']} accident={r['accident']} steady={r.get('time_to_steady_s')} readback={rb} events={len(r.get('events') or [])}") held = ((r.get("after") or {}).get("state") or {}).get("hold_reason") if lost and held: print("seed A unreadable because the app is HELD (stopped by design) — recovery is checked by the restore route, not a stop") elif lost and r["action"] not in ("remove",): open("chaos/STOP", "w").write(f"round {n}: seed A did not read back — the stop rule\n") print("STOP written") PY done