omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tools / composition_gate.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # COMPOSITION-2 gate wrapper: refuses a dirty tree, builds and runs the gate |
| 18 | # against the committed source, stores the receipt under its content hash: |
| 19 | # evidence/COMPOSITION-2/<sha256-of-receipt>.json |
| 20 | # Extra arguments are passed to make (e.g. AIENOS_LOCK_REPO=...). |
| 21 | # --gpu (first argument): the GPU tier, both Skills executed on the GB10. |
| 22 | # Run it only while holding the quiet flag (~/workspace/.spark-quiet). |
| 23 | set -eu |
| 24 | bintarget=composition-gate-bin |
| 25 | if [ "${1:-}" = "--gpu" ]; then |
| 26 | bintarget=composition-gate-gpu-bin |
| 27 | shift |
| 28 | fi |
| 29 | root=$(git rev-parse --show-toplevel) |
| 30 | cd "$root" |
| 31 | if [ -n "$(git status --porcelain --untracked-files=normal)" ]; then |
| 32 | echo "composition_gate: working tree is dirty; commit first" >&2 |
| 33 | git status --short >&2 |
| 34 | exit 2 |
| 35 | fi |
| 36 | commit=$(git rev-parse HEAD) |
| 37 | make "$@" "$bintarget" >/dev/null |
| 38 | bin=$(make -s "$@" "print-$bintarget") |
| 39 | tmp=$(mktemp /tmp/composition_gate_receipt.XXXXXX) |
| 40 | set +e |
| 41 | "./$bin" "$commit" "$tmp" |
| 42 | status=$? |
| 43 | set -e |
| 44 | if [ ! -s "$tmp" ]; then |
| 45 | echo "composition_gate: no receipt written (exit $status)" >&2 |
| 46 | rm -f "$tmp" |
| 47 | exit 2 |
| 48 | fi |
| 49 | sum=$(sha256sum "$tmp" | cut -d' ' -f1) |
| 50 | mkdir -p evidence/COMPOSITION-2 |
| 51 | out="evidence/COMPOSITION-2/$sum.json" |
| 52 | mv "$tmp" "$out" |
| 53 | chmod 0644 "$out" |
| 54 | verdict=$(sed -n 's/.*"verdict": "\([A-Z]*\)".*/\1/p' "$out" | head -n 1) |
| 55 | echo "receipt: $out" |
| 56 | echo "verdict: $verdict (commit $commit)" |
| 57 | exit $status |