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/patches/fa7b6a25f1a8405c # 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 ## GitHub aien-dev/omega-mv#172 (code only) closed derived `fa7b6a25f1a8405c` #172 Imported from GitHub aien-dev/omega-mv#172 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `9ca297c6d377f41148bc366631b2b3891a445ceb` · Head `244b64c03b355a16ea3219bb2eb28bca766296cc` ### Apply it ``` git checkout -b patch-fa7b6a25f1a8405c 9ca297c6d377f41148bc366631b2b3891a445ceb curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/fa7b6a25f1a8405c.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/omega-mv 172 244b64c03b355a16ea3219bb2eb28bca766296cc ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":172,"url":"https://github.com/aien-dev/omega-mv/pull/172","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:37Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.github/workflows/host-suites-2.yml b/.github/workflows/host-suites-2.yml index f45ebab02..415cce278 100644 --- a/.github/workflows/host-suites-2.yml +++ b/.github/workflows/host-suites-2.yml @@ -23,7 +23,7 @@ name: Host suites 2 # test-ma-digital-bottom 3.5 min # path : test-path 30 s; crumbline : test-crumbline 1 s # runtime : test-r15-instr test-r15-receipt test-r16-inventory -# test-r16-negative test-r16-surface +# test-r16-negative test-r16-surface test-r16-qualify-selftest # test-r16-negative-mutants 5 min (Spark: 4.3 min) # argus : test-argus-runtime test-machine-identity-argus # numeric2 : test-numeric-reduce-cpu test-divsqrt-host 6 s @@ -326,6 +326,9 @@ jobs: PHYSICS_DIR: ${{ github.workspace }}/physics-src AIENOS_R7_DIR: ${{ github.workspace }}/aienos-src run: make test-r16-negative-mutants + - name: R16 qualify script self-test (dirty tree refused, NOT_RUN honest, failing check exits non-zero) + if: ${{ !cancelled() }} + run: make test-r16-qualify-selftest argus: needs: changes diff --git a/Makefile b/Makefile index 25a2da753..7100cca04 100644 --- a/Makefile +++ b/Makefile @@ -762,6 +762,11 @@ r16-inventory: $(R16_INVENTORY) test-r16-inventory: $(R16_INVENTORY) sh tests/r16_inventory/run.sh $(R16_INVENTORY) +# Lane 32 follow-up: dry-mode self-test of tools/r16_qualify.sh (no chip, no build). +.PHONY: test-r16-qualify-selftest +test-r16-qualify-selftest: + bash tests/r16_qualify/run.sh + # R16-G3: the authoritative path with the legacy orchestrators unavailable. # Link map, shared libraries, embedded names and an exec trace of the R13 # living system and the R14 recovery run, legacy programs stubbed on PATH. diff --git a/spec/r16-orchestrator-retirement-map.md b/spec/r16-orchestrator-retirement-map.md index e9b8518e2..156a5681e 100644 --- a/spec/r16-orchestrator-retirement-map.md +++ b/spec/r16-orchestrator-retirement-map.md @@ -250,6 +250,54 @@ any production binary); in-file Rust `#[cfg(test)]` modules likewise. | OM-149 | omega | `tools/omegatool.c` | 3811 | `main` | surface-check resolver (R16-G5) | reference mode dry run | D | false | `--reference-dispatch-dry-run ` resolves a mode through the real dispatch and runs nothing; used only by tests/r16_surface/run.sh | `if (strcmp(argv[1], "--reference-dispatch-dry-run") == 0) {` | | OM-150 | omega | `tests/runtime/rx_r16_negative.c` | 625 | `main` | test/benchmark loop (for:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary (R16-G4 waits for one honest production request) | `for (int i = 0; i < 50 && r->served == served0; i++) nanosleep(&ts, NULL);` | | OM-151 | omega | `tests/path/test_path_identity.c` | 281 | `realization_separation` | test/benchmark loop (for:body:schedule) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (unsigned field = 0; field < 5; field++) {` | +| OM-152 | omega | `src/compiler/model/osc_model_gen.c` | 282 | `teardown` | compiler test-model event generator | - | N | false | N: walk: drains the open borrows of one object by picking and ending them until none is left, without wait or hand-off; generates test events only | `for (;;) {` | +| OM-153 | omega | `src/compiler/osc_interp.c` | 142 | `run_func` | reference interpreter basic-block loop | reference / test path (non-authoritative) | D | false | reference interpreter of compiled OSC IR, used to check the compiler (src/compiler and tests only); runs one function's blocks, bounded by OSC_INTERP_MAX_STEPS; sequences no faculties | `for (;;) {` | +| OM-154 | omega | `src/compiler/osc_lex.c` | 66 | `osc_lex` | OSC lexer token loop | - | N | false | N: parse: lexer token loop without wait or hand-off | `for (;;) {` | +| OM-155 | omega | `src/compiler/osc_parse.c` | 463 | `parse_call` | call-argument parse loop | - | N | false | N: parse: call argument list parse loop without wait or hand-off | `for (;;) {` | +| OM-156 | omega | `src/compiler/osc_parse.c` | 608 | `parse_level` | binary-operator level parse loop | - | N | false | N: parse: precedence-level operator parse loop without wait or hand-off | `for (;;) {` | +| OM-157 | omega | `src/compiler/osc_parse.c` | 1049 | `parse_fn` | parameter list parse loop | - | N | false | N: parse: function parameter list parse loop without wait or hand-off | `for (;;) {` | +| OM-158 | omega | `src/compiler/oscc_main.c` | 33 | `main` | source file read in the oscc driver | - | N | false | N: read: file read into a growing buffer until end of file, without wait or hand-off | `for (;;) {` | +| OM-159 | omega | `src/estimation/est_mix.c` | 39 | `each_term` | multinomial composition enumeration | - | N | false | N: walk: enumerates the count vectors of a mixture term in odometer order, calling a callback per term, without wait or hand-off | `for (;;) {` | +| OM-160 | omega | `src/fabric/fab_dispatch.c` | 46 | `pump_locked` | in-process simulated-machine fabric pump | reference / test path (non-authoritative) | D | false | F5-0 in-process simulated-machine dispatcher, a test-build piece (carries aien_test_build_fab_dispatch; r16_prod_hygiene refuses it in production binaries); drains one node mailbox with fab_poll, decides no faculty order | `for (;;) {` | +| OM-161 | omega | `src/omega_numeric_reduce.c` | 133 | `cpu_sum_like` | CPU tile-reduction passes | - | N | false | N: arithmetic: repeated 32-wide tile reduction of a float buffer until one value is left, without wait or hand-off | `for (;;) {` | +| OM-162 | omega | `src/omega_numeric_reduce_gb10.c` | 459 | `omega_reduce_gb10` | GB10 reduction level loop | physical scheduler | E | false | GPU reduction launcher: launches the reduction kernel chunk by chunk and folds tile results level by level until one value is left; schedules physical GPU work, decides no faculty order, not on the reaction path | `for (;;) {` | +| OM-163 | omega | `src/runtime/aien_machine_id.c` | 54 | `aien_mid_load` | machine id file read | - | N | false | N: read: file read until end of file or one byte past a record, without wait or hand-off | `for (;;) { /* read one byte past a record so a longer file is caught */` | +| OM-164 | omega | `src/runtime/rx_compose.c` | 84 | `hold_point` | test hold point spin | reference / test path (non-authoritative) | D | false | hold point exists only under RXC_TEST_HOOKS (test builds); spins until the test releases it; no production path | `while (!__atomic_load_n(&c->test.release, __ATOMIC_ACQUIRE)) nanosleep(&ts, NULL);` | +| OM-165 | omega | `src/runtime/rx_compose.c` | 885 | `wait_own` | composition close drain wait | explicit maintenance mechanism | B | false | explicit operator close of an attached composition: waits (with timeout) until its own in-flight steps finish; drains, orders no faculty work | `while (own_busy(c)) {` | +| OM-166 | omega | `src/runtime/rx_compose.c` | 910 | `leave_world` | composition leave-world drain wait | explicit maintenance mechanism | B | false | explicit operator close of an attached composition: waits until its own revoked steps finish (no cutoff); drains, orders no faculty work | `while (own_busy(c)) nanosleep(&ts, NULL);` | +| OM-167 | omega | `src/runtime/rx_compose.c` | 925 | `leave_world` | composition leave-world reaction removal | explicit maintenance mechanism | B | false | explicit close step 5: walks the composition's own reactions (at most 4) to remove them from the World; orders no faculty work | `for (uint32_t i = 0; i < c->n_rx && i < 4; i++)` | +| OM-168 | omega | `src/runtime/rx_compose.c` | 926 | `leave_world` | composition leave-world BUSY retry | explicit maintenance mechanism | B | false | explicit close step 5: retries removal of one of its own reactions while a step is still finishing (RX_ERR_BUSY); orders no faculty work | `while (rx_world_remove_reaction(c->world, ids[i]) == RX_ERR_BUSY) nanosleep(&ts, NULL);` | +| OM-169 | omega | `src/runtime/rx_cortex.c` | 488 | `cx_provenance` | provenance link walk | - | N | false | N: walk: breadth-first walk of cortex object links with a seen check, without wait or hand-off | `for (;;) {` | +| OM-170 | omega | `src/searchtrace/st_holdout.c` | 612 | `read_file` | whole-file read | - | N | false | N: read: file read into a growing buffer until end of file, without wait or hand-off | `for (;;) {` | +| OM-171 | omega | `src/searchtrace/st_holdout.c` | 838 | `read_key_file` | key file read | - | N | false | N: read: key file read with EINTR retry until end of file, without wait or hand-off | `for (;;) {` | +| OM-172 | omega | `src/searchtrace/st_tool.c` | 22 | `read_file` | whole-file read | - | N | false | N: read: file read into a growing buffer until end of file, without wait or hand-off | `for (;;) {` | +| OM-173 | omega | `src/train/tg_store.c` | 568 | `tg_commit` | dispatch record append walk | - | N | false | N: walk: appends this step's optimizer dispatch records to the hash chain; the records are a training log, not faculty dispatch; no wait or hand-off | `for (uint32_t i = 0; i < sh->n_dispatch; i++) {` | +| OM-174 | omega | `src/train/tg_store.c` | 674 | `tg_verify_history` | generation history walk | - | N | false | N: walk: walks stored generations backward verifying the digest chain, without wait or hand-off | `for (;;) {` | +| OM-175 | omega | `tests/fabric/fab_living_phase.h` | 173 | `fl_pump_b` | test rig mailbox drain | reference / test path (non-authoritative) | D | false | fabric test rig: drains node B mailbox with fab_poll; test code, not built into any production binary | `while (fab_poll(&r->node_b, now, &v) == 1) {}` | +| OM-176 | omega | `tests/fabric/fabric_test.c` | 114 | `pump` | test pump rounds | reference / test path (non-authoritative) | D | false | fabric test: delivers pending messages in rounds, bounded at 64; test code, not built into any production binary | `for (int round = 0; round < 64 && fab_loop_pending(&h->loop); round++)` | +| OM-177 | omega | `tests/fabric/fabric_test.c` | 115 | `pump` | test pump node order | reference / test path (non-authoritative) | D | false | fabric test: visits the three test nodes in fixed order; test code, not built into any production binary | `for (int i = 0; i < 3; i++) {` | +| OM-178 | omega | `tests/fabric/fabric_test.c` | 117 | `pump` | test mailbox drain | reference / test path (non-authoritative) | D | false | fabric test: drains one node mailbox with fab_poll; test code, not built into any production binary | `while (fab_poll(&h->node[i], now, &v) == 1)` | +| OM-179 | omega | `tests/runtime/rx_compose_attach_test.c` | 229 | `rogue_refused` | test remove-reaction retry | reference / test path (non-authoritative) | D | false | composition attach test: retries reaction removal while BUSY; test code, not built into any production binary | `while (rx_world_remove_reaction(&g_w, rid) == RX_ERR_BUSY) sleep_us(1000);` | +| OM-180 | omega | `tests/runtime/rx_compose_attach_test.c` | 385 | `t_close_waits` | test wait for held step | reference / test path (non-authoritative) | D | false | composition attach test: sleep-polls until the held step is reported; test code, not built into any production binary | `while (!__atomic_load_n(&c->test.held, __ATOMIC_ACQUIRE) && waited++ < 10000) sleep_us(1000);` | +| OM-181 | omega | `tests/runtime/rx_compose_attach_test.c` | 388 | `t_close_waits` | test wait for settle | reference / test path (non-authoritative) | D | false | composition attach test: sleep-polls until one step is in flight; test code, not built into any production binary | `for (waited = 0; in_flight() != 1 && waited < 10000; waited++) sleep_us(1000);` | +| OM-182 | omega | `tests/runtime/rx_compose_attach_test.c` | 402 | `t_close_waits` | test wait for revoke | reference / test path (non-authoritative) | D | false | composition attach test: sleep-polls until the write right is revoked; test code, not built into any production binary | `for (waited = 0; waited < 5000 &&` | +| OM-183 | omega | `tests/runtime/rx_jspace_prod.c` | 598 | `test_world` | test race writers | reference / test path (non-authoritative) | D | false | J-Space production test: two racing writers; test code, not built into any production binary | `for (int k = 0; k < 2; k++) {` | +| OM-184 | omega | `tests/runtime/rx_jspace_prod.c` | 617 | `test_world` | test tick publisher | reference / test path (non-authoritative) | D | false | J-Space production test: publishes 40 external tick mutations; test code, not built into any production binary | `for (unsigned t = 1; t <= 40; t++) {` | +| OM-185 | omega | `tests/test_omega_transc.c` | 442 | `pool_worker` | test worker pool | reference / test path (non-authoritative) | D | false | numeric transcendental test: worker thread claims items by atomic counter until exhausted; test code, not built into any production binary | `for (;;) {` | +| OM-186 | omega | `tests/train/test_train.c` | 190 | `t_crash` | test crash matrix | reference / test path (non-authoritative) | D | false | training store test: crash-injection matrix; test code, not built into any production binary | `for (int torn = 0; torn < 2; torn++)` | +| OM-187 | omega | `tests/train/test_train.c` | 191 | `t_crash` | test crash failpoints | reference / test path (non-authoritative) | D | false | training store test: crash-injection failpoint loop; test code, not built into any production binary | `for (int fp = 1; fp < TG_FP_COUNT; fp++) {` | +| OM-188 | omega | `tests/train/test_train.c` | 272 | `t_reader_race` | test reader race | reference / test path (non-authoritative) | D | false | training store test: concurrent reader loop until stop pipe fires; test code, not built into any production binary | `for (;;) {` | +| OM-189 | omega | `tests/train/test_train.c` | 289 | `t_reader_race` | test writer race | reference / test path (non-authoritative) | D | false | training store test: concurrent writer commits with short sleeps; test code, not built into any production binary | `for (int k = 0; k < 150 && st; k++) {` | +| OM-190 | omega | `tests/train/test_train.c` | 423 | `t_cost` | test cost sizes | reference / test path (non-authoritative) | D | false | training store test: cost measurement over two sizes; test code, not built into any production binary | `for (int k = 0; k < 2; k++) {` | +| OM-191 | omega | `tests/train/test_train.c` | 474 | `t_replay` | test replay steps | reference / test path (non-authoritative) | D | false | training store test: replays steps checking the generation chain; test code, not built into any production binary | `for (uint64_t k = 1; k <= (uint64_t)STEPS; k++) {` | +| OM-192 | omega | `tools/estimation/est3c_common.c` | 30 | `c3_json_field` | JSON field parse | - | N | false | N: parse: JSON object field parse loop without wait or hand-off; offline evidence tool, not on the production path | `for (;;) {` | +| OM-193 | omega | `tools/estimation/est3c_common.c` | 112 | `c3_ticks_build` | EST3c tick build line walk | - | N | false | N: walk: walks the input lines of recorded estimation data to build ticks (data ticks, not a scheduler tick), without wait or hand-off; offline evidence tool | `for (size_t li = 0; li < f->nlines; li++) {` | +| OM-194 | omega | `tools/estimation/est3c_common.c` | 135 | `c3_ticks_build` | EST3c inserted-tick walk | - | N | false | N: walk: builds the capped run of inserted-missing ticks for a gap in recorded data, without wait or hand-off; offline evidence tool | `for (uint64_t j = 0; j < ins; j++) {` | +| OM-195 | omega | `tools/estimation/est3c_common.c` | 403 | `c3_score` | EST3c scoring walk | - | N | false | N: walk: scores recorded ticks in order, without wait or hand-off; offline evidence tool | `for (size_t t = 0; t < tk->n && !rc; t++) {` | +| OM-196 | omega | `tools/estimation/est_load.c` | 47 | `spin` | load generator spin worker | reference / test path (non-authoritative) | D | false | EST measurement load generator: busy worker that spins or naps at a set level; measurement tool, not built into any production binary | `while (!atomic_load(&g_quit)) {` | +| OM-197 | omega | `tools/estimation/est_load.c` | 110 | `main` | load generator segment schedule | reference / test path (non-authoritative) | D | false | EST measurement load generator: steps through the load level schedule; measurement tool, not built into any production binary | `for (int i = 0; i < nseg && !g_stop; i++) {` | +| OM-198 | omega | `tools/estimation/est_load.c` | 120 | `main` | load generator segment timer | reference / test path (non-authoritative) | D | false | EST measurement load generator: sleeps until the segment ends; measurement tool, not built into any production binary | `for (;;) {` | +| OM-199 | omega | `tools/estimation/est4.c` | 237 | `e4_score` | EST4 scoring walk | - | N | false | N: walk: scores recorded ticks in order (data ticks, not a scheduler tick), without wait or hand-off; offline evidence tool, same shape as OM-195 | `for (size_t t = 0; t < tk->n && !rc; t++) {` | | SC-001 | aien-sovereign-core | `benchmarks/crates/bench_apples_to_apples/src/engine_max.rs` | 55 | `start` | test/benchmark loop (while:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while start.elapsed() < timeout {` | | SC-002 | aien-sovereign-core | `benchmarks/crates/bench_apples_to_apples/src/telemetry.rs` | 96 | `start` | test/benchmark loop (while:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while !stop_clone.load(Ordering::Relaxed) {` | | SC-003 | aien-sovereign-core | `benchmarks/crates/bench_apples_to_apples/src/telemetry.rs` | 168 | `enforce_thermal_cooldown` | test/benchmark loop (while:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while start.elapsed() < max_wait {` | @@ -492,3 +540,20 @@ the first scan. The tool prints `WARN omega: scanned HEAD ... differs from map SHA`, because the R16 branch builds on top of omega main. Expected. + +### 8.1 Update 2026-10-01 (Lane 32, R16 re-qualification follow-up) + +The R16 re-qualification on candidate `3108fc2` (omega main of 2026-10-01) ran this tool +and found `sites=328 unclassified=47` (receipt `evidence/REQUAL-3108fc2/`, G1 and G2 +FAIL). The 47 sites came from code added after this map's last update (compiler, +estimation, fabric, rx_compose, searchtrace, train, tests, tools). Rows OM-152 to +OM-199 classify them (48 sites: the 47 first found plus est4.c:237, found by the forge run on b765cd6, Round 3), each from reading the loop, with a one-line reason: 20 class N, +23 class D, 1 class E (`omega_numeric_reduce_gb10.c`, GPU reduction launcher, not on the +reaction path), 4 class B (explicit close/drain of an attached composition in +`rx_compose.c`), 0 class A. (Line numbers in these rows are at omega main `9ca297c`; +the join key does not use them.) No new site sequences faculties on the production +path, so none is an orchestrator-shaped finding. The map is not a gate result: the +gate result is whatever `make r16-inventory` prints on the candidate, recorded in the +qualification receipt. The tool now prints `SCANNED HEAD ()` for every +repository it scans, so a run records exactly which commits it saw (the JSON already +carried `head`). The five-repository scope is unchanged. diff --git a/tests/r16_qualify/run.sh b/tests/r16_qualify/run.sh new file mode 100755 index 000000000..effd142eb --- /dev/null +++ b/tests/r16_qualify/run.sh @@ -0,0 +1,201 @@ +#!/bin/bash +# Self-test for tools/r16_qualify.sh. No chip, no make target, no build: the script runs in +# dry mode (R16_QUALIFY_DRY=1) inside a scratch git repo, reading fixture logs. +# Proves: a dirty tree is refused before anything runs; a gate with no check prints +# NOT_RUN (never PASS); a failing check makes the script exit non-zero; observed fields +# are computed, not literals; G1/G2 follow every count, repo head and result in the +# inventory JSON; the G7 R15 receipt check fails on each broken field. Each check has a +# passing fixture first and then a counterexample that must fail. +# Usage: bash tests/r16_qualify/run.sh +set -u +HERE=$(cd "$(dirname "$0")/../.." && pwd) +SCR=$(mktemp -d "${TMPDIR:-/tmp}/r16qual.XXXXXX") || exit 2 +trap 'rm -rf "$SCR"' EXIT INT TERM +FAILS=0 +check() { if eval "$2"; then echo "ok $1"; else echo "FAIL $1"; FAILS=$((FAILS + 1)); fi; } + +W=$SCR/w +mkdir -p "$W/tools" +cp "$HERE/tools/r16_qualify.sh" "$W/tools/" +printf 'build/\n' > "$W/.gitignore" +g() { git -C "$W" -c user.name=r16 -c user.email=r16@invalid -c commit.gpgsign=false "$@"; } +g init -q && g add -A && g commit -qm fixture || exit 2 +Q() { env R16_QUALIFY_DRY=1 "$@" bash "$W/tools/r16_qualify.sh"; } + +# 1. dirty tree refused before anything runs +echo x > "$W/stray.txt" +out=$(Q 2>&1); rc=$? +check "dirty tree: exit 2" '[ $rc = 2 ]' +check "dirty tree: says REFUSED" 'echo "$out" | grep -q "^REFUSED: working tree is dirty"' +check "dirty tree: nothing created (no build dir)" '[ ! -e "$W/build" ]' +check "dirty tree: no gate lines printed" '! echo "$out" | grep -q "R16-G"' +rm -f "$W/stray.txt" +echo y >> "$W/.gitignore" +out=$(Q 2>&1); rc=$? +check "modified tracked file: exit 2" '[ $rc = 2 ]' +g checkout -q -- .gitignore + +# 2. wrong expected commit refused +out=$(Q R16_EXPECT_COMMIT=0000000000000000000000000000000000000000 2>&1); rc=$? +check "unexpected HEAD: exit 2" '[ $rc = 2 ]' + +# 3. output under tracked evidence/ refused +out=$(Q R16_OUT_DIR="$W/evidence/R16/raw" 2>&1); rc=$? +check "output under evidence/: exit 2" '[ $rc = 2 ]' + +# 4. no fixtures: every gate NOT_RUN, nothing PASS, exit 3 +out=$(Q R16_RUN_ID=none 2>&1); rc=$? +R=$W/build/r16-raw/none/DRY-RUN-receipt.json +check "no fixtures: exit 3 (nothing ran)" '[ $rc = 3 ]' +check "no fixtures: G6 prints NOT_RUN" 'echo "$out" | grep -q "R16-G6: NOT_RUN"' +check "no fixtures: summary all NOT_RUN" 'echo "$out" | grep -q "^Gates: G1=NOT_RUN G2=NOT_RUN G3=NOT_RUN G4=NOT_RUN G5=NOT_RUN G6=NOT_RUN G7=NOT_RUN G8=NOT_RUN$"' +check "no fixtures: receipt gate NOT_RUN" 'grep -q "\"gate\": \"NOT_RUN\"" "$R"' +check "no fixtures: receipt has no PASS value" '! grep -q "\"PASS\"" "$R"' +check "no fixtures: silicon_observed false (computed)" 'grep -q "\"silicon_observed\": false" "$R"' +check "no fixtures: tree_dirty false and candidate_bound true observed" 'grep -q "\"tree_dirty\": false" "$R" && grep -q "\"candidate_bound\": true" "$R"' +check "receipt marks schema revision 2" 'grep -q "\"schema_revision\": 2" "$R"' +check "receipt keeps schema name" 'grep -q "\"schema\": \"AIEN_RX_R16_ORCHESTRATOR_RETIRED_V1\"" "$R"' +check "tree still clean after run" '[ -z "$(g status --porcelain)" ]' + +# 5. fixture logs: G4 good, G5 log lacks the required line -> FAIL -> exit 1 +F=$W/build/r16-raw/fx +mkdir -p "$F" +echo "R16 gate: R16_G4_LEGACY_REFUSED=PASS" > "$F/r16_negative.log"; echo 0 > "$F/r16_negative.log.rc" +echo "R16 gate: R16_G4_GUARDS_LOAD_BEARING=PASS" > "$F/r16_negative_mutants.log"; echo 0 > "$F/r16_negative_mutants.log.rc" +echo "surface: something else" > "$F/r16_surface.log"; echo 0 > "$F/r16_surface.log.rc" +out=$(Q R16_RUN_ID=fx 2>&1); rc=$? +R=$W/build/r16-raw/fx/DRY-RUN-receipt.json +check "failing grep: exit non-zero (1)" '[ $rc = 1 ]' +check "failing grep: G5 FAIL" 'echo "$out" | grep -q "G5=FAIL"' +check "failing grep: G4 PASS from its own checks" 'echo "$out" | grep -q "G4=PASS"' +check "failing grep: receipt gate FAIL" 'grep -q "\"gate\": \"FAIL\"" "$R"' + +# 6. target exit status counts even when the pass line is present +echo 1 > "$F/r16_surface.log.rc"; echo "R16 gate: R16_G5_SURFACE=PASS" > "$F/r16_surface.log" +out=$(Q R16_RUN_ID=fx 2>&1); rc=$? +check "bad exit status with pass line: G5 FAIL, exit 1" '[ $rc = 1 ] && echo "$out" | grep -q "G5=FAIL"' +echo 0 > "$F/r16_surface.log.rc" +out=$(Q R16_RUN_ID=fx 2>&1); rc=$? +check "good G4/G5 fixtures: those gates PASS" 'echo "$out" | grep -q "G4=PASS" && echo "$out" | grep -q "G5=PASS"' +check "all-good G4/G5 still exit 3 (G6 has no check)" '[ $rc = 3 ] && echo "$out" | grep -q "G6=NOT_RUN"' + + +# 7. G1/G2 from the inventory JSON. A good fixture passes first (so each failure below is +# caused by the one value changed), then every G1/G2 check is broken on its own. +I=$W/build/r16-raw/inv +mkdir -p "$I" +# inv_fixture [key=value ...]: writes inventory.json in the tool's layout with all counts 0, +# result PASS and five recorded heads; a key=value pair overrides one field +# (head_= overrides one repo head; an empty value records no head). +inv_fixture() { + local unclassified=0 question_rows=0 bad_class=0 a_reachable=0 stale_rows=0 map_errors=0 + local skipped_repos=0 result=PASS kv k v r + local head_omega=1111111111111111111111111111111111111111 + local head_aien_sovereign_core=2222222222222222222222222222222222222222 + local head_aegis_runtime=3333333333333333333333333333333333333333 + local head_aienos=4444444444444444444444444444444444444444 + local head_physics=5555555555555555555555555555555555555555 + for kv in "$@"; do k=${kv%%=*}; v=${kv#*=}; k=${k//-/_}; printf -v "$k" '%s' "$v"; done + { + printf '{\n "schema": "AIEN_R16_LOOP_INVENTORY_V1",\n "map": "spec/r16-orchestrator-retirement-map.md",\n "repos": [\n' + for r in omega aien-sovereign-core aegis-runtime aienos physics; do + k=head_${r//-/_} + printf ' {"name": "%s", "path": "/x/%s", "head": "%s", "map_sha": "", "status": "SCANNED", "sites_by_class": {"A": 0}}%s\n' \ + "$r" "$r" "${!k}" "$([ "$r" = physics ] || echo ,)" + done + printf ' ],\n "sites": [\n ],\n "manual_rows": 5,\n "sites_total": 328,\n' + printf ' "unclassified": %s,\n "question_rows": %s,\n "bad_class": %s,\n "a_reachable": %s,\n' \ + "$unclassified" "$question_rows" "$bad_class" "$a_reachable" + printf ' "stale_rows": %s,\n "map_errors": %s,\n "skipped_repos": %s,\n "class_n_sites": 0,\n "result": "%s"\n}\n' \ + "$stale_rows" "$map_errors" "$skipped_repos" "$result" + } > "$I/inventory.json" +} +inv_logs() { # inv_logs + echo "R16 loop inventory: sites=328 -> fixture" > "$I/r16_inventory.log"; echo "$1" > "$I/r16_inventory.log.rc" + echo "$3" > "$I/test_r16_inventory.log"; echo "$2" > "$I/test_r16_inventory.log.rc" +} +inv_logs 0 0 "R16 inventory self-test: PASS" +inv_fixture +out=$(Q R16_RUN_ID=inv 2>&1); rc=$? +R=$I/DRY-RUN-receipt.json +check "good inventory: G1 PASS and G2 PASS" 'echo "$out" | grep -q "G1=PASS G2=PASS"' +check "good inventory: no FAIL, exit 3 (other gates NOT_RUN)" '[ $rc = 3 ]' +check "good inventory: counts read from the JSON (0 and 0)" 'grep -q "\"remaining_unclassified_semantic_loop_count\": 0" "$R" && grep -q "\"remaining_central_loop_count\": 0" "$R"' +check "good inventory: repo heads read from the JSON" 'grep -q "\"aien_sovereign_core_commit\": \"2222222222222222222222222222222222222222\"" "$R" && grep -q "\"aegis_runtime_commit\": \"3333333333333333333333333333333333333333\"" "$R"' +for k in unclassified question_rows bad_class stale_rows map_errors skipped_repos; do + inv_fixture "$k=1" + out=$(Q R16_RUN_ID=inv 2>&1); rc=$? + check "bad inventory $k=1: G1 FAIL, exit 1" '[ $rc = 1 ] && echo "$out" | grep -q "G1=FAIL"' +done +inv_fixture unclassified=7 +out=$(Q R16_RUN_ID=inv 2>&1) +check "bad inventory unclassified=7: count carried into receipt" 'grep -q "\"remaining_unclassified_semantic_loop_count\": 7" "$R"' +for r in omega aien-sovereign-core aegis-runtime aienos physics; do + inv_fixture "head_$r=" + out=$(Q R16_RUN_ID=inv 2>&1); rc=$? + check "inventory with no head for $r: G1 FAIL, exit 1" '[ $rc = 1 ] && echo "$out" | grep -q "G1=FAIL"' +done +inv_fixture a_reachable=1 +out=$(Q R16_RUN_ID=inv 2>&1); rc=$? +check "bad inventory a_reachable=1: G2 FAIL (G1 PASS), exit 1" '[ $rc = 1 ] && echo "$out" | grep -q "G1=PASS G2=FAIL"' +check "bad inventory a_reachable=1: count carried into receipt" 'grep -q "\"remaining_central_loop_count\": 1" "$R"' +inv_fixture result=FAIL +out=$(Q R16_RUN_ID=inv 2>&1); rc=$? +check "inventory result FAIL: G2 FAIL, exit 1" '[ $rc = 1 ] && echo "$out" | grep -q "G2=FAIL"' +inv_fixture; inv_logs 1 0 "R16 inventory self-test: PASS" +out=$(Q R16_RUN_ID=inv 2>&1); rc=$? +check "inventory target exit 1: G2 FAIL, exit 1" '[ $rc = 1 ] && echo "$out" | grep -q "G2=FAIL"' +inv_logs 0 0 "R16 inventory self-test: 1 FAILED" +out=$(Q R16_RUN_ID=inv 2>&1); rc=$? +check "inventory self-test log lacks pass line: G2 FAIL, exit 1" '[ $rc = 1 ] && echo "$out" | grep -q "G2=FAIL"' +inv_logs 0 1 "R16 inventory self-test: PASS" +out=$(Q R16_RUN_ID=inv 2>&1); rc=$? +check "inventory self-test exit 1 with pass line: G2 FAIL, exit 1" '[ $rc = 1 ] && echo "$out" | grep -q "G2=FAIL"' +inv_logs 0 0 "R16 inventory self-test: PASS"; rm -f "$I/inventory.json" +out=$(Q R16_RUN_ID=inv 2>&1); rc=$? +check "inventory ran but wrote no JSON: G1 FAIL and G2 FAIL, exit 1" '[ $rc = 1 ] && echo "$out" | grep -q "G1=FAIL G2=FAIL"' + +# 8. G7 R15 acceptance receipt (R16_R15_RECEIPT). A good receipt (named by its own +# SHA-256, bound to this HEAD) passes first; then each check is broken on its own. +CAND=$(g rev-parse HEAD) +RD=$SCR/r15 +mkdir -p "$RD" +# r15_receipt [field=value ...]: writes a receipt named by its own SHA-256, prints its path. +r15_receipt() { + local outcome=PASS candidate_commit=$CAND candidate_bound=true tree_dirty=false silicon_observed=true kv + for kv in "$@"; do printf -v "${kv%%=*}" '%s' "${kv#*=}"; done + printf '{\n "schema": "AIEN_RX_R15_FIXTURE",\n "outcome": "%s",\n "candidate_commit": "%s",\n "candidate_bound": %s,\n "tree_dirty": %s,\n "silicon_observed": %s\n}\n' \ + "$outcome" "$candidate_commit" "$candidate_bound" "$tree_dirty" "$silicon_observed" > "$RD/tmp.json" + local s; s=$(sha256sum "$RD/tmp.json" | cut -d' ' -f1) + mv "$RD/tmp.json" "$RD/$s.json" + echo "$RD/$s.json" +} +GOOD=$(r15_receipt) +out=$(Q R16_RUN_ID=r15 R16_R15_RECEIPT="$GOOD" 2>&1); rc=$? +R=$W/build/r16-raw/r15/DRY-RUN-receipt.json +check "good R15 receipt: acceptance PASS" 'echo "$out" | grep -q "R15 acceptance receipt: PASS"' +check "good R15 receipt: field true, exit 3 (ladder NOT_RUN)" '[ $rc = 3 ] && grep -q "\"r15_acceptance_still_passing\": true" "$R"' +r15_bad() { # r15_bad