spark-rsi-mv
Native Rust recursive self-improvement engine with paired bootstrap evaluation and cryptographic ledger
Brought by drakestapleton
spark-rsi-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 spark-rsi. |
| 3 | # The host test gate builds its fixture executable and runs the host suite; GitHub-hosted |
| 4 | # checks build only the pinned verifier. Manifests under tests/gates/ name this script plus |
| 5 | # one step word, so no manifest needs shell expansion (ADR 0028 P6). Observations print as |
| 6 | # "AIEN-OBS <name> <json>". |
| 7 | # |
| 8 | # Sibling checkout: Cargo.toml depends on ../aien-protocols/crates/* by path. |
| 9 | # Provide an isolated aien-dev/aien-protocols-mv checkout under that sibling name. |
| 10 | # |
| 11 | # Isolation prerequisites are observed, never provisioned here. The gate does not change |
| 12 | # AppArmor, setuid bits, user-manager configuration or cgroup delegation. |
| 13 | set -euo pipefail |
| 14 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" |
| 15 | cd "$ROOT" |
| 16 | step="${1:?usage: tests/gates/run.sh <step>}" |
| 17 | obs() { printf 'AIEN-OBS %s %s\n' "$1" "$2"; } |
| 18 | need_protocols() { |
| 19 | if [ ! -d ../aien-protocols/crates ]; then |
| 20 | echo "run.sh: ../aien-protocols is missing; the hosted job checks out aien-dev/aien-protocols as a sibling" >&2 |
| 21 | exit 3 |
| 22 | fi |
| 23 | obs sibling_protocols_commit "\"$(git -C ../aien-protocols rev-parse HEAD 2>/dev/null || echo unknown)\"" |
| 24 | } |
| 25 | |
| 26 | case "$step" in |
| 27 | # crumb-verify (gate CRUMB-VERIFY) is retired (DRA-97, 2026-11-07): Crumbs are off the active |
| 28 | # workflow, so no gate checks crumb freshness. The .crumb files stay as history. |
| 29 | fmt) |
| 30 | need_protocols |
| 31 | cargo fmt --all -- --check |
| 32 | ;; |
| 33 | check) |
| 34 | need_protocols |
| 35 | cargo check --offline --locked -j2 --all-targets |
| 36 | ;; |
| 37 | test) |
| 38 | need_protocols |
| 39 | obs bwrap_present "$(command -v bwrap >/dev/null && echo true || echo false)" |
| 40 | obs apparmor_restrict_userns "\"$(sysctl -n kernel.apparmor_restrict_unprivileged_userns 2>/dev/null || echo unknown)\"" |
| 41 | obs bwrap_setuid "$( [ -u /usr/bin/bwrap ] && echo true || echo false)" |
| 42 | # Build a local fixture executable, never a shared candidate artifact cache. |
| 43 | env -u CARGO_TARGET_DIR cargo build --offline --locked --release -j2 |
| 44 | obs prepopulate_rc 0 |
| 45 | # Keep the in-tree binary location expected by the judge unit tests. |
| 46 | # prepopulate_rc is the existing gate observation for this fixture build. |
| 47 | # RSI_REQUIRE_USER_SCOPE=1: the gate fails rather than reporting the sandbox tests NOT_RUN |
| 48 | # when no systemd user manager is reachable (src/not_run.rs). |
| 49 | env -u CARGO_TARGET_DIR CARGO_BUILD_JOBS=2 RSI_REQUIRE_USER_SCOPE=1 cargo test --offline --locked -j2 --verbose -- --test-threads=1 |
| 50 | ;; |
| 51 | zero-disk-secrets) |
| 52 | # Not a hosted step in this repository; the same invariant the sibling repos enforce. |
| 53 | echo "Auditing repository for prohibited plaintext secret files..." |
| 54 | if find . -maxdepth 4 -name ".env*" -not -path "*/.git/*" -not -path "*/target/*" | grep -q .; then |
| 55 | echo "::error::Prohibited plaintext .env file found. Use an approved AIEN SecretProvider." |
| 56 | obs env_files_found true |
| 57 | exit 1 |
| 58 | fi |
| 59 | obs env_files_found false |
| 60 | echo "Zero plaintext .env files verified." |
| 61 | ;; |
| 62 | *) |
| 63 | echo "run.sh: unknown step '$step'" >&2 |
| 64 | exit 2 |
| 65 | ;; |
| 66 | esac |