Files
ironclaw/scripts/replay-snap.sh
Illia Polosukhin 9c9c77b6ea Always compile database backends (#6429)
* Always compile database backends

* Remove dead database feature fallbacks

* Tighten database fallback cleanup

* Remove stale backend flags from CI recipes

* Update release checks for unconditional backends

* Remove runner restart feature flag from CI

* Address backend feature review fallout

* Fix smoke feature parser clippy

* Harden backend feature smoke checks

* Parse dist features with TOML
2026-07-21 20:47:15 +01:00

77 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Thin wrapper around cargo-insta for the replay snapshot gate.
#
# Subcommands:
# review — interactive review + accept/reject of pending snapshots
# accept — accept all pending snapshots without prompting
# test — run the replay test set and fail on pending snapshots
# record — record a fresh fixture from a live agent session
#
# Usage:
# scripts/replay-snap.sh review
# scripts/replay-snap.sh accept
# scripts/replay-snap.sh test
# scripts/replay-snap.sh record <fixture_name> [<model_name>]
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
FIXTURE_DIR="tests/fixtures/llm_traces"
ensure_insta() {
if ! command -v cargo-insta >/dev/null 2>&1; then
cat >&2 <<'EOF'
error: cargo-insta is required but not installed.
Install with one of:
cargo binstall cargo-insta # precompiled binary, fast
cargo install cargo-insta --locked # source build, slow
CI uses taiki-e/install-action@v2 for a precompiled binary.
EOF
exit 1
fi
}
case "${1:-}" in
review)
ensure_insta
cargo insta review
;;
accept)
ensure_insta
cargo insta accept --all
;;
test)
ensure_insta
cargo insta test \
--check \
--no-default-features \
--features "replay" \
--test e2e_recorded_trace \
--test e2e_live
;;
record)
name="${2:-}"
if [ -z "$name" ]; then
echo "usage: $0 record <fixture_name> [<model_name>]" >&2
exit 2
fi
model="${3:-recording-$name}"
out="$FIXTURE_DIR/$name.json"
mkdir -p "$(dirname "$out")"
echo "Recording $out (model_name: $model)"
echo "Interact with the agent, then quit to flush the trace."
IRONCLAW_RECORD_TRACE=1 \
IRONCLAW_TRACE_OUTPUT="$out" \
IRONCLAW_TRACE_MODEL_NAME="$model" \
cargo run
;;
*)
echo "usage: $0 {review|accept|test|record}"
exit 2
;;
esac