#!/bin/sh
# IR-66 gate legs — run from the lane worktree. Each leg writes its own exit FILE.
cd "$(dirname "$0")" || exit 9
ROOT_XTASK="../../target/debug/xtask.exe"
"$ROOT_XTASK" pool-claim --pool target --label gate-ir66-161 > GIR66_claim.raw 2>&1
echo $? > GIR66_claim.exit

FILTER="test(loopback_attach_to_a_prepopulated_ring_delivers_without_deadlock) or test(cross_node_cold_attach_to_alt_screen_gets_clean_repaint)"
for i in 1 2 3; do
  cargo nextest run -p spt-daemon -E "$FILTER" > "GIR66_run$i.raw" 2>&1
  echo $? > "GIR66_run$i.exit"
done

cargo clippy -p spt-daemon --all-targets -- -D warnings > GIR66_clippy.raw 2>&1
echo $? > GIR66_clippy.exit

traceable-reqs check > GIR66_treqs.raw 2>&1
echo $? > GIR66_treqs.exit

"$ROOT_XTASK" pool-release --pool target > GIR66_release.raw 2>&1
echo $? > GIR66_release.exit
echo DONE
