Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/calibration/scripts/make_dataset_manifest.sh # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / calibration / scripts / make_dataset_manifest.sh` 115 lines ยท 5502 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 # EXP-001 dataset manifest (turing.cal.dataset_manifest.v1): the evaluator's 18 # only description of the data it scores. See calibration/docs/EVALUATOR.md. 19 # 20 # make_dataset_manifest.sh --sealed SEALED_ROOT OUT.json 21 # SEALED_ROOT = / written by generate_sealed_data.sh 22 # (needs COMPLETE, seed_commitment.json, manifest.json). Every control trace is 23 # re-hashed and must equal the sealed manifest entry. 24 # make_dataset_manifest.sh --dev RUN_DIR "G1 SEEDS" "G2 SEEDS" PROFILE_SHA256 OUT.json 25 # Development data only (dry run): RUN_DIR/seed-/control/trace.ctr. 26 # split = development, released_utc = NOT_SEALED. Never evidence. 27 # 28 # One file entry per line (the evaluator parses line by line). payload_digest = 29 # SHA-256 over the LF-terminated lines " " in 30 # group then index order. 31 set -euo pipefail 32 die() { echo "make_dataset_manifest: $*" >&2; exit 2; } 33 sha() { sha256sum "$1" | cut -d' ' -f1; } 34 jstr() { grep -m1 "\"$1\":" "$2" | sed -E 's/.*"'"$1"'": *"([^"]*)".*/\1/'; } 35 36 mode="${1:-}" 37 case "$mode" in 38 --sealed) 39 [ $# = 3 ] || die "usage: --sealed SEALED_ROOT OUT.json" 40 root="${2%/}" out="$3" 41 [ -f "$root/COMPLETE" ] || die "$root/COMPLETE missing (generation incomplete)" 42 sc="$root/seed_commitment.json" sm="$root/manifest.json" 43 [ "$(sha "$sc")" = "$(tr -d ' \n' <"$root/COMPLETE")" ] || die "COMPLETE does not match seed_commitment.json" 44 [ "$(sha "$sm")" = "$(jstr manifest_sha256 "$sc")" ] || die "manifest.json does not match seed_commitment.json" 45 commit="$(jstr freeze_commit "$sc")" profile="$(jstr profile_digest "$sc")" 46 released="$(jstr started_utc "$sc")" finished="$(jstr finished_utc "$sc")" 47 gen="$(grep -m1 '"generator"' "$sc" | sed -E 's/.*"sha256": *"([0-9a-f]{64})".*/\1/')" 48 lrn="$(grep -m1 '"learner"' "$sc" | sed -E 's/.*"sha256": *"([0-9a-f]{64})".*/\1/')" 49 split=sealed_test dsid="${EXP_ID:-EXP-001}-sealed-$commit" scsha="$(sha "$sc")" smsha="$(sha "$sm")" 50 rows=() 51 while IFS= read -r l; do 52 g="$(sed -E 's/.*"group": *([0-9]+).*/\1/' <<<"$l")" 53 j="$(sed -E 's/.*"index": *([0-9]+).*/\1/' <<<"$l")" 54 s="$(sed -E 's/.*"seed": *([0-9]+).*/\1/' <<<"$l")" 55 rel="group-$g/seed-$s/control/trace.ctr" 56 f="$root/$rel" 57 [ -f "$f" ] || die "missing $rel" 58 h="$(sha "$f")" b="$(stat -c %s "$f")" 59 grep -q "\"path\": \"$rel\", \"sha256\": \"$h\", \"bytes\": $b," "$sm" || die "$rel differs from the sealed manifest" 60 rows+=("$g $j $s $h $b $f") 61 done < <(grep '"group":.*"index":.*"seed":' "$sc") 62 ;; 63 --dev) 64 [ $# = 6 ] || die "usage: --dev RUN_DIR \"G1 SEEDS\" \"G2 SEEDS\" PROFILE_SHA256 OUT.json" 65 run="${2%/}" profile="$5" out="$6" 66 [[ "$profile" =~ ^[0-9a-f]{64}$ ]] || die "bad profile sha256" 67 commit=NONE released=NOT_SEALED finished=NOT_SEALED gen=NOT_RECORDED lrn=NOT_RECORDED 68 split=development dsid="${EXP_ID:-EXP-001}-dev-$(basename "$run")" scsha=NONE smsha=NONE 69 rows=() 70 for g in 1 2; do 71 j=0 72 seeds="$3"; [ "$g" = 2 ] && seeds="$4" 73 for s in $seeds; do 74 f="$run/seed-$s/control/trace.ctr" 75 [ -f "$f" ] || die "missing $f" 76 rows+=("$g $j $s $(sha "$f") $(stat -c %s "$f") $f") 77 j=$((j + 1)) 78 done 79 done 80 ;; 81 *) die "usage: --sealed SEALED_ROOT OUT.json | --dev RUN_DIR \"G1 SEEDS\" \"G2 SEEDS\" PROFILE_SHA256 OUT.json" ;; 82 esac 83 84 [ "${#rows[@]}" -gt 0 ] || die "no files" 85 payload="$(for r in "${rows[@]}"; do read -r g j s h b _ <<<"$r"; echo "$g $j $s $h $b"; done | sha256sum | cut -d' ' -f1)" 86 { 87 echo "{" 88 echo " \"schema\": \"turing.cal.dataset_manifest.v1\"," 89 echo " \"dataset_id\": \"$dsid\"," 90 echo " \"experiment\": \"${EXP_ID:-EXP-001}\"," 91 echo " \"split\": \"$split\"," 92 echo " \"profile_digest\": \"$profile\"," 93 echo " \"freeze_commit\": \"$commit\"," 94 echo " \"generator_digest\": \"$gen\"," 95 echo " \"learner_digest\": \"$lrn\"," 96 echo " \"parameter_commitment\": \"crumbs experiment --learner L --seed S --out DIR, control arm\"," 97 echo " \"seed_commitment_sha256\": \"$scsha\"," 98 echo " \"sealed_manifest_sha256\": \"$smsha\"," 99 echo " \"released_utc\": \"$released\"," 100 echo " \"generation_finished_utc\": \"$finished\"," 101 echo " \"trajectory_count\": ${#rows[@]}," 102 echo " \"payload_digest\": \"$payload\"," 103 echo " \"files\": [" 104 n=0 105 for r in "${rows[@]}"; do 106 read -r g j s h b f <<<"$r" 107 [ "$n" = 0 ] || echo "," 108 printf ' {"group": %s, "index": %s, "seed": %s, "sha256": "%s", "bytes": %s, "path": "%s"}' "$g" "$j" "$s" "$h" "$b" "$f" 109 n=$((n + 1)) 110 done 111 echo 112 echo " ]" 113 echo "}" 114 } >"$out" 115 echo "dataset manifest: $out ($split, ${#rows[@]} files, payload $payload)"