Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/synapse/blob/main/scripts/run_gate4_qualification.sh # synapse A component of the AienOS ecosystem. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `synapse / scripts / run_gate4_qualification.sh` 100 lines ยท 4126 bytes Raw Blame History 1 #!/usr/bin/env bash 2 set -euo pipefail 3 4 # Gate 4 comparative qualification run for Synapse (aien-sovereign-core#515). 5 # 6 # Builds the synapse-bench harness, then measures Synapse changeset ingest and 7 # checkout-free queries against Git worktree and Git plumbing workflows on a pinned 8 # commit of a real repository, runs the WAL, Git, and Radicle conformance suites, 9 # and writes evidence/gate4-qualification/ (report.json, manifest.json, 10 # traces/*.jsonl, SHA256SUMS). 11 # 12 # The fixture repository is only read: the harness clones it once with 13 # --no-checkout --no-hardlinks into a temporary work directory and records a digest 14 # of its refs before and after the run. 15 # 16 # Environment overrides: 17 # FIXTURE_REPO real repository to clone (default ~/workspace/aien-sovereign-core) 18 # FIXTURE_REV pinned commit (default: the Gate 0 baseline commit) 19 # OUT_DIR evidence directory (default /evidence/gate4-qualification) 20 # WORK_PARENT parent of the temporary work directory (default ${TMPDIR:-/tmp}) 21 # REPS, TIERS, ARMS, SEED override run dimensions (see synapse-bench docs) 22 # RADICLE_REPO bare Radicle storage repo for the live conformance case; unset uses 23 # the aien-sovereign-core storage repo when present, empty disables 24 # SMOKE=1 tiny end-to-end run for checking the harness 25 26 REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" 27 FIXTURE_REPO="${FIXTURE_REPO:-$HOME/workspace/aien-sovereign-core}" 28 FIXTURE_REV="${FIXTURE_REV:-`1b6e340d48417dfbcfe2df56d48a0696a3a9b250`}" 29 OUT_DIR="${OUT_DIR:-$REPO_ROOT/evidence/gate4-qualification}" 30 WORK_PARENT="${WORK_PARENT:-${TMPDIR:-/tmp}}" 31 SMOKE="${SMOKE:-0}" 32 DEFAULT_RADICLE_REPO="$HOME/.radicle/storage/`z2kdkm8HpiyFbMFpFmzzWZQgTn1EQ`" 33 if [ -z "${RADICLE_REPO+set}" ]; then 34 if [ -d "$DEFAULT_RADICLE_REPO" ]; then 35 RADICLE_REPO="$DEFAULT_RADICLE_REPO" 36 else 37 RADICLE_REPO="" 38 fi 39 fi 40 41 started=$(date +%s) 42 echo "== free disk at $WORK_PARENT" 43 df -h "$WORK_PARENT" 44 45 echo "== building synapse-bench (release)" 46 (cd "$REPO_ROOT" && cargo build --release -p synapse-bench --offline) 47 # CARGO_TARGET_DIR, when set, is where cargo put the binary (relative to REPO_ROOT, where it ran). 48 TD=${CARGO_TARGET_DIR:-target}; case $TD in /*) ;; *) TD="$REPO_ROOT/$TD" ;; esac 49 BIN="$TD/release/synapse-bench" 50 51 # Identity of the harness source that produced the evidence. 52 SOURCE_REV="$(git -C "$REPO_ROOT" rev-parse HEAD)" 53 if [ -n "$(git -C "$REPO_ROOT" status --porcelain -- crates Cargo.toml Cargo.lock scripts)" ]; then 54 SOURCE_DIRTY="dirty" 55 else 56 SOURCE_DIRTY="clean" 57 fi 58 SOURCE_DIGEST="$(cd "$REPO_ROOT" \ 59 && git ls-files -z -co --exclude-standard -- crates Cargo.toml Cargo.lock scripts \ 60 | LC_ALL=C sort -z | xargs -0 sha256sum | sha256sum | cut -d' ' -f1)" 61 62 WORK_DIR="$(mktemp -d "$WORK_PARENT/synapse-gate4.XXXXXX")" 63 cleanup() { rm -rf "$WORK_DIR"; } 64 trap cleanup EXIT 65 66 # Replace only the files this script produces. 67 mkdir -p "$OUT_DIR" 68 rm -rf "$OUT_DIR/traces" 69 rm -f "$OUT_DIR/report.json" "$OUT_DIR/manifest.json" "$OUT_DIR/SHA256SUMS" 70 71 args=(run 72 --fixture-repo "$FIXTURE_REPO" 73 --fixture-rev "$FIXTURE_REV" 74 --out "$OUT_DIR" 75 --work-dir "$WORK_DIR" 76 --source-rev "$SOURCE_REV" 77 --source-dirty "$SOURCE_DIRTY" 78 --source-digest "$SOURCE_DIGEST") 79 [ -n "${REPS:-}" ] && args+=(--reps "$REPS") 80 [ -n "${TIERS:-}" ] && args+=(--tiers "$TIERS") 81 [ -n "${ARMS:-}" ] && args+=(--arms "$ARMS") 82 [ -n "${SEED:-}" ] && args+=(--seed "$SEED") 83 [ -n "$RADICLE_REPO" ] && args+=(--radicle-repo "$RADICLE_REPO") 84 [ "$SMOKE" = "1" ] && args+=(--smoke) 85 86 echo "== running qualification (work dir $WORK_DIR)" 87 "$BIN" "${args[@]}" 88 89 # Keep raw traces reasonably sized: compress them when they exceed 20 MiB. 90 trace_bytes="$(du -sb "$OUT_DIR/traces" | cut -f1)" 91 if [ "$trace_bytes" -gt $((20 * 1024 * 1024)) ]; then 92 echo "== traces total $trace_bytes bytes; compressing with gzip -n" 93 gzip -n -9 "$OUT_DIR"/traces/*.jsonl 94 fi 95 96 (cd "$OUT_DIR" && find . -type f ! -name SHA256SUMS -printf '%P\n' | LC_ALL=C sort \ 97 | xargs -d '\n' sha256sum > SHA256SUMS) 98 99 finished=$(date +%s) 100 echo "== done in $((finished - started)) s; evidence in $OUT_DIR"