Files
felhom.eu/documentation/audits/night-2026-10-28/part5-claims/walk_selfrestore.py
T

30 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""walk_selfrestore.py — claim fail.customer-self-restore on scratch 9202 (night 2026-10-28), front doors only.
After the H5 proof: vikunja holds C1 (in the 02:30 restore point) and C2 (made after it). Press the household's restore
with nothing blocked. Want: the restore succeeds, C1 reads back, C2 is GONE (the point is older), the app runs, no hold."""
import json, os, sys, time
sys.path.insert(0, "/mnt/5_hdd/felhom.eu/git/app-catalog-felhom.eu/scripts")
os.environ.setdefault("SC", "/tmp/claude-1000/-mnt-5-hdd-felhom-eu-git/0b76c4d7-9b39-4e4e-869d-d0d2c6006331/scratchpad/rt-9202")
os.environ.setdefault("TARGET", "9202")
import box_walk as w
import upgrade_fixtures_box as fb
EV = "/tmp/claude-1000/-mnt-5-hdd-felhom-eu-git/0b76c4d7-9b39-4e4e-869d-d0d2c6006331/scratchpad/night/p1/h5"
st = json.load(open(os.path.join(EV, ".state.json")))
fx = fb.FIXTURES["vikunja"]; SUB = getattr(fx, "sub", "vikunja"); APP = "vikunja"
w.login()
w.say(f"before: C1 {fx.verify(w, SUB, st['c1'], w.say)}, C2 {fx.verify(w, SUB, st['c2'], w.say)}")
snaps = w.snapshots(APP)
newest = max(snaps, key=lambda x: x.get("time") or "")
w.say(f"restoring from the newest point {newest}")
t0 = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
res = w.restore(APP, snapshot_id=newest.get("id") or newest.get("snapshot_id") or newest.get("short_id"))
w.say(f"restore result: {json.dumps(res)[:800]}")
w.say("controller log: " + w.guest(f"docker logs --since {t0} felhom-controller 2>&1 | grep -E '\\[(INFO|WARN|ERROR)\\]' | grep -E 'vikunja|restore|Restor' | grep -v ParseCompose | tail -25"))
s = w.stack(APP)
w.say(f"after: state={s.get('state')} hold={s.get('hold_reason')!r}")
w.say(f"C1 readback (want True): {fx.verify(w, SUB, st['c1'], w.say)}")
w.say(f"C2 readback (want False — newer than the point): {fx.verify(w, SUB, st['c2'], w.say)}")
code, d = w.ctl("GET", "/api/backup/restore-status")
w.say(f"restore record: {json.dumps(d)[:600]}")
open(os.path.join(EV, "selfrestore.log"), "a").write("\n".join(w.LOG) + "\n")