interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / calibration / scripts / record_void.sh

57 lines · 3142 bytes Raw Blame History
1#!/usr/bin/env bash
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# record_void.sh: record a VOID attempt of EXP-001 that no tool records by itself: a failed build or test of the
18# frozen tree at BLINDING_PROTOCOL.md step 7 (stage "tests"). It writes the next void receipt in the one EXP-001
19# counter ($TC_EVAL_ROOT/<C_f>/run/bundle, tc_void_lib.sh) and, on the third void of the experiment, the
20# INCONCLUSIVE (INFRA) final receipt.
21#
22# record_void.sh --commit C_F --step STEP --code CODE --reason TEXT --command TEXT [--repo DIR]
23#
24# The profile digest and candidate manifest digest are read from C_f through git. A retry of step 7 must repeat
25# the command of the first "tests" void byte for byte; record_void.sh refuses a different one. Refuses (exit 2,
26# nothing written) when EXP-001 has already ended.
27set -euo pipefail
28here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
29# shellcheck source=tc_void_lib.sh
30. "$here/tc_void_lib.sh"
31die() { echo "record_void: REFUSED: $*" >&2; exit 2; }
32repo="$(git -C "$here" rev-parse --show-toplevel)"
33. "$here/tc_exp.sh"
34cf="" step="" code="" reason="" command=""
35while [ $# -gt 0 ]; do
36 case "$1" in
37 --commit) cf="$2"; shift 2 ;;
38 --step) step="$2"; shift 2 ;;
39 --code) code="$2"; shift 2 ;;
40 --reason) reason="$2"; shift 2 ;;
41 --command) command="$2"; shift 2 ;;
42 --repo) repo="$2"; shift 2 ;;
43 *) die "unknown option '$1'" ;;
44 esac
45done
46[[ "$cf" =~ ^[0-9a-f]{40}$ ]] || die "--commit must be the 40-hex freeze commit C_f"
47[ -n "$step" ] && [ -n "$code" ] && [ -n "$reason" ] && [ -n "$command" ] || die "--step --code --reason --command are required"
48pd="$(git -C "$repo" show "$cf:$EXP_PROFILE" 2>/dev/null | sha256sum | cut -c1-64)"
49cm="$(git -C "$repo" show "$cf:$EXP_DIR/candidate_manifest.json" 2>/dev/null | sha256sum | cut -c1-64)"
50git -C "$repo" cat-file -e "$cf:$EXP_DIR/candidate_manifest.json" 2>/dev/null || die "no candidate manifest at $cf"
51dir="$(tc_void_dir "$cf")"
52tc_void_ended "$dir" && die "$EXP_ID has ended ($dir holds a final receipt or three void receipts)"
53first="$(tc_void_first_command "$dir" tests)"
54[ -z "$first" ] || [ "$first" = "$(tc_jclean "$command")" ] || die "retry differs from the first tests void ($first)"
55n="$(tc_void_write "$cf" tests "$step" "$code" "$reason" "$command" "frozen tree $cf" "$pd" "$cm")"
56echo "record_void: void attempt $n of $EXP_ID written to $dir/void_receipt_$n.json" >&2
57[ "$n" -lt "$TC_MAX_ATTEMPTS" ] || echo "record_void: third void attempt: $EXP_ID is INCONCLUSIVE (INFRA), final_receipt.json written" >&2