#!/usr/bin/bash
set -eu
run_dir=/home/smoln/runs/research-deep-20261101
cd "$run_dir/source/core"
systemctl --user show research-deep-recovery.scope -p CPUQuotaPerSecUSec -p MemoryMax > "$run_dir/evidence/recovery-resource-limits.txt"
set +e
env -i PATH=/usr/local/go/bin:/usr/bin:/bin HOME="$run_dir/empty-home" GOCACHE=/home/smoln/.cache/go-build GOPATH="$run_dir/empty-gopath" GOENV=off GOPROXY=off GOSUMDB=off GOTOOLCHAIN=local GOMAXPROCS=1 RESEARCH_RECOVERY_RESULTS="$run_dir/evidence/capy-recovery-v2.json" timeout 600s go test -p 1 ./internal/memory -run '^TestResearchRecoveryMatrixV2$' -count=1 -json -timeout=90s > "$run_dir/evidence/recovery-v2-test-events.jsonl" 2> "$run_dir/evidence/recovery-v2-stderr.txt"
status=$?
printf '%s\n' "$status" > "$run_dir/evidence/recovery-v2-exit.txt"
exit "$status"
