aegis-runtime-mv
Native Rust agent runtime: Axum WebSocket/SSE/REST gateway, heartbeat scheduler, dependency-aware task workflow, SQLite storage. Attachment of AienOS. Pre-alpha.
Brought by drakestapleton
aegis-runtime-mv / tests / gates / run.sh
| 1 | #!/usr/bin/env bash |
| 2 | # tests/gates/run.sh: the one entry point for the local verification gates of |
| 3 | # aegis-runtime. Every step runs the SAME command as the hosted job it mirrors |
| 4 | # (.github/workflows/ci.yml, job "Test & Invariant Verification"). Manifests under |
| 5 | # tests/gates/ name this script plus one step word, so no manifest needs shell |
| 6 | # expansion (ADR 0028 P6). Observations print as "AIEN-OBS <name> <json>". |
| 7 | # |
| 8 | # Sibling checkout: Cargo.toml depends on ../aien-protocols/crates/* by path. The hosted |
| 9 | # job checks out aien-dev/aien-protocols (main) next to this repository; the local worker |
| 10 | # must provide the same sibling. (The hosted job also checks out aien-sovereign-core as a |
| 11 | # sibling; nothing in this repository reads it, so it is not required here.) |
| 12 | set -euo pipefail |
| 13 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" |
| 14 | cd "$ROOT" |
| 15 | step="${1:?usage: tests/gates/run.sh <step>}" |
| 16 | obs() { printf 'AIEN-OBS %s %s\n' "$1" "$2"; } |
| 17 | need_protocols() { |
| 18 | if [ ! -d ../aien-protocols/crates ]; then |
| 19 | echo "run.sh: ../aien-protocols is missing; the hosted job checks out aien-dev/aien-protocols as a sibling" >&2 |
| 20 | exit 3 |
| 21 | fi |
| 22 | obs sibling_protocols_commit "\"$(git -C ../aien-protocols rev-parse HEAD 2>/dev/null || echo unknown)\"" |
| 23 | } |
| 24 | |
| 25 | case "$step" in |
| 26 | # crumb-verify (gate CRUMB-VERIFY) is retired (DRA-97, 2026-11-07): Crumbs are off the active |
| 27 | # workflow, so no gate checks crumb freshness. The .crumb files stay as history. |
| 28 | fmt) |
| 29 | need_protocols |
| 30 | cargo fmt --all -- --check |
| 31 | ;; |
| 32 | check) |
| 33 | need_protocols |
| 34 | cargo check --all-targets |
| 35 | ;; |
| 36 | clippy) |
| 37 | need_protocols |
| 38 | cargo clippy --all-targets -- -D warnings |
| 39 | ;; |
| 40 | test) |
| 41 | need_protocols |
| 42 | cargo test --verbose -- --test-threads=1 |
| 43 | ;; |
| 44 | zero-disk-secrets) |
| 45 | echo "Auditing repository for prohibited plaintext secret files..." |
| 46 | if find . -maxdepth 4 -name ".env*" -not -path "*/.git/*" -not -path "*/target/*" | grep -q .; then |
| 47 | echo "::error::Prohibited plaintext .env file found. Use an approved AIEN SecretProvider." |
| 48 | obs env_files_found true |
| 49 | exit 1 |
| 50 | fi |
| 51 | obs env_files_found false |
| 52 | echo "Zero plaintext .env files verified." |
| 53 | ;; |
| 54 | anti-slop) |
| 55 | echo "Auditing repository for em dashes, en dashes, and formulaic tropes..." |
| 56 | # Pattern is em dash OR en dash, built from UTF-8 bytes so this file (inside the |
| 57 | # scanned tests/ tree) cannot trip its own scan. Same pattern as the hosted step. |
| 58 | DASH_PATTERN="$(printf '\xe2\x80\x94|\xe2\x80\x93')" |
| 59 | BAD_CHARS=$(grep -rnE --exclude-dir=target --exclude-dir=.git --exclude="*.rs" --exclude="*.json" --exclude="*.safetensors" "$DASH_PATTERN" src/ tests/ docs/ README.md || true) |
| 60 | if [ -n "$BAD_CHARS" ]; then |
| 61 | echo "::error::Em dashes or en dashes detected:" |
| 62 | echo "$BAD_CHARS" |
| 63 | obs dash_hits "$(printf '%s\n' "$BAD_CHARS" | grep -c .)" |
| 64 | exit 1 |
| 65 | fi |
| 66 | obs dash_hits 0 |
| 67 | echo "Sovereign voice compliance verified." |
| 68 | ;; |
| 69 | *) |
| 70 | echo "run.sh: unknown step '$step'" >&2 |
| 71 | exit 2 |
| 72 | ;; |
| 73 | esac |