Files
boshu2__agentops/tests/scripts/test-skill-runtime-parity.sh
Bo a5f7be8364 Qualify deterministic Gas City factory for AgentOps (#924)
## Summary

- pin and materialize an exact colocated Gas City and official Beads
toolchain without editing installed binaries
- add deterministic isolated bootstrap, recovery, teardown, exact
workspace binding, and tracked .gitignore preservation
- add bead-native Mayor, plan review, isolated Codex/Claude workers,
binding Validators, rejection-to-Mayor rescope, fenced Refinery,
integration validation, qualification, and protected PR delivery
- make the local quick release gate deterministic after CLI cleanup

## Validation

- fresh GC-managed Codex Sol verdict: PASS (verdict
d1a1e03808b4605e49cc97423c7570b04d581c9ee1fad9aa8f1daf6e72d6f0ef)
- focused GC executor/factory/projection suite: PASS (32 packet + 77
factory + 4 projection + 21 bootstrap tests, plus doctors and static
contracts)
- teardown suite: 7/7 PASS
- local-ci-fast: PASS
- exact v16 mixed-provider live canary: Terra and Opus 4.8 workers in
parallel, opposite-family candidate validators, Opus Refiner, Sol
integration validator, all lifecycle beads closed, clean managed
teardown

## Scope

The follow-on Fable 5 Mayor/Refiner, Sol-every-bead validation, and Luna
support-worker topology is deliberately not part of this historical v16
baseline; it will build on this foundation in a separate bead program.
2026-07-20 08:44:46 -04:00

128 lines
3.3 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
SCRIPT="$ROOT/scripts/validate-skill-runtime-parity.sh"
PASS=0
FAIL=0
pass() { echo "PASS: $1"; PASS=$((PASS + 1)); }
fail() { echo "FAIL: $1"; FAIL=$((FAIL + 1)); }
if [[ ! -f "$SCRIPT" ]]; then
echo "FAIL: missing script: $SCRIPT" >&2
exit 1
fi
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
setup_fixture() {
local fixture="$1"
mkdir -p "$fixture/scripts/lib" "$fixture/cli/internal/quality" "$fixture/skills/fixture" "$fixture/skills-codex/fixture"
cp "$SCRIPT" "$fixture/scripts/validate-skill-runtime-parity.sh"
cp "$ROOT/scripts/lib/repo-root.sh" "$fixture/scripts/lib/repo-root.sh"
cat > "$fixture/cli/internal/quality/stale_refs.go" <<'EOF'
package quality
var DeprecatedCommands = map[string]string{
"ao work goals": "ao goals",
"ao know lookup": "ao lookup",
"ao quality metrics": "ao metrics",
"ao start init": "ao init",
}
EOF
}
write_skill() {
local path="$1"
local body="$2"
cat > "$path" <<EOF
---
name: fixture
description: fixture
---
$body
EOF
}
run_fixture() {
local fixture="$1"
local out_file="$2"
(
cd "$fixture"
bash scripts/validate-skill-runtime-parity.sh
) > "$out_file" 2>&1
}
test_pass_with_current_commands() {
local fixture="$TMP_DIR/pass"
local out="$fixture/out.txt"
setup_fixture "$fixture"
write_skill "$fixture/skills/fixture/SKILL.md" "Use \`ao goals measure --json\` and \`ao lookup --query \\\"topic\\\"\`."
write_skill "$fixture/skills-codex/fixture/SKILL.md" "Use \`ao metrics flywheel status\` after \`ao init --hooks --minimal-hooks\`."
if run_fixture "$fixture" "$out"; then
pass "passes when skill docs use current ao commands and hook claims"
else
fail "should pass with current commands"
sed 's/^/ /' "$out"
fi
}
test_fail_on_deprecated_ao_command() {
local fixture="$TMP_DIR/fail-deprecated"
local out="$fixture/out.txt"
setup_fixture "$fixture"
write_skill "$fixture/skills/fixture/SKILL.md" "Run \`ao work goals measure\` before continuing."
write_skill "$fixture/skills-codex/fixture/SKILL.md" "Current command is \`ao goals measure\`."
if run_fixture "$fixture" "$out"; then
fail "should fail on deprecated ao command reference"
return
fi
if grep -q "deprecated command reference found: ao work goals" "$out"; then
pass "fails on deprecated ao command reference"
else
fail "missing deprecated command finding"
fi
}
test_fail_on_stale_hook_claim() {
local fixture="$TMP_DIR/fail-hook-claim"
local out="$fixture/out.txt"
setup_fixture "$fixture"
write_skill "$fixture/skills/fixture/SKILL.md" "Use \`ao init --hooks --full\` for all 8 events."
write_skill "$fixture/skills-codex/fixture/SKILL.md" "Minimal mode is SessionStart + Stop."
if run_fixture "$fixture" "$out"; then
fail "should fail on stale hook-install claims"
return
fi
if grep -q "hook coverage count is stale" "$out" && grep -q "SessionStart + SessionEnd + Stop" "$out"; then
pass "fails on stale hook-install claims"
else
fail "missing stale hook-install finding"
fi
}
echo "== test-skill-runtime-parity =="
test_pass_with_current_commands
test_fail_on_deprecated_ao_command
test_fail_on_stale_hook_claim
echo ""
echo "Results: $PASS PASS, $FAIL FAIL"
if [[ "$FAIL" -gt 0 ]]; then
exit 1
fi
exit 0