#!/bin/bash
# W1 #235 gate — Windows arm. Runs INSIDE the gate worktree (cd by caller-created path).
cd "$(dirname "$0")" || exit 9
run() { name=$1; shift; echo "=== $name: $*" >> GATE_driver.log; "$@" > "GATE_${name}.raw" 2>&1; echo $? > "GATE_${name}.exit"; }
env | grep -E 'SPT_SPAWN_STRETCH_MS|SPT_WAKE_WEDGE_CEILING_MS' > GATE_envassert.raw 2>&1
echo $? > GATE_envassert.exit   # exit 1 (no match) is the PASS for this leg
git log --oneline -1 >> GATE_driver.log
run claim cargo run -p xtask -- pool-claim --pool target --label gate-w1-235
run treqs traceable-reqs check
run clippy cargo clippy --workspace --all-targets -- -D warnings
run clippy_release cargo clippy --release -p spt-daemon --all-targets -- -D warnings
run nextest_daemon cargo nextest run -p spt-daemon
run wake_rig cargo nextest run -p spt-daemon --test wake_single_flight
run xtaskcheck cargo run -p xtask -- check
echo DONE >> GATE_driver.log
