From 35a33e38369f9f5983838e53e7748499b18d7d64 Mon Sep 17 00:00:00 2001 From: xormania <127287135+xormania@users.noreply.github.com> Date: Sun, 2 Aug 2026 17:32:15 -0400 Subject: [PATCH 1/6] test(ci): require split lifecycle routing --- tests/dev/security-gate-cases.sh | 3 +- tests/experiment/aggregate-harness-cases.sh | 150 ++++++++++++++++++-- 2 files changed, 140 insertions(+), 13 deletions(-) diff --git a/tests/dev/security-gate-cases.sh b/tests/dev/security-gate-cases.sh index 05e61f8..15eccb6 100644 --- a/tests/dev/security-gate-cases.sh +++ b/tests/dev/security-gate-cases.sh @@ -230,7 +230,8 @@ guard-mount tests/guard/cases.sh SUMMARY failures=0 config-authority tests/agent/config-guard.sh SUMMARY failures=0 experiment-contract tests/experiment/contract-cases.sh EXPERIMENT CONTRACT PASS experiment-authorization tests/experiment/authorization-cases.sh EXPERIMENT AUTHORIZATION PASS -experiment-local-lifecycle tests/experiment/local-lifecycle-cases.sh EXPERIMENT LOCAL LIFECYCLE PASS +experiment-local-lifecycle tests/experiment/local-onboarding-cases.sh EXPERIMENT LOCAL LIFECYCLE PASS +experiment-install-lifecycle tests/experiment/install-lifecycle-cases.sh EXPERIMENT INSTALL LIFECYCLE PASS experiment-source-adapters tests/experiment/source-adapter-cases.sh EXPERIMENT SOURCE ADAPTERS PASS config-matrix tests/agent/config-matrix.sh SUMMARY failures=0 allowlist-schema tests/agent/allowlist-cases.sh SUMMARY failures=0 diff --git a/tests/experiment/aggregate-harness-cases.sh b/tests/experiment/aggregate-harness-cases.sh index c8df5f1..26dc287 100755 --- a/tests/experiment/aggregate-harness-cases.sh +++ b/tests/experiment/aggregate-harness-cases.sh @@ -3,6 +3,8 @@ set -u -o pipefail repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." >/dev/null 2>&1 && pwd)" lifecycle="$repo_root/tests/experiment/local-lifecycle-cases.sh" +local_onboarding="$repo_root/tests/experiment/local-onboarding-cases.sh" +install_lifecycle="$repo_root/tests/experiment/install-lifecycle-cases.sh" source_adapters="$repo_root/tests/experiment/source-adapter-cases.sh" expected_count=23 work="" @@ -25,6 +27,8 @@ fi trap 'cleanup_work >/dev/null 2>&1 || true' EXIT replica="$work/repo" replica_lifecycle="$replica/tests/experiment/local-lifecycle-cases.sh" +replica_local_onboarding="$replica/tests/experiment/local-onboarding-cases.sh" +replica_install_lifecycle="$replica/tests/experiment/install-lifecycle-cases.sh" replica_source_adapters="$replica/tests/experiment/source-adapter-cases.sh" mkdir -p "$replica/tests/experiment" "$replica/tests/install" cp "$lifecycle" "$replica_lifecycle" @@ -293,6 +297,25 @@ run_source_replica() { run_selected "$output" "$replica_source_adapters" "$@" } +route_output_valid() { + local output="$1" + local expected_file="$2" + local expected_assertions="$3" + local marker="$4" + local rc="$5" + + [ "$rc" -eq 0 ] && + cmp -s "$expected_file" <(awk '/^(PASS|FAIL) [A-Z0-9-]+ / {print $2}' "$output") && + [ "$(grep -Fxc \ + "SUMMARY assertions=$expected_assertions expected=$expected_assertions failures=0 infra=0" \ + "$output" || true)" -eq 1 ] && + [ "$(awk 'END {print}' "$output")" = "$marker" ] && + awk -v summary="SUMMARY assertions=$expected_assertions expected=$expected_assertions failures=0 infra=0" \ + -v marker="$marker" \ + '/^(PASS|FAIL) [A-Z0-9-]+ / {next} $0 == summary {next} $0 == marker {next} {bad=1} END {exit bad}' \ + "$output" +} + wait_for_path() { local path="$1" local attempts=0 @@ -387,6 +410,98 @@ run_replica "$work/overlap.out" env \ AGENT_LAB_AGG_EXEC_LOG="$overlap_executions" \ AGENT_LAB_AGG_BARRIER_DIR="$overlap_barrier" || overlap_rc=$? +split_routing_contract=0 +split_output_contract=0 +split_mutation_contract=0 +if [ -f "$local_onboarding" ] && [ -f "$install_lifecycle" ]; then + cp "$local_onboarding" "$replica_local_onboarding" + cp "$install_lifecycle" "$replica_install_lifecycle" + chmod +x "$replica_local_onboarding" "$replica_install_lifecycle" + + expected_local_ids="$work/expected-local-ids" + expected_install_ids="$work/expected-install-ids" + expected_local_executions="$work/expected-local-executions" + expected_install_executions="$work/expected-install-executions" + printf '%s\n' "${expected_ids[@]:0:86}" > "$expected_local_ids" + printf '%s\n' "${expected_ids[@]:86:47}" > "$expected_install_ids" + printf '%s\n' \ + local-install-cases.sh \ + local-config-cases.sh \ + local-image-catalog-cases.sh > "$expected_local_executions" + printf '%s\n' \ + install-store-cases.sh \ + install-state-cases.py \ + install-integrity-cases.py \ + install-mutation-cases.py > "$expected_install_executions" + + reset_fixtures + split_barrier="$work/split-barrier" + local_executions="$work/local-executions" + install_executions="$work/install-executions" + mkdir "$split_barrier" + : > "$local_executions" + : > "$install_executions" + local_route_rc=0 + install_route_rc=0 + env \ + AGENT_LAB_AGG_EXEC_LOG="$local_executions" \ + AGENT_LAB_AGG_BARRIER_DIR="$split_barrier" \ + bash "$replica_local_onboarding" > "$work/local-route.out" 2>&1 & + local_route_pid=$! + env \ + AGENT_LAB_AGG_EXEC_LOG="$install_executions" \ + AGENT_LAB_AGG_BARRIER_DIR="$split_barrier" \ + bash "$replica_install_lifecycle" > "$work/install-route.out" 2>&1 & + install_route_pid=$! + wait "$local_route_pid" || local_route_rc=$? + wait "$install_route_pid" || install_route_rc=$? + + combined_executions="$work/combined-executions" + LC_ALL=C sort "$local_executions" "$install_executions" > "$combined_executions" + if cmp -s <(LC_ALL=C sort "$expected_local_executions") \ + <(LC_ALL=C sort "$local_executions") && + cmp -s <(LC_ALL=C sort "$expected_install_executions") \ + <(LC_ALL=C sort "$install_executions") && + cmp -s <(LC_ALL=C sort "$expected_executions") "$combined_executions"; then + split_routing_contract=1 + fi + if route_output_valid \ + "$work/local-route.out" "$expected_local_ids" 86 \ + 'EXPERIMENT LOCAL LIFECYCLE PASS' "$local_route_rc" && + route_output_valid \ + "$work/install-route.out" "$expected_install_ids" 47 \ + 'EXPERIMENT INSTALL LIFECYCLE PASS' "$install_route_rc"; then + split_output_contract=1 + fi + + mutant_install_route="$replica/tests/experiment/install-lifecycle-wrong-route.sh" + mutation_write_rc=0 + awk ' + $0 == "exec bash \"$script_dir/local-lifecycle-cases.sh\" install" { + print "exec bash \"$script_dir/local-lifecycle-cases.sh\" local" + changes++ + next + } + { print } + END { if (changes != 1) exit 1 } + ' "$replica_install_lifecycle" > "$mutant_install_route" || mutation_write_rc=$? + chmod +x "$mutant_install_route" + mutant_install_executions="$work/mutant-install-executions" + : > "$mutant_install_executions" + mutant_install_rc=0 + env AGENT_LAB_AGG_EXEC_LOG="$mutant_install_executions" \ + bash "$mutant_install_route" > "$work/mutant-install-route.out" 2>&1 || \ + mutant_install_rc=$? + if [ "$mutation_write_rc" -eq 0 ] && [ "$mutant_install_rc" -eq 0 ] && + ! route_output_valid \ + "$work/mutant-install-route.out" "$expected_install_ids" 47 \ + 'EXPERIMENT INSTALL LIFECYCLE PASS' "$mutant_install_rc" && + ! cmp -s <(LC_ALL=C sort "$expected_install_executions") \ + <(LC_ALL=C sort "$mutant_install_executions"); then + split_mutation_contract=1 + fi +fi + if [ "$baseline_rc" -eq 0 ] && cmp -s <(LC_ALL=C sort "$expected_executions") <(LC_ALL=C sort "$baseline_executions") && [ "$mutation_count" -eq 1 ] && @@ -398,10 +513,12 @@ if [ "$baseline_rc" -eq 0 ] && cmp -s <(LC_ALL=C sort "$expected_executions") <(LC_ALL=C sort "$overlap_executions") && [ -f "$overlap_barrier/local-install-cases.sh.ready" ] && [ -f "$overlap_barrier/local-image-catalog-cases.sh.ready" ] && - [ -f "$overlap_barrier/install-state-cases.py.ready" ]; then - pass AGG-001 "execution ledger and overlap barrier prove exact-once concurrent routing" + [ -f "$overlap_barrier/install-state-cases.py.ready" ] && + [ "$split_routing_contract" -eq 1 ] && + [ "$split_mutation_contract" -eq 1 ]; then + pass AGG-001 "execution ledgers prove exact split routing and reject a wrong-route mutant" else - fail AGG-001 "execution ledger and overlap barrier prove exact-once concurrent routing" + fail AGG-001 "execution ledgers prove exact split routing and reject a wrong-route mutant" fi reset_fixtures @@ -412,10 +529,11 @@ if [ "$success_rc" -eq 0 ] && [ "$(grep -Ec '^(PASS|FAIL) [A-Z0-9-]+ ' "$success_output")" -eq 133 ] && [ "$(grep -Fxc 'SUMMARY assertions=133 expected=133 failures=0 infra=0' "$success_output")" -eq 1 ] && [ "$(tail -n 1 "$success_output")" = 'EXPERIMENT LOCAL LIFECYCLE PASS' ] && - awk '/^(PASS|FAIL) [A-Z0-9-]+ / {next} /^SUMMARY assertions=133 expected=133 failures=0 infra=0$/ {next} /^EXPERIMENT LOCAL LIFECYCLE PASS$/ {next} {bad=1} END {exit bad}' "$success_output"; then - pass AGG-002 "success forwards only assertions then one summary and marker" + awk '/^(PASS|FAIL) [A-Z0-9-]+ / {next} /^SUMMARY assertions=133 expected=133 failures=0 infra=0$/ {next} /^EXPERIMENT LOCAL LIFECYCLE PASS$/ {next} {bad=1} END {exit bad}' "$success_output" && + [ "$split_output_contract" -eq 1 ]; then + pass AGG-002 "compatibility and split routes emit exact summaries and markers" else - fail AGG-002 "success forwards only assertions then one summary and marker" + fail AGG-002 "compatibility and split routes emit exact summaries and markers" fi missing_records=() @@ -537,16 +655,24 @@ else fail AGG-009 "missing subcase summary maps to one hundred twenty-five" fi -lane_assignment_count="$(grep -Ec '^[[:space:]]*(readonly[[:space:]]+)?lane_count=' \ +lane_assignment_count="$(grep -Ec '^[[:space:]]+lane_count=[0-9]+$' \ "$replica_lifecycle" || true)" -if [ "$lane_assignment_count" -eq 1 ] && - [ "$(grep -Fxc 'readonly lane_count=3' "$replica_lifecycle")" -eq 1 ] && +if [ "$lane_assignment_count" -eq 3 ] && + [ "$(grep -Fxc ' lane_count=3' "$replica_lifecycle")" -eq 1 ] && + [ "$(grep -Fxc ' lane_count=1' "$replica_lifecycle")" -eq 2 ] && + [ "$(grep -Fxc 'readonly lane_count' "$replica_lifecycle")" -eq 1 ] && [ "$(grep -Fxc 'for ((lane = 0; lane < lane_count; lane++)); do' \ "$replica_lifecycle")" -eq 1 ] && - [ "$(grep -Fxc ' run_lane "$lane" &' "$replica_lifecycle")" -eq 1 ]; then - pass AGG-010 "lifecycle declares one immutable three-lane bound" + [ "$(grep -Fxc ' run_lane "$lane" &' "$replica_lifecycle")" -eq 1 ] && + [ -f "$replica_local_onboarding" ] && + [ -f "$replica_install_lifecycle" ] && + [ "$(grep -Fxc 'exec bash "$script_dir/local-lifecycle-cases.sh" local' \ + "$replica_local_onboarding" || true)" -eq 1 ] && + [ "$(grep -Fxc 'exec bash "$script_dir/local-lifecycle-cases.sh" install' \ + "$replica_install_lifecycle" || true)" -eq 1 ]; then + pass AGG-010 "split routes share one scheduler and cap lifecycle concurrency at two lanes" else - fail AGG-010 "lifecycle declares one immutable three-lane bound" + fail AGG-010 "split routes share one scheduler and cap lifecycle concurrency at two lanes" fi hold_ids=( From bd8ce175f69614c32b2e284afdb647923abfb2c1 Mon Sep 17 00:00:00 2001 From: xormania <127287135+xormania@users.noreply.github.com> Date: Sun, 2 Aug 2026 17:40:05 -0400 Subject: [PATCH 2/6] fix(ci): split lifecycle deadline load --- tests/experiment/aggregate-harness-cases.sh | 12 ++--- tests/experiment/install-lifecycle-cases.sh | 5 ++ tests/experiment/local-lifecycle-cases.sh | 59 +++++++++++++++++++-- tests/experiment/local-onboarding-cases.sh | 5 ++ tests/security/fast.manifest | 3 +- 5 files changed, 70 insertions(+), 14 deletions(-) create mode 100755 tests/experiment/install-lifecycle-cases.sh create mode 100755 tests/experiment/local-onboarding-cases.sh diff --git a/tests/experiment/aggregate-harness-cases.sh b/tests/experiment/aggregate-harness-cases.sh index 26dc287..84616c0 100755 --- a/tests/experiment/aggregate-harness-cases.sh +++ b/tests/experiment/aggregate-harness-cases.sh @@ -378,10 +378,8 @@ run_replica "$work/baseline.out" env \ mutant_lifecycle="$replica/tests/experiment/local-lifecycle-hidden-duplicate.sh" awk ' { print } - $0 == "subcases=(" { in_subcases=1; next } - in_subcases && $0 == ")" { + $0 == "subcases=(\"${all_subcases[@]:$selected_start:$selected_count}\")" { print "\"$repo_root/tests/install/local-install-cases.sh\" >/dev/null 2>&1" - in_subcases=0 } ' "$replica_lifecycle" > "$mutant_lifecycle" chmod +x "$mutant_lifecycle" @@ -435,22 +433,18 @@ if [ -f "$local_onboarding" ] && [ -f "$install_lifecycle" ]; then install-mutation-cases.py > "$expected_install_executions" reset_fixtures - split_barrier="$work/split-barrier" local_executions="$work/local-executions" install_executions="$work/install-executions" - mkdir "$split_barrier" : > "$local_executions" : > "$install_executions" local_route_rc=0 install_route_rc=0 env \ AGENT_LAB_AGG_EXEC_LOG="$local_executions" \ - AGENT_LAB_AGG_BARRIER_DIR="$split_barrier" \ bash "$replica_local_onboarding" > "$work/local-route.out" 2>&1 & local_route_pid=$! env \ AGENT_LAB_AGG_EXEC_LOG="$install_executions" \ - AGENT_LAB_AGG_BARRIER_DIR="$split_barrier" \ bash "$replica_install_lifecycle" > "$work/install-route.out" 2>&1 & install_route_pid=$! wait "$local_route_pid" || local_route_rc=$? @@ -670,9 +664,9 @@ if [ "$lane_assignment_count" -eq 3 ] && "$replica_local_onboarding" || true)" -eq 1 ] && [ "$(grep -Fxc 'exec bash "$script_dir/local-lifecycle-cases.sh" install' \ "$replica_install_lifecycle" || true)" -eq 1 ]; then - pass AGG-010 "split routes share one scheduler and cap lifecycle concurrency at two lanes" + pass AGG-010 "split routes share one scheduler and use one aggregate lane each" else - fail AGG-010 "split routes share one scheduler and cap lifecycle concurrency at two lanes" + fail AGG-010 "split routes share one scheduler and use one aggregate lane each" fi hold_ids=( diff --git a/tests/experiment/install-lifecycle-cases.sh b/tests/experiment/install-lifecycle-cases.sh new file mode 100755 index 0000000..f8b11a9 --- /dev/null +++ b/tests/experiment/install-lifecycle-cases.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -u -o pipefail + +script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +exec bash "$script_dir/local-lifecycle-cases.sh" install diff --git a/tests/experiment/local-lifecycle-cases.sh b/tests/experiment/local-lifecycle-cases.sh index dd3dd3a..d2fae43 100755 --- a/tests/experiment/local-lifecycle-cases.sh +++ b/tests/experiment/local-lifecycle-cases.sh @@ -2,7 +2,7 @@ set -u -o pipefail repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." >/dev/null 2>&1 && pwd)" -subcases=( +all_subcases=( "$repo_root/tests/install/local-install-cases.sh" "$repo_root/tests/experiment/local-config-cases.sh" "$repo_root/tests/experiment/local-image-catalog-cases.sh" @@ -11,9 +11,53 @@ subcases=( "$repo_root/tests/experiment/install-integrity-cases.py" "$repo_root/tests/experiment/install-mutation-cases.py" ) -expected_count=133 +readonly all_subcases + +if [ "$#" -eq 0 ]; then + route=all +elif [ "$#" -eq 1 ]; then + route="$1" +else + printf 'Usage: %s [local|install]\n' "${BASH_SOURCE[0]}" >&2 + exit 2 +fi + +case "$route" in + all) + selected_start=0 + selected_count=7 + expected_start=1 + expected_count=133 + lane_count=3 + final_marker='EXPERIMENT LOCAL LIFECYCLE PASS' + ;; + local) + selected_start=0 + selected_count=3 + expected_start=1 + expected_count=86 + lane_count=1 + final_marker='EXPERIMENT LOCAL LIFECYCLE PASS' + ;; + install) + selected_start=3 + selected_count=4 + expected_start=87 + expected_count=47 + lane_count=1 + final_marker='EXPERIMENT INSTALL LIFECYCLE PASS' + ;; + *) + printf 'Usage: %s [local|install]\n' "${BASH_SOURCE[0]}" >&2 + exit 2 + ;; +esac +readonly route selected_start selected_count expected_start expected_count +readonly lane_count +readonly final_marker +subcases=("${all_subcases[@]:$selected_start:$selected_count}") +readonly subcases work="" -readonly lane_count=3 lane_pids=() lifecycle_pid="$$" lifecycle_pgid="" @@ -79,6 +123,7 @@ trap 'handle_signal 130' INT trap 'handle_signal 131' QUIT trap 'handle_signal 143' TERM +expected_all="$work/expected-all" expected="$work/expected" observed="$work/observed" printf '%s\n' \ @@ -113,6 +158,12 @@ printf '%s\n' \ M-STORE-AUTH-001 M-STORE-SOURCE-001 M-STORE-ATOM-001 M-STORE-RETRY-001 \ M-STORE-DUR-001 M-STORE-LAYOUT-001 M-STORE-KEY-001 M-STORE-VERIFY-001 \ M-STORE-LIVE-001 M-STORE-UNCERT-001 M-STORE-STAGE-001 > "$expected" +mv "$expected" "$expected_all" +if ! awk -v start="$expected_start" -v count="$expected_count" \ + 'NR >= start && NR < start + count {print}' "$expected_all" > "$expected"; then + printf 'SUMMARY assertions=0 expected=%s failures=0 infra=1\n' "$expected_count" + exit 125 +fi : > "$observed" run_subcase() { @@ -231,4 +282,4 @@ fi if [ "$failures" -ne 0 ]; then exit 1 fi -printf 'EXPERIMENT LOCAL LIFECYCLE PASS\n' +printf '%s\n' "$final_marker" diff --git a/tests/experiment/local-onboarding-cases.sh b/tests/experiment/local-onboarding-cases.sh new file mode 100755 index 0000000..277c21d --- /dev/null +++ b/tests/experiment/local-onboarding-cases.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -u -o pipefail + +script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +exec bash "$script_dir/local-lifecycle-cases.sh" local diff --git a/tests/security/fast.manifest b/tests/security/fast.manifest index 23cebcc..2f25e28 100644 --- a/tests/security/fast.manifest +++ b/tests/security/fast.manifest @@ -52,7 +52,8 @@ suite guard-mount tests/guard/cases.sh SUMMARY failures=0 suite config-authority tests/agent/config-guard.sh SUMMARY failures=0 suite experiment-contract tests/experiment/contract-cases.sh EXPERIMENT CONTRACT PASS suite experiment-authorization tests/experiment/authorization-cases.sh EXPERIMENT AUTHORIZATION PASS -suite experiment-local-lifecycle tests/experiment/local-lifecycle-cases.sh EXPERIMENT LOCAL LIFECYCLE PASS +suite experiment-local-lifecycle tests/experiment/local-onboarding-cases.sh EXPERIMENT LOCAL LIFECYCLE PASS +suite experiment-install-lifecycle tests/experiment/install-lifecycle-cases.sh EXPERIMENT INSTALL LIFECYCLE PASS suite experiment-source-adapters tests/experiment/source-adapter-cases.sh EXPERIMENT SOURCE ADAPTERS PASS suite config-matrix tests/agent/config-matrix.sh SUMMARY failures=0 suite allowlist-schema tests/agent/allowlist-cases.sh SUMMARY failures=0 From 1efd8107b9801893e110a84d06a65ca38e6f1549 Mon Sep 17 00:00:00 2001 From: xormania <127287135+xormania@users.noreply.github.com> Date: Sun, 2 Aug 2026 17:49:05 -0400 Subject: [PATCH 3/6] test(ci): close lifecycle split false greens --- tests/experiment/aggregate-harness-cases.sh | 106 ++++++++++++++++++-- 1 file changed, 98 insertions(+), 8 deletions(-) diff --git a/tests/experiment/aggregate-harness-cases.sh b/tests/experiment/aggregate-harness-cases.sh index 84616c0..85711e4 100755 --- a/tests/experiment/aggregate-harness-cases.sh +++ b/tests/experiment/aggregate-harness-cases.sh @@ -316,6 +316,19 @@ route_output_valid() { "$output" } +infrastructure_output_valid() { + local output="$1" + local expected_assertions="$2" + local rc="$3" + + [ "$rc" -eq 125 ] && + [ "$(grep -Fxc \ + "SUMMARY assertions=0 expected=$expected_assertions failures=0 infra=1" \ + "$output" || true)" -eq 1 ] && + ! grep -Fq 'EXPERIMENT LOCAL LIFECYCLE PASS' "$output" && + ! grep -Fq 'EXPERIMENT INSTALL LIFECYCLE PASS' "$output" +} + wait_for_path() { local path="$1" local attempts=0 @@ -411,6 +424,8 @@ run_replica "$work/overlap.out" env \ split_routing_contract=0 split_output_contract=0 split_mutation_contract=0 +tail_mutation_contract=0 +wrapper_infrastructure_contract=0 if [ -f "$local_onboarding" ] && [ -f "$install_lifecycle" ]; then cp "$local_onboarding" "$replica_local_onboarding" cp "$install_lifecycle" "$replica_install_lifecycle" @@ -433,18 +448,22 @@ if [ -f "$local_onboarding" ] && [ -f "$install_lifecycle" ]; then install-mutation-cases.py > "$expected_install_executions" reset_fixtures + split_barrier="$work/split-barrier" local_executions="$work/local-executions" install_executions="$work/install-executions" + mkdir "$split_barrier" : > "$local_executions" : > "$install_executions" local_route_rc=0 install_route_rc=0 env \ AGENT_LAB_AGG_EXEC_LOG="$local_executions" \ + AGENT_LAB_AGG_BARRIER_DIR="$split_barrier" \ bash "$replica_local_onboarding" > "$work/local-route.out" 2>&1 & local_route_pid=$! env \ AGENT_LAB_AGG_EXEC_LOG="$install_executions" \ + AGENT_LAB_AGG_BARRIER_DIR="$split_barrier" \ bash "$replica_install_lifecycle" > "$work/install-route.out" 2>&1 & install_route_pid=$! wait "$local_route_pid" || local_route_rc=$? @@ -494,6 +513,68 @@ if [ -f "$local_onboarding" ] && [ -f "$install_lifecycle" ]; then <(LC_ALL=C sort "$mutant_install_executions"); then split_mutation_contract=1 fi + + tail_subcase_mutant="$replica/tests/experiment/local-lifecycle-tail-subcase.sh" + tail_subcase_write_rc=0 + awk ' + $0 == "all_subcases=(" { in_subcases=1 } + in_subcases && $0 == ")" { + print " \"$repo_root/tests/install/local-install-cases.sh\" # tail-orphan mutant" + changes++ + in_subcases=0 + } + { print } + END { if (changes != 1) exit 1 } + ' "$replica_lifecycle" > "$tail_subcase_mutant" || tail_subcase_write_rc=$? + chmod +x "$tail_subcase_mutant" + tail_subcase_executions="$work/tail-subcase-executions" + : > "$tail_subcase_executions" + tail_subcase_rc=0 + env AGENT_LAB_AGG_EXEC_LOG="$tail_subcase_executions" \ + bash "$tail_subcase_mutant" > "$work/tail-subcase.out" 2>&1 || \ + tail_subcase_rc=$? + + tail_id_mutant="$replica/tests/experiment/local-lifecycle-tail-id.sh" + tail_id_write_rc=0 + awk ' + { print } + $0 == " M-STORE-LIVE-001 M-STORE-UNCERT-001 M-STORE-STAGE-001 > \"$expected\"" { + print "printf '\''%s\\n'\'' ORPHAN-134 >> \"$expected\"" + changes++ + } + END { if (changes != 1) exit 1 } + ' "$replica_lifecycle" > "$tail_id_mutant" || tail_id_write_rc=$? + chmod +x "$tail_id_mutant" + tail_id_executions="$work/tail-id-executions" + : > "$tail_id_executions" + tail_id_rc=0 + env AGENT_LAB_AGG_EXEC_LOG="$tail_id_executions" \ + bash "$tail_id_mutant" > "$work/tail-id.out" 2>&1 || tail_id_rc=$? + + if [ "$tail_subcase_write_rc" -eq 0 ] && + infrastructure_output_valid "$work/tail-subcase.out" 133 "$tail_subcase_rc" && + [ ! -s "$tail_subcase_executions" ] && + [ "$tail_id_write_rc" -eq 0 ] && + infrastructure_output_valid "$work/tail-id.out" 133 "$tail_id_rc" && + [ ! -s "$tail_id_executions" ]; then + tail_mutation_contract=1 + fi + + saved_lifecycle="$work/local-lifecycle-core.saved" + mv "$replica_lifecycle" "$saved_lifecycle" + missing_local_core_rc=0 + missing_install_core_rc=0 + bash "$replica_local_onboarding" > "$work/missing-local-core.out" 2>&1 || \ + missing_local_core_rc=$? + bash "$replica_install_lifecycle" > "$work/missing-install-core.out" 2>&1 || \ + missing_install_core_rc=$? + mv "$saved_lifecycle" "$replica_lifecycle" + if infrastructure_output_valid \ + "$work/missing-local-core.out" 86 "$missing_local_core_rc" && + infrastructure_output_valid \ + "$work/missing-install-core.out" 47 "$missing_install_core_rc"; then + wrapper_infrastructure_contract=1 + fi fi if [ "$baseline_rc" -eq 0 ] && @@ -509,10 +590,11 @@ if [ "$baseline_rc" -eq 0 ] && [ -f "$overlap_barrier/local-image-catalog-cases.sh.ready" ] && [ -f "$overlap_barrier/install-state-cases.py.ready" ] && [ "$split_routing_contract" -eq 1 ] && - [ "$split_mutation_contract" -eq 1 ]; then - pass AGG-001 "execution ledgers prove exact split routing and reject a wrong-route mutant" + [ "$split_mutation_contract" -eq 1 ] && + [ "$tail_mutation_contract" -eq 1 ]; then + pass AGG-001 "execution ledgers prove exact routing and reject wrong-route or orphan-tail mutants" else - fail AGG-001 "execution ledgers prove exact split routing and reject a wrong-route mutant" + fail AGG-001 "execution ledgers prove exact routing and reject wrong-route or orphan-tail mutants" fi reset_fixtures @@ -643,20 +725,28 @@ chmod +x "$summaryless" summaryless_rc=0 run_replica "$work/summaryless.out" env || summaryless_rc=$? if [ "$summaryless_rc" -eq 125 ] && + [ "$wrapper_infrastructure_contract" -eq 1 ] && ! grep -Fxq 'EXPERIMENT LOCAL LIFECYCLE PASS' "$work/summaryless.out"; then - pass AGG-009 "missing subcase summary maps to one hundred twenty-five" + pass AGG-009 "missing summaries or shared core map to infrastructure" else - fail AGG-009 "missing subcase summary maps to one hundred twenty-five" + fail AGG-009 "missing summaries or shared core map to infrastructure" fi lane_assignment_count="$(grep -Ec '^[[:space:]]+lane_count=[0-9]+$' \ "$replica_lifecycle" || true)" if [ "$lane_assignment_count" -eq 3 ] && [ "$(grep -Fxc ' lane_count=3' "$replica_lifecycle")" -eq 1 ] && - [ "$(grep -Fxc ' lane_count=1' "$replica_lifecycle")" -eq 2 ] && + [ "$(grep -Fxc ' lane_count=2' "$replica_lifecycle")" -eq 1 ] && + [ "$(grep -Fxc ' lane_count=1' "$replica_lifecycle")" -eq 1 ] && + [ "$(grep -Fxc ' lane_map=(0 1 2 0 1 2 0)' "$replica_lifecycle")" -eq 1 ] && + [ "$(grep -Fxc ' lane_map=(0 0 1)' "$replica_lifecycle")" -eq 1 ] && + [ "$(grep -Fxc ' lane_map=(0 0 0 0)' "$replica_lifecycle")" -eq 1 ] && [ "$(grep -Fxc 'readonly lane_count' "$replica_lifecycle")" -eq 1 ] && + [ "$(grep -Fxc 'readonly lane_map' "$replica_lifecycle")" -eq 1 ] && [ "$(grep -Fxc 'for ((lane = 0; lane < lane_count; lane++)); do' \ "$replica_lifecycle")" -eq 1 ] && + [ "$(grep -Fxc ' [ "${lane_map[$index]}" -eq "$lane" ] || continue' \ + "$replica_lifecycle")" -eq 1 ] && [ "$(grep -Fxc ' run_lane "$lane" &' "$replica_lifecycle")" -eq 1 ] && [ -f "$replica_local_onboarding" ] && [ -f "$replica_install_lifecycle" ] && @@ -664,9 +754,9 @@ if [ "$lane_assignment_count" -eq 3 ] && "$replica_local_onboarding" || true)" -eq 1 ] && [ "$(grep -Fxc 'exec bash "$script_dir/local-lifecycle-cases.sh" install' \ "$replica_install_lifecycle" || true)" -eq 1 ]; then - pass AGG-010 "split routes share one scheduler and use one aggregate lane each" + pass AGG-010 "split routes preserve three measured aggregate lanes through one scheduler" else - fail AGG-010 "split routes share one scheduler and use one aggregate lane each" + fail AGG-010 "split routes preserve three measured aggregate lanes through one scheduler" fi hold_ids=( From 7132595fd3acb5fbe135c1973fde756f125a0d39 Mon Sep 17 00:00:00 2001 From: xormania <127287135+xormania@users.noreply.github.com> Date: Sun, 2 Aug 2026 17:50:09 -0400 Subject: [PATCH 4/6] test(ci): tighten lifecycle split oracles --- tests/experiment/aggregate-harness-cases.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/experiment/aggregate-harness-cases.sh b/tests/experiment/aggregate-harness-cases.sh index 85711e4..017af5d 100755 --- a/tests/experiment/aggregate-harness-cases.sh +++ b/tests/experiment/aggregate-harness-cases.sh @@ -471,7 +471,8 @@ if [ -f "$local_onboarding" ] && [ -f "$install_lifecycle" ]; then combined_executions="$work/combined-executions" LC_ALL=C sort "$local_executions" "$install_executions" > "$combined_executions" - if cmp -s <(LC_ALL=C sort "$expected_local_executions") \ + if [ "$local_route_rc" -eq 0 ] && [ "$install_route_rc" -eq 0 ] && + cmp -s <(LC_ALL=C sort "$expected_local_executions") \ <(LC_ALL=C sort "$local_executions") && cmp -s <(LC_ALL=C sort "$expected_install_executions") \ <(LC_ALL=C sort "$install_executions") && @@ -527,6 +528,7 @@ if [ -f "$local_onboarding" ] && [ -f "$install_lifecycle" ]; then END { if (changes != 1) exit 1 } ' "$replica_lifecycle" > "$tail_subcase_mutant" || tail_subcase_write_rc=$? chmod +x "$tail_subcase_mutant" + reset_fixtures tail_subcase_executions="$work/tail-subcase-executions" : > "$tail_subcase_executions" tail_subcase_rc=0 @@ -545,6 +547,7 @@ if [ -f "$local_onboarding" ] && [ -f "$install_lifecycle" ]; then END { if (changes != 1) exit 1 } ' "$replica_lifecycle" > "$tail_id_mutant" || tail_id_write_rc=$? chmod +x "$tail_id_mutant" + reset_fixtures tail_id_executions="$work/tail-id-executions" : > "$tail_id_executions" tail_id_rc=0 From 7fee5d018c4ea1a0d41f5288eb4037fbc07441be Mon Sep 17 00:00:00 2001 From: xormania <127287135+xormania@users.noreply.github.com> Date: Sun, 2 Aug 2026 17:50:32 -0400 Subject: [PATCH 5/6] test(ci): require lifecycle wrapper diagnostics --- tests/experiment/aggregate-harness-cases.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/experiment/aggregate-harness-cases.sh b/tests/experiment/aggregate-harness-cases.sh index 017af5d..b6d0fea 100755 --- a/tests/experiment/aggregate-harness-cases.sh +++ b/tests/experiment/aggregate-harness-cases.sh @@ -574,8 +574,12 @@ if [ -f "$local_onboarding" ] && [ -f "$install_lifecycle" ]; then mv "$saved_lifecycle" "$replica_lifecycle" if infrastructure_output_valid \ "$work/missing-local-core.out" 86 "$missing_local_core_rc" && + grep -Fxq 'INFRA shared lifecycle core unavailable' \ + "$work/missing-local-core.out" && infrastructure_output_valid \ - "$work/missing-install-core.out" 47 "$missing_install_core_rc"; then + "$work/missing-install-core.out" 47 "$missing_install_core_rc" && + grep -Fxq 'INFRA shared lifecycle core unavailable' \ + "$work/missing-install-core.out"; then wrapper_infrastructure_contract=1 fi fi From 0c64cb87e435a411844fe682ce4618e8956d02d0 Mon Sep 17 00:00:00 2001 From: xormania <127287135+xormania@users.noreply.github.com> Date: Sun, 2 Aug 2026 17:52:22 -0400 Subject: [PATCH 6/6] fix(ci): harden split lifecycle routes --- tests/experiment/install-lifecycle-cases.sh | 6 +++ tests/experiment/local-lifecycle-cases.sh | 50 +++++++++++++++++++-- tests/experiment/local-onboarding-cases.sh | 6 +++ 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/tests/experiment/install-lifecycle-cases.sh b/tests/experiment/install-lifecycle-cases.sh index f8b11a9..78d7ece 100755 --- a/tests/experiment/install-lifecycle-cases.sh +++ b/tests/experiment/install-lifecycle-cases.sh @@ -2,4 +2,10 @@ set -u -o pipefail script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +if [ ! -f "$script_dir/local-lifecycle-cases.sh" ] || + [ ! -r "$script_dir/local-lifecycle-cases.sh" ]; then + printf 'INFRA shared lifecycle core unavailable\n' >&2 + printf 'SUMMARY assertions=0 expected=47 failures=0 infra=1\n' + exit 125 +fi exec bash "$script_dir/local-lifecycle-cases.sh" install diff --git a/tests/experiment/local-lifecycle-cases.sh b/tests/experiment/local-lifecycle-cases.sh index d2fae43..61d2c40 100755 --- a/tests/experiment/local-lifecycle-cases.sh +++ b/tests/experiment/local-lifecycle-cases.sh @@ -29,6 +29,7 @@ case "$route" in expected_start=1 expected_count=133 lane_count=3 + lane_map=(0 1 2 0 1 2 0) final_marker='EXPERIMENT LOCAL LIFECYCLE PASS' ;; local) @@ -36,7 +37,8 @@ case "$route" in selected_count=3 expected_start=1 expected_count=86 - lane_count=1 + lane_count=2 + lane_map=(0 0 1) final_marker='EXPERIMENT LOCAL LIFECYCLE PASS' ;; install) @@ -45,6 +47,7 @@ case "$route" in expected_start=87 expected_count=47 lane_count=1 + lane_map=(0 0 0 0) final_marker='EXPERIMENT INSTALL LIFECYCLE PASS' ;; *) @@ -54,9 +57,41 @@ case "$route" in esac readonly route selected_start selected_count expected_start expected_count readonly lane_count +readonly lane_map readonly final_marker subcases=("${all_subcases[@]:$selected_start:$selected_count}") readonly subcases + +infrastructure_exit() { + printf 'SUMMARY assertions=0 expected=%s failures=0 infra=1\n' "$expected_count" + exit 125 +} + +if [ "${#all_subcases[@]}" -ne 7 ] || + [ "${#subcases[@]}" -ne "$selected_count" ] || + [ "${#lane_map[@]}" -ne "$selected_count" ]; then + infrastructure_exit +fi + +for mapped_lane in "${lane_map[@]}"; do + case "$mapped_lane" in + '' | *[!0-9]*) infrastructure_exit ;; + esac + if ((10#$mapped_lane >= lane_count)); then + infrastructure_exit + fi +done +for ((required_lane = 0; required_lane < lane_count; required_lane++)); do + lane_present=0 + for mapped_lane in "${lane_map[@]}"; do + if ((10#$mapped_lane == required_lane)); then + lane_present=1 + break + fi + done + [ "$lane_present" -eq 1 ] || infrastructure_exit +done + work="" lane_pids=() lifecycle_pid="$$" @@ -159,10 +194,17 @@ printf '%s\n' \ M-STORE-DUR-001 M-STORE-LAYOUT-001 M-STORE-KEY-001 M-STORE-VERIFY-001 \ M-STORE-LIVE-001 M-STORE-UNCERT-001 M-STORE-STAGE-001 > "$expected" mv "$expected" "$expected_all" +expected_all_count="$(wc -l < "$expected_all" 2>/dev/null || true)" +if [ "$expected_all_count" != 133 ]; then + infrastructure_exit +fi if ! awk -v start="$expected_start" -v count="$expected_count" \ 'NR >= start && NR < start + count {print}' "$expected_all" > "$expected"; then - printf 'SUMMARY assertions=0 expected=%s failures=0 infra=1\n' "$expected_count" - exit 125 + infrastructure_exit +fi +expected_selected_count="$(wc -l < "$expected" 2>/dev/null || true)" +if [ "$expected_selected_count" != "$expected_count" ]; then + infrastructure_exit fi : > "$observed" @@ -206,7 +248,7 @@ run_lane() { local lane_infrastructure=0 for index in "${!subcases[@]}"; do - [ $((index % lane_count)) -eq "$lane" ] || continue + [ "${lane_map[$index]}" -eq "$lane" ] || continue run_subcase "$index" || lane_infrastructure=1 done [ "$lane_infrastructure" -eq 0 ] diff --git a/tests/experiment/local-onboarding-cases.sh b/tests/experiment/local-onboarding-cases.sh index 277c21d..73f388f 100755 --- a/tests/experiment/local-onboarding-cases.sh +++ b/tests/experiment/local-onboarding-cases.sh @@ -2,4 +2,10 @@ set -u -o pipefail script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +if [ ! -f "$script_dir/local-lifecycle-cases.sh" ] || + [ ! -r "$script_dir/local-lifecycle-cases.sh" ]; then + printf 'INFRA shared lifecycle core unavailable\n' >&2 + printf 'SUMMARY assertions=0 expected=86 failures=0 infra=1\n' + exit 125 +fi exec bash "$script_dir/local-lifecycle-cases.sh" local