#!/usr/bin/env bash # Seeds a data root for the row 56 byte-identity check. Usage: seed.sh DIR # DIR must not exist. Writes run records only under DIR. set -euo pipefail D="$1" [ ! -e "$D" ] || { echo "seed: $D exists" >&2; exit 4; } R="$D/runs" mkdir -p "$R" "$D/state" run() { mkdir -p "$R/$1"; } put() { printf '%s\n' "$3" > "$R/$1/$2"; } A=r-20260101T000000Z-aaaaaa run $A put $A task.json '{"taskVersion":1,"id":"t-full","prompt":"say hi","mission":"m.json"}' put $A mission.json '{"missionVersion":1,"id":"m-full","objective":"Exercise every show line"}' put $A result.json '{"runVersion":1,"runId":"'$A'","taskId":"t-full","missionId":"m-full","status":"succeeded","reason":null,"request":"say \"hi\"\nplease","response":"hi","expectedExact":"hi","retriedFrom":"r-20251231T000000Z-000000","workspace":"ws1","tools":["read","ls"],"session":"s1","sessionForkFrom":null,"exitCode":0,"signal":null,"provider":"zai","model":"m","startedAt":"2026-01-01T00:00:00.000Z","finishedAt":"2026-01-01T00:00:01.000Z","durationMs":1000}' : > "$R/$A/stderr.txt" mkdir "$R/$A/workspace" B=r-20260101T000100Z-bbbbbb run $B put $B task.json '{"taskVersion":1,"id":"t-fail","prompt":"x"}' put $B result.json '{"runVersion":1,"runId":"'$B'","taskId":"t-fail","missionId":null,"status":"failed","reason":"expect-mismatch","request":"x","response":"y","expectedExact":null,"workspace":null,"tools":null,"session":null,"sessionForkFrom":null,"exitCode":null,"signal":"SIGKILL","provider":"zai","model":"m","startedAt":"2026-01-01T00:01:00.000Z","finishedAt":"2026-01-01T00:01:02.000Z","durationMs":2000}' C=r-20260101T000200Z-cccccc run $C put $C task.json '{"taskVersion":1,"id":"t-incomplete","prompt":"x"}' E=r-20260101T000300Z-dddddd run $E put $E result.json '{"status": "succeeded", truncated' N=r-20260101T000400Z-eeeeee run $N put $N result.json 'null' F=r-20260101T000500Z-ffffff run $F put $F mission.json '{not json' put $F result.json '{"runVersion":1,"runId":"'$F'","taskId":"a-task-id-longer-than-eighteen","missionId":"m","status":"succeeded-with-a-long-status","reason":null,"request":"","response":"","workspace":":run","tools":[],"session":"named-session","exitCode":0,"signal":null,"provider":"p","model":"m","startedAt":"s","finishedAt":"f","durationMs":0}' printf 'not a run directory\n' > "$R/r-20260101T000600Z-gggggg" ln -s "$A" "$R/r-20260101T000700Z-hhhhhh" ln -s "r-does-not-exist" "$R/r-20260101T000800Z-iiiiii" run r-zz.weird_name-1 mkdir "$R/x-not-a-run" printf '{"at":"2026-01-01T00:00:00Z","event":"pruned","runId":"r-old"}\n' > "$R/.pruned.log" printf 'notes\n' > "$R/notes.txt"