interplane.Get Omega
Read in your language

sovereign-intelligence

Front door to Drake Stapleton's sovereign stack.

Brought by drakestapleton

branch main Branches Tags History

sovereign-intelligence / evidence / x86-native / stale-pins.sh

53 lines · 3041 bytes Raw Blame History
1#!/bin/sh
2# evidence/x86-native/stale-pins.sh QUALIFY_JSONL OMEGA_MV
3#
4# Explains each FAIL row "compiler stdout differs from oracle sha:X" or "... oracle file:F", an emit
5# row: the AArch64 compiler's output for the row's exact source must have sha256 X (or equal F as
6# committed at omega-mv 6fbc6cbe). For every such row it recompiles that source with
7# - each AArch64 omc omega-mv committed (seed/out/omc) from 62d1d0d6, the compiler of the
8# 2026-10-30 x86 receipt, to 6fbc6cbe, newest first, until one reproduces the pin; and
9# - this repository's out/omc, the compiler under test,
10# and prints one TSV line: the case, the pin, the newest omega-mv commit whose omc reproduces it
11# (and that omc's sha256), our omc's sha256, the sha256 the oracle observed, and a verdict:
12# STALE_PIN when an earlier committed omc reproduces the pin and ours reproduces what the oracle saw,
13# else UNEXPLAINED. A STALE_PIN row pins AArch64 bytes of an older omc; omc's AArch64 code for that
14# source has changed since, so the row fails on any host. Exit 1 if any row is UNEXPLAINED.
15set -eu
16[ $# -eq 2 ] || { echo "usage: sh evidence/x86-native/stale-pins.sh QUALIFY_JSONL OMEGA_MV" >&2; exit 2; }
17R=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
18J=$1 MV=$2
19MV_REV=6fbc6cbe4bfa4092608e2b5f06d2e8f537893992
20OLDEST=62d1d0d668f897386a0e311374f8dbcc5c32dde8
21T=$(mktemp -d)
22trap 'rm -rf "$T"' EXIT
23sha() { sha256sum | cut -c1-64; }
24{ git -C "$MV" log --format=%H "$OLDEST..$MV_REV" -- seed/out/omc; echo "$OLDEST"; } > "$T/commits"
25while read -r c; do
26 git -C "$MV" show "$c:seed/out/omc" > "$T/omc-$c"
27 chmod +x "$T/omc-$c"
28done < "$T/commits"
29printf 'case\tpin\tpin_sha256\treproduced_by_commit\treproduced_by_omc_sha256\tnew_sha256\tobserved_sha256\tverdict\n'
30: > "$T/verdicts"
31jq -r 'select(.status? == "FAIL" and (.reason | test("^compiler stdout differs from oracle (sha|file):")))
32 | [.case, .evidence.source_spec, (.reason | capture("^compiler stdout differs from oracle (?<p>[^ ]+): bytes=[0-9]+ sha256=(?<o>[0-9a-f]{64})") | .p, .o)] | @tsv' "$J" |
33while IFS="$(printf '\t')" read -r name spec pin observed; do
34 case $spec in
35 pack:*:*:*) rest=${spec#pack:}; len=${rest##*:}; rest=${rest%:*}; off=${rest##*:}; file=${rest%:*}
36 git -C "$MV" show "$MV_REV:$file" | tail -c +"$((off + 1))" | head -c "$len" > "$T/src" ;;
37 *) git -C "$MV" show "$MV_REV:$spec" > "$T/src" ;;
38 esac
39 case $pin in
40 sha:*) want=${pin#sha:} ;;
41 file:*) want=$(git -C "$MV" show "$MV_REV:${pin#file:}" | sha) ;;
42 esac
43 by=- bysha=-
44 while read -r c; do
45 if [ "$("$T/omc-$c" < "$T/src" 2> /dev/null | sha)" = "$want" ]; then by=$c bysha=$(sha < "$T/omc-$c"); break; fi
46 done < "$T/commits"
47 new=$("$R/out/omc" < "$T/src" 2> /dev/null | sha)
48 verdict=UNEXPLAINED
49 [ "$by" != - ] && [ "$new" = "$observed" ] && verdict=STALE_PIN
50 echo "$verdict" >> "$T/verdicts"
51 printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "$name" "$pin" "$want" "$by" "$bysha" "$new" "$observed" "$verdict"
52done
53! grep -q UNEXPLAINED "$T/verdicts"