Files
stack/agents/darkwing/work/queue-56-review/r2/probes.sh
T

37 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# Row 56 round 2 probes: the README's link wording for runs/ and state/, base against candidate.
export TMPDIR=~/darkwing-scratch/r56b/tmp
S=~/darkwing-scratch/r56b; W=$S/probes; rm -rf $W; mkdir -p $W
A=r-20260101T000000Z-aaaaaa
root() { mkdir -p "$W/$1/data" "$W/$1/outside"; printf '{"configVersion":1,"environment":"development","dataRoot":"%s","execution":{"backend":"docker","provider":"zai","model":"m"}}\n' "$W/$1/data" > "$W/$1/config.json"; echo "$W/$1/data"; }
run_case() { local name="$1" cfg="$2"; shift 2
for tree in base cand; do
local rc=0 out
out="$(cd $S/$tree && env -u NODE_TEST_CONTEXT MOSAIC_CONFIG="$cfg" node scripts/mosaic-task.mjs "$@" 2>"$W/$name.$tree.err")" || rc=$?
printf ' %s: exit %s\n' "$tree" "$rc"; [ -z "$out" ] || printf '%s\n' "$out" | sed 's/^/ out| /'
[ -s "$W/$name.$tree.err" ] && head -1 "$W/$name.$tree.err" | sed 's/^/ err| /'
done; }
state_case() {
(cd $S/cand && node -e '
import("./packages/runs/src/index.mjs").then((m) => {
for (const f of ["readActivePointer", "readActivationLog"]) {
try { console.log(" " + f + ": " + JSON.stringify(m[f](process.argv[1]))); } catch (e) { console.log(" " + f + ": " + e.name + " " + e.exitCode + " " + e.message); }
}
});' "$1"); }
hdr() { printf '\n== %s\n' "$*"; }
D="$(root q1)"; ln -s "$W/q1/outside/absent" "$D/runs"
hdr "Q1 runs/ linked out of the data root to nothing: list"; run_case q1l "$W/q1/config.json" list
hdr "Q1 same: show"; run_case q1s "$W/q1/config.json" show "$A"
D="$(root q2)"; ln -s "$W/q2/outside" "$D/runs"
hdr "Q2 runs/ linked out to an empty directory that exists: list"; run_case q2 "$W/q2/config.json" list
D="$(root q3)"; ln -s "$W/q3/outside/absent" "$D/state"
hdr "Q3 state/ linked out to nothing (candidate module)"; state_case "$D"
D="$(root q4)"; ln -s "$W/q4/outside" "$D/state"
hdr "Q4 state/ linked out to an empty directory that exists (round 1 P5)"; state_case "$D"
printf '{"pointerVersion":1,"release":"x","imageTag":"y","activatedAt":"z"}\n' > "$W/q4/outside/active.json"
hdr "Q4b same, with active.json there"; state_case "$D"