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 / research / atemporal / at0 / integration / candidate_run.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 | # AT-0 Agent 5: run ONE case end to end and write one complete AT0_RESULT_V2 file to stdout. |
| 18 | # sh candidate_run.sh <case-file> |
| 19 | # model -> engine component output; oracle -> record (only its `reference` lines are used); |
| 20 | # at0-assemble -> full result (exact judge, verdict_id, provenance, evidence_digest). |
| 21 | # Exit 0 result written; 2 case refused (AT0_CASE_REFUSED <code> on stderr, nothing on stdout); |
| 22 | # 1 any other failure. Environment (all set by run.sh): |
| 23 | # AT0_MODEL_BIN AT0_ORACLE_BIN AT0_ASM_BIN executables |
| 24 | # AT0_PROV_STATIC file with the fixed provenance lines (source_repo .. host) |
| 25 | # AT0_COMP_DIR optional: keep the component outputs here (<case>.engine, <case>.oracle) |
| 26 | # AT0_CC_NOTE optional text appended to build_cc (marks a mutant control run) |
| 27 | set -u |
| 28 | case_file=${1:?usage: candidate_run.sh <case-file>} |
| 29 | : "${AT0_MODEL_BIN:?}" "${AT0_ORACLE_BIN:?}" "${AT0_ASM_BIN:?}" "${AT0_PROV_STATIC:?}" |
| 30 | tmp=$(mktemp -d "${TMPDIR:-/tmp}/at0cr.XXXXXX") || exit 1 |
| 31 | trap 'rm -rf "$tmp"' EXIT |
| 32 | name=$(basename "$case_file" .case) |
| 33 | started=$(date -u +%Y-%m-%dT%H:%M:%SZ) |
| 34 | "$AT0_MODEL_BIN" "$case_file" > "$tmp/engine" 2> "$tmp/engine.err"; rc=$? |
| 35 | if [ $rc -eq 2 ]; then cat "$tmp/engine.err" >&2; exit 2; fi |
| 36 | if [ $rc -ne 0 ]; then echo "model failed rc=$rc: $(head -1 "$tmp/engine.err")" >&2; exit 1; fi |
| 37 | "$AT0_ORACLE_BIN" emit "$case_file" -o "$tmp/oracle" 2> "$tmp/oracle.err"; rc=$? |
| 38 | if [ $rc -ne 0 ]; then echo "oracle failed rc=$rc on a case the model accepted: $(head -1 "$tmp/oracle.err")" >&2; exit 1; fi |
| 39 | finished=$(date -u +%Y-%m-%dT%H:%M:%SZ) |
| 40 | { |
| 41 | if [ -n "${AT0_CC_NOTE:-}" ]; then |
| 42 | sed "s|^build_cc \(.*\)\$|build_cc \1 ${AT0_CC_NOTE}|" "$AT0_PROV_STATIC" |
| 43 | else cat "$AT0_PROV_STATIC"; fi |
| 44 | echo "run_started_utc $started" |
| 45 | echo "run_finished_utc $finished" |
| 46 | } > "$tmp/prov" |
| 47 | "$AT0_ASM_BIN" assemble "$case_file" "$tmp/engine" "$tmp/oracle" "$tmp/prov" > "$tmp/result" 2> "$tmp/asm.err"; rc=$? |
| 48 | cat "$tmp/asm.err" >&2 |
| 49 | if [ $rc -ne 0 ]; then exit 1; fi |
| 50 | if [ -n "${AT0_COMP_DIR:-}" ]; then mkdir -p "$AT0_COMP_DIR"; cp "$tmp/engine" "$AT0_COMP_DIR/$name.engine"; cp "$tmp/oracle" "$AT0_COMP_DIR/$name.oracle"; fi |
| 51 | cat "$tmp/result" |