KeiSeiKit-1.0/tests/battle/verify.sh
Parfii-bot b1c5fd00d2 test(v0.21): Docker battle-test infra for install.sh on fresh ubuntu:24.04
tests/battle/Dockerfile.install-test — ubuntu:24.04 + deps
  (git, curl, ca-certificates, build-essential, jq, pandoc, rustup)
tests/battle/battle-entry.sh — ENTRYPOINT: runs install.sh with
  $PROFILE (default minimal), then verify.sh
tests/battle/verify.sh — POSIX sh gate: blocks >= 79, skills >= 39,
  top hooks >= 10, _lib hooks >= 2, test-gate.sh exits 0,
  settings.json valid JSON
tests/battle/README.md — build + run docs

SHIP-BLOCKER FOUND (for follow-up fix commit):
  kei-artifact crate fails to compile on fresh install because
  install/lib-primitives.sh::copy_rust_primitive copies only
  Cargo.toml + src/ + tests/. Crate has sibling schemas/ dir with
  5 JSON files that src/schemas.rs include_str!s at compile time.
  Missing → cargo build error, install exits 0 (soft-fail design)
  but full profile only produces 6/25 binaries instead of 25/25.

Real stdout verified:
  minimal: 80 blocks, 39 skills, 10 hooks, 3 _lib — exit 0 ✓
  dev:     same counts — exit 0 ✓ BUT 3/8 binaries (kei-artifact fail)
  full:    same counts — exit 0 ✓ BUT 6/25 binaries

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 18:37:55 +08:00

50 lines
1.7 KiB
Bash
Executable file

#!/usr/bin/env sh
# tests/battle/verify.sh — post-install assertions for the battle test.
# POSIX sh; runs inside ubuntu:24.04 container as root ($HOME=/root).
# Thresholds match v0.21 kit snapshot (2026-04-22):
# _blocks >= 79, skills >= 39, top hooks >= 10, _lib hooks >= 2.
set -u
fail() { printf 'FAIL: %s\n' "$1" >&2; exit 1; }
pass() { printf 'PASS: %s\n' "$1"; }
AG="$HOME/.claude/agents"
HK="$HOME/.claude/hooks"
SK="$HOME/.claude/skills"
n_blocks=$(ls -1 "$AG/_blocks" 2>/dev/null | wc -l | tr -d ' ')
[ "$n_blocks" -ge 79 ] || fail "_blocks count $n_blocks < 79"
pass "_blocks count = $n_blocks (>= 79)"
n_skills=$(ls -1 "$SK" 2>/dev/null | wc -l | tr -d ' ')
[ "$n_skills" -ge 39 ] || fail "skills count $n_skills < 39"
pass "skills count = $n_skills (>= 39)"
n_hooks=$(find "$HK" -maxdepth 1 -type f -name '*.sh' 2>/dev/null | wc -l | tr -d ' ')
[ "$n_hooks" -ge 10 ] || fail "top hooks count $n_hooks < 10"
pass "top hooks count = $n_hooks (>= 10)"
n_lib=$(find "$HK/_lib" -maxdepth 1 -type f -name '*.sh' 2>/dev/null | wc -l | tr -d ' ')
[ "$n_lib" -ge 2 ] || fail "_lib hooks count $n_lib < 2"
pass "_lib hooks count = $n_lib (>= 2)"
if [ -x "$HK/_lib/test-gate.sh" ]; then
if bash "$HK/_lib/test-gate.sh" >/tmp/test-gate.out 2>&1; then
pass "test-gate.sh exits 0"
else
cat /tmp/test-gate.out >&2
fail "test-gate.sh exited non-zero"
fi
else
fail "test-gate.sh missing at $HK/_lib/test-gate.sh"
fi
if [ -f "$HOME/.claude/settings.json" ]; then
jq . "$HOME/.claude/settings.json" >/dev/null 2>&1 \
&& pass "settings.json parses as valid JSON" \
|| fail "settings.json is not valid JSON"
else
pass "settings.json absent (not activated — OK)"
fi
echo "=== verify.sh: all checks passed ==="