#!/usr/bin/env bash
# Phase 05 verification script.
# Validates the evidence UI + the 4-act demo dry-run.
#
# Usage: scripts/verify_phase05.sh
# Exit codes: 0 = all checks passed; 1 = one or more checks failed.
set -uo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
fail_count=0
pass() { printf ' [PASS] %s\n' "$1"; }
fail() { printf ' [FAIL] %s\n' "$1"; fail_count=$((fail_count + 1)); }
GITEA_HOST="${GITEA_HOST:-https://git.cloudinit.dev}"
ORG="continuous-intelligence"
EVIDENCE_REPO="acdl-evidence"
echo "== Phase 05 verification =="
echo "Root: ${ROOT}"
echo
# --- Check 1: evidence-ui/index.html structure ---
echo "-- Check 1: evidence-ui/index.html structure (D-032, REQ-14) --"
UI="evidence-ui/index.html"
if [ ! -f "$UI" ]; then
fail "$UI missing"
else
pass "$UI exists"
size=$(wc -c < "$UI")
if [ "$size" -ge 1000 ] && [ "$size" -le 30000 ]; then
pass "$UI size ${size} bytes (within 1-30 KB range)"
else
fail "$UI size ${size} bytes (expected 1-30 KB)"
fi
ui_check=$(python3 << 'PYEOF'
import re, sys
content = open('evidence-ui/index.html').read()
problems = []
if '' not in content: problems.append('missing inline