KeiSeiKit-1.0/tests/battle/README.md
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

39 lines
1.5 KiB
Markdown

# tests/battle — Clean-Ubuntu Install Test
Validates `install.sh` on a fresh `ubuntu:24.04` container. CI only runs
`--no-execute` dry-runs; this battle-test actually executes the installer.
## Run
From repo root:
```bash
docker build -t keisei-battle:latest -f tests/battle/Dockerfile.install-test .
docker run --rm keisei-battle:latest # minimal
docker run --rm -e PROFILE=core keisei-battle:latest
docker run --rm -e PROFILE=dev keisei-battle:latest
docker run --rm -e PROFILE=full keisei-battle:latest
```
Container exits 0 = green. Any other code = investigate stdout.
## What it asserts (verify.sh)
- `~/.claude/agents/_blocks` ≥ 79
- `~/.claude/skills` ≥ 39
- `~/.claude/hooks/*.sh` ≥ 10 top-level
- `~/.claude/hooks/_lib/*.sh` ≥ 2 (gate.sh + test-gate.sh, v0.17)
- `hooks/_lib/test-gate.sh` self-test passes (11/11)
- `settings.json` (if created) parses as valid JSON
## Known quirks (2026-04-22)
- **`kei-artifact` crate fails** on `dev`/`full`: `copy_rust_primitive`
(install/lib-primitives.sh) copies `src/` + `tests/` only — misses
sibling `schemas/`, so `include_str!("../schemas/*.json")` breaks.
Install still exits 0 (build is soft-fail); primitive binary count
drops (`6/25` on full). Fix: copy every sibling dir the crate ships.
- **Ubuntu 24.04 rustc is 1.75** — too old for `edition = "2024"`.
Dockerfile installs rustup stable; `apt install rustc` is NOT enough.
- **Apple Silicon hosts**: image builds linux/arm64 natively; binaries
produced inside won't run on x86_64 hosts.