synapse
A component of the AienOS ecosystem.
Brought by drakestapleton
synapse / tests / gates / run.sh
| 1 | #!/usr/bin/env bash |
| 2 | # tests/gates/run.sh: the one entry point for the local verification gates of synapse. |
| 3 | # Every step runs the SAME command as the hosted job it mirrors (.github/workflows/portable.yml, |
| 4 | # matrix gate workspace|conformance: `bash scripts/ci/portable.sh <gate>`). Manifests under tests/gates/ name this script plus one step word, so no |
| 5 | # manifest needs shell expansion (ADR 0028 P6). Observations print as "AIEN-OBS <name> <json>". |
| 6 | # |
| 7 | # Sibling checkout: the hosted conformance job checks out aien-spark/aien-architecture at the pin |
| 8 | # below as .ci-architecture. Here the worker provides ../aien-architecture (main, read-only); this |
| 9 | # script makes a local clone of it at the pin in a temp dir (no network), so the pinned checkout |
| 10 | # portable.sh insists on (HEAD == pin) exists without touching the sibling. |
| 11 | set -euo pipefail |
| 12 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" |
| 13 | cd "$ROOT" |
| 14 | step="${1:?usage: tests/gates/run.sh <step>}" |
| 15 | obs() { printf 'AIEN-OBS %s %s\n' "$1" "$2"; } |
| 16 | ARCH_PIN=29780e56c9e6b9111d884e0d4b146737228c19f6 |
| 17 | tmp=$(mktemp -d) |
| 18 | trap 'rm -rf "$tmp"' EXIT |
| 19 | # Evidence goes outside the tree (hosted: target/ci-evidence, uploaded as an artifact). |
| 20 | export CI_EVIDENCE_DIR="$tmp/ci-evidence" |
| 21 | export CARGO_TERM_COLOR=never |
| 22 | |
| 23 | need_sibling() { |
| 24 | local name="$1" |
| 25 | if [ ! -d "../$name" ]; then |
| 26 | echo "run.sh: ../$name is missing; the hosted job checks out aien-spark/$name as a sibling" >&2 |
| 27 | exit 3 |
| 28 | fi |
| 29 | obs "sibling_${name//-/_}_commit" "\"$(git -C "../$name" rev-parse HEAD 2>/dev/null || echo unknown)\"" |
| 30 | } |
| 31 | |
| 32 | case "$step" in |
| 33 | # crumb-verify (gate CRUMB-VERIFY) is retired (DRA-97, 2026-11-07): Crumbs are off the active |
| 34 | # workflow, so no gate checks crumb freshness. The .crumb file and crumb.lock stay as history. |
| 35 | workspace) |
| 36 | bash scripts/ci/portable.sh workspace |
| 37 | ;; |
| 38 | conformance) |
| 39 | need_sibling aien-architecture |
| 40 | git clone -q --no-checkout ../aien-architecture "$tmp/arch" |
| 41 | git -C "$tmp/arch" checkout -q --detach "$ARCH_PIN" |
| 42 | obs architecture_pin "\"$ARCH_PIN\"" |
| 43 | AIEN_ARCHITECTURE_REPO="$tmp/arch" bash scripts/ci/portable.sh conformance |
| 44 | ;; |
| 45 | zero-disk-secrets) |
| 46 | # Not a hosted step in this repository; the same invariant the Rust repos enforce. |
| 47 | echo "Auditing repository for prohibited plaintext secret files..." |
| 48 | if find . -maxdepth 4 -name ".env*" -not -path "*/.git/*" -not -path "*/target/*" | grep -q .; then |
| 49 | echo "::error::Prohibited plaintext .env file found. Use an approved AIEN SecretProvider." |
| 50 | obs env_files_found true |
| 51 | exit 1 |
| 52 | fi |
| 53 | obs env_files_found false |
| 54 | echo "Zero plaintext .env files verified." |
| 55 | ;; |
| 56 | *) |
| 57 | echo "run.sh: unknown step '$step'" >&2 |
| 58 | exit 2 |
| 59 | ;; |
| 60 | esac |