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 / runtime_digest.sh

61 lines · 3799 bytes Raw Blame History
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# runtime_digest.sh: the runtime_digest of Turing-profile-v1.0 (rule turing.cal.runtime.v1).
18#
19# sh calibration/scripts/runtime_digest.sh [--lines]
20#
21# The evaluator runtime is exactly these seven binaries, built from the tree that becomes the freeze commit C_f
22# (the same tree: C_f only adds the frozen manifest, profile value and sidecar, none of which is compiled in; the crumbs binary is
23# prebuilt and pinned, never rebuilt):
24# crumbline-learner build/crumbline-learner (make crumbline-learner)
25# crumbs ~/workspace/hive-worktrees/crumbs-v1/target/release/crumbs (or $TC_CRUMBS)
26# turing-cal-candidates build/turing-exp001-a/turing-cal-candidates (make turing-exp001-a-build)
27# turing-cal-overlap build/turing-cal/turing-cal-overlap (make turing-cal-overlap)
28# turing-coder build/tests-turing-exp001-b/turing-coder (make turing-coder)
29# turing-cal-eval build/turing-exp001-eval/turing-cal-eval (make turing-cal-eval)
30# turing-verify-indep build/turing-verify-indep/indep-scorer (make turing-verify-indep; lane D
31# independent scorer, tools/turing_verify_indep, never links omega src/)
32# Listing = one line per binary, '<sha256 of the file, 64 lowercase hex> <name>' + LF, sorted by name
33# (byte order), exactly as above. runtime_digest = SHA-256 of the listing bytes, 64 lowercase hex.
34# --lines prints the listing instead of the digest. Refuses if any binary is missing, or if crumbs or the
35# learner differ from the pins in calibration/scripts/generate_sealed_data.sh.
36# Computed at freeze time only; the value goes into the profile before the sidecar is written.
37# No Python: POSIX sh + sha256sum + sort.
38set -eu
39dir=$(cd "$(dirname "$0")/../.." && pwd)
40out="${OUT_DIR:-$dir/build}"
41crumbs="${TC_CRUMBS:-$HOME/workspace/hive-worktrees/crumbs-v1/target/release/crumbs}"
42die() { echo "runtime_digest: REFUSED: $*" >&2; exit 1; }
43pin() { grep "^$1=" "$dir/calibration/scripts/generate_sealed_data.sh" | head -1 | grep -o "[0-9a-f]\{64\}"; }
44sha() { sha256sum "$1" | cut -c1-64; }
45list=$(
46 for pair in "crumbline-learner:$out/crumbline-learner" "crumbs:$crumbs" \
47 "turing-cal-candidates:$out/turing-exp001-a/turing-cal-candidates" \
48 "turing-cal-overlap:$out/turing-cal/turing-cal-overlap" \
49 "turing-coder:$out/tests-turing-exp001-b/turing-coder" \
50 "turing-cal-eval:$out/turing-exp001-eval/turing-cal-eval" \
51 "turing-verify-indep:$out/turing-verify-indep/indep-scorer"; do
52 n=${pair%%:*}; p=${pair#*:}
53 [ -f "$p" ] || die "$n missing at $p"
54 printf '%s %s\n' "$(sha "$p")" "$n"
55 done | LC_ALL=C sort -k2
56)
57cs=$(printf '%s\n' "$list" | sed -n 's/ crumbs$//p')
58ls_=$(printf '%s\n' "$list" | sed -n 's/ crumbline-learner$//p')
59[ "$cs" = "$(pin CRUMBS_SHA256)" ] || die "crumbs $cs != pinned $(pin CRUMBS_SHA256)"
60[ "$ls_" = "$(pin LEARNER_SHA256)" ] || die "learner $ls_ != pinned $(pin LEARNER_SHA256)"
61if [ "${1:-}" = "--lines" ]; then printf '%s\n' "$list"; else printf '%s\n' "$list" | sha256sum | cut -c1-64; fi