Files
boshu2__agentops/scripts/coverage-integration.sh
Bo 7a765cde19 Align AgentOps around its operations-layer identity (#1051)
Executes docs/plans/2026-08-07-agentops-operations-layer-alignment.md:
AgentOps is the operations layer for agentic engineering; the federated
integration graph is the topology, the semantic work-and-proof protocol
is the contract, and RPI is the standard one-experiment traversal.

Retires the ao flywheel command family and all knowledge-flywheel
product state, tombstones the seven-move operating-loop workflow,
narrows ao init and the .agents state writers to declared destinations,
renames the core architecture page to rpi-traversal.md with a
compatibility redirect, aligns AGENTS.md, 25 skills, public and package
copy, regenerates every owned projection, and strengthens the
conformance gates with planted-negative proofs.

Both the alignment subject and the follow-up gate-bookkeeping commit
carry fresh author-distinct validation PASS verdicts with empty
not_checked scope.

Test-Removal-Reason: dead knowledge-flywheel and session-store surfaces were deleted with their tests (operations-layer alignment)
2026-08-07 18:37:03 -04:00

66 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# coverage-integration.sh — Build a coverage-instrumented ao binary and run it.
#
# Uses Go 1.20+ `go build -cover` to produce a binary that writes coverage
# data to GOCOVERDIR on exit. Run typical CLI commands against the binary,
# then summarise coverage with `go tool covdata`.
#
# Usage:
# scripts/coverage-integration.sh # run integration + report
# scripts/coverage-integration.sh --report # report only (re-use existing .coverdata)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
CLI_DIR="$REPO_ROOT/cli"
COVER_BIN="$CLI_DIR/bin/ao-cover"
COVER_DIR="$REPO_ROOT/.coverdata"
if ! command -v go >/dev/null 2>&1; then
echo "SKIP: go is not installed"
exit 0
fi
report_only=false
if [[ "${1:-}" == "--report" ]]; then
report_only=true
fi
if [[ "$report_only" == false ]]; then
# Clean previous coverage data
rm -rf "$COVER_DIR"
mkdir -p "$COVER_DIR"
echo "Building coverage-instrumented binary..."
(cd "$CLI_DIR" && go build -cover -o "$COVER_BIN" ./cmd/ao)
echo "Running integration commands..."
export GOCOVERDIR="$COVER_DIR"
# Run safe read-only commands that exercise major code paths
"$COVER_BIN" version 2>/dev/null || true
"$COVER_BIN" ratchet status 2>/dev/null || true
"$COVER_BIN" doctor 2>/dev/null || true
echo "Integration commands complete."
fi
if [[ ! -d "$COVER_DIR" ]] || [[ -z "$(ls -A "$COVER_DIR" 2>/dev/null)" ]]; then
echo "No coverage data found at $COVER_DIR"
echo "Run without --report first."
exit 1
fi
echo ""
echo "=== Coverage Report (integration tests) ==="
go tool covdata percent -i="$COVER_DIR" 2>&1 || {
echo "WARN: go tool covdata failed — may need Go 1.20+"
exit 0
}
echo ""
echo "Coverage data written to $COVER_DIR"
echo "For function-level detail: go tool covdata func -i=$COVER_DIR"