Add runtime boundary promotion gates

This commit is contained in:
2026-06-11 15:03:54 +08:00
parent 1ab5571ae1
commit 949d5d2756
9 changed files with 3563 additions and 70 deletions

View File

@@ -200,6 +200,8 @@ check_native_runtime_probe_summary_row() {
local boundary_kind="$2"
local target="$3"
local runtime_probe="$4"
local expected_required_native_proof="$5"
local expected_opt_in_env="$6"
local summary_file="$BUILD_DIR/native-runtime-probe-summary.tsv"
local row
@@ -224,17 +226,28 @@ check_native_runtime_probe_summary_row() {
local runtime_ready
local source_proof_ready
local required_native_proof
local opt_in_env
local probe_status
local execution_enabled
local promotion_allowed
local missing_requirements
local probe_note
local stdout_log
IFS=$'\t' read -r _ _ _ _ runtime_ready source_proof_ready probe_status execution_enabled promotion_allowed missing_requirements stdout_log <<< "$row"
IFS=$'\t' read -r _ _ _ _ required_native_proof opt_in_env runtime_ready source_proof_ready probe_status execution_enabled promotion_allowed missing_requirements probe_note stdout_log <<< "$row"
if [[ "$source_proof_ready" != "1" ]]; then
echo "$target runtime probe lacks source proof readiness: $source_proof_ready" >&2
exit 1
fi
if [[ "$required_native_proof" != "$expected_required_native_proof" ]]; then
echo "$target runtime probe required native proof drift: $required_native_proof" >&2
exit 1
fi
if [[ "$opt_in_env" != "$expected_opt_in_env" ]]; then
echo "$target runtime probe opt-in env drift: $opt_in_env" >&2
exit 1
fi
if [[ "$execution_enabled" != "0" || "$promotion_allowed" != "0" ]]; then
echo "$target runtime probe unexpectedly enables execution or promotion" >&2
exit 1
@@ -247,10 +260,26 @@ check_native_runtime_probe_summary_row() {
echo "$target runtime probe is not ready but did not skip: $probe_status" >&2
exit 1
fi
if [[ "$runtime_ready" == "0" && "$probe_note" != *"missing_host_runtime"* ]]; then
echo "$target runtime probe missing-runtime note drift: $probe_note" >&2
exit 1
fi
if [[ "$runtime_ready" == "1" && "$missing_requirements" != "-" ]]; then
echo "$target runtime probe is ready but lists missing requirements: $missing_requirements" >&2
exit 1
fi
if [[ "$probe_status" == "ready_disabled_by_default" && "$probe_note" != *"set_${opt_in_env%%=*}"* ]]; then
echo "$target runtime probe ready-disabled note drift: $probe_note" >&2
exit 1
fi
if [[ "$probe_status" == runtime_*_passed && "$probe_note" != *"without_promotion"* ]]; then
echo "$target runtime probe passed note drift: $probe_note" >&2
exit 1
fi
if [[ "$probe_note" == "-" || -z "$probe_note" ]]; then
echo "$target runtime probe lacks note" >&2
exit 1
fi
if [[ ! -f "$BUILD_DIR/$stdout_log" ]]; then
echo "$target runtime summary references missing stdout log: $stdout_log" >&2
exit 1
@@ -266,7 +295,7 @@ check_native_runtime_probe_summary() {
fi
local expected_header
expected_header=$'boundary_class\tboundary_kind\ttarget\truntime_probe\truntime_ready\tsource_proof_ready\tprobe_status\texecution_enabled\tpromotion_allowed\tmissing_requirements\tstdout_log'
expected_header=$'boundary_class\tboundary_kind\ttarget\truntime_probe\trequired_native_proof\topt_in_env\truntime_ready\tsource_proof_ready\tprobe_status\texecution_enabled\tpromotion_allowed\tmissing_requirements\tprobe_note\tstdout_log'
if [[ "$(sed -n '1p' "$summary_file")" != "$expected_header" ]]; then
echo "native runtime probe summary header drift: $summary_file" >&2
exit 1
@@ -283,17 +312,23 @@ check_native_runtime_probe_summary() {
L4-USER-M-PROCESS \
external_user_m_process \
axis/vismach/millturn/example.ngc \
linuxcnc_millturn_user_m_runtime_probe
linuxcnc_millturn_user_m_runtime_probe \
native_runtime_state_probe_required \
ENABLE_MILLTURN_USER_M_RUNTIME_PROBE=1
check_native_runtime_probe_summary_row \
L4-TOOL-DB \
tool_database_process \
axis/db_demo/base.ngc \
linuxcnc_tool_db_runtime_probe
linuxcnc_tool_db_runtime_probe \
native_db_process_protocol_probe_required \
ENABLE_TOOL_DB_RUNTIME_PROBE=1
check_native_runtime_probe_summary_row \
L4-PYTHON-REMAP \
python_runtime \
axis/remap/stop-lookahead/nc_files \
linuxcnc_python_remap_runtime_probe
linuxcnc_python_remap_runtime_probe \
linuxcnc_python_runtime_lifecycle_probe_required \
ENABLE_PYTHON_REMAP_RUNTIME_PROBE=1
}
check_source_probe_coverage
@@ -609,6 +644,7 @@ grep -Fq "millturn_user_m_runtime_requirements=" "$MILLTURN_USER_M_RUNTIME_STDOU
grep -Fq "millturn_user_m_source_proof_ready=1" "$MILLTURN_USER_M_RUNTIME_STDOUT"
grep -Fq "millturn_user_m_execution_enabled=0" "$MILLTURN_USER_M_RUNTIME_STDOUT"
grep -Fq "millturn_user_m_promotion_allowed=0" "$MILLTURN_USER_M_RUNTIME_STDOUT"
grep -Fq "millturn_user_m_runtime_probe_note=" "$MILLTURN_USER_M_RUNTIME_STDOUT"
if grep -Fq "millturn_user_m_runtime_ready=1" "$MILLTURN_USER_M_RUNTIME_STDOUT"; then
grep -Eq "millturn_user_m_runtime_probe_status=(ready_disabled_by_default|runtime_state_probe_passed)" \
"$MILLTURN_USER_M_RUNTIME_STDOUT"
@@ -648,6 +684,7 @@ grep -Fq "tool_db_runtime_requirements=" "$TOOL_DB_RUNTIME_STDOUT"
grep -Fq "tool_db_source_proof_ready=1" "$TOOL_DB_RUNTIME_STDOUT"
grep -Fq "tool_db_execution_enabled=0" "$TOOL_DB_RUNTIME_STDOUT"
grep -Fq "tool_db_promotion_allowed=0" "$TOOL_DB_RUNTIME_STDOUT"
grep -Fq "tool_db_runtime_probe_note=" "$TOOL_DB_RUNTIME_STDOUT"
if grep -Fq "tool_db_runtime_ready=1" "$TOOL_DB_RUNTIME_STDOUT"; then
grep -Eq "tool_db_runtime_probe_status=(ready_disabled_by_default|runtime_protocol_probe_passed)" \
"$TOOL_DB_RUNTIME_STDOUT"
@@ -697,6 +734,7 @@ grep -Fq "python_remap_runtime_modules=axis/remap/stop-lookahead/python/remap.py
grep -Fq "python_remap_source_proof_ready=1" "$PYTHON_REMAP_RUNTIME_STDOUT"
grep -Fq "python_remap_execution_enabled=0" "$PYTHON_REMAP_RUNTIME_STDOUT"
grep -Fq "python_remap_promotion_allowed=0" "$PYTHON_REMAP_RUNTIME_STDOUT"
grep -Fq "python_remap_runtime_probe_note=" "$PYTHON_REMAP_RUNTIME_STDOUT"
if grep -Fq "python_remap_runtime_ready=1" "$PYTHON_REMAP_RUNTIME_STDOUT"; then
grep -Eq "python_remap_runtime_probe_status=(ready_disabled_by_default|runtime_lifecycle_probe_passed)" \
"$PYTHON_REMAP_RUNTIME_STDOUT"