Files
llm-intelligence/scripts/review/release_semantics_guard_test.sh
2026-05-29 18:48:48 +08:00

30 lines
1.1 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$ROOT_DIR"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
BAD_FILE="$TMP_DIR/bad-phase6.txt"
cat > "$BAD_FILE" <<'EOF'
[WARN] window_gate_result=WARN 最近 7 次采集成功率未达 95%仅外部文档站失败external_provider_failure_onlystability_label=recovered-external-incident
EOF
set +e
bash scripts/review/release_semantics_guard.sh "$BAD_FILE" >/tmp/release_semantics_bad.out 2>&1
BAD_RC=$?
set -e
[[ "$BAD_RC" -ne 0 ]]
grep -q 'missing release semantics summary' /tmp/release_semantics_bad.out
GOOD_FILE="$TMP_DIR/good-phase6.txt"
cat > "$GOOD_FILE" <<'EOF'
[WARN] window_gate_result=WARN 最近 7 次采集成功率未达 95%仅外部文档站失败external_provider_failure_onlystability_label=recovered-external-incident
RELEASE_SEMANTICS class=degraded-external-provider gate=window_gate policy=release-allowed-with-warning
EOF
bash scripts/review/release_semantics_guard.sh "$GOOD_FILE" >/tmp/release_semantics_good.out 2>&1
grep -q 'RELEASE_SEMANTICS_GUARD: PASS' /tmp/release_semantics_good.out