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

@@ -90,14 +90,23 @@
"native_source_proof_alignment",
"runtime_native_alignment_artifacts",
"native_runtime_probe_summary",
"runtime_probe_gate_alignment",
"native_runtime_probe_execution_plan",
"native_runtime_probe_pass_evidence_contract",
"runtime_boundary_promotion_readiness",
"runtime_boundary_promotion_blockers",
"runtime_boundary_post_native_pass_gates",
"runtime_boundary_host_preflight",
"user_m_transition_contract",
"user_m_native_runtime_state_plan",
"user_m_native_runtime_readiness",
"user_m_native_runtime_probe_gate",
"tool_db_transaction_contract",
"tool_db_native_runtime_readiness",
"tool_db_native_runtime_probe_gate",
"python_runtime_contract",
"python_native_runtime_readiness",
"python_native_runtime_probe_gate",
"python_native_runtime_state_plan",
"python_native_runtime_fixture_plan",
"runtime_contract_summary",
@@ -769,6 +778,97 @@
}
}
async function verifyBrowserToolDbNativeRuntimeProbeGate() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/tool-db-process-native-runtime-probe-gate.tsv"),
);
if (rows.length !== 1) {
throw new Error(`browser_tool_db_native_runtime_probe_gate: row count drift ${rows.length}`);
}
const row = rows[0];
if (
row.path !== "axis/db_demo/base.ngc" ||
row.ini !== "axis/db_demo/db_nonran.ini" ||
row.blocked !== "L4-TOOL-DB" ||
row.db_program !== "./db_nonran.py" ||
row.required_runtime !== "linuxcnc_tooldata_db_process"
) {
throw new Error("tool DB runtime probe gate identity drift");
}
if (row.python3_sufficient !== "0" || row.tool_table_fallback_sufficient !== "0") {
throw new Error("tool DB runtime probe gate must reject python3-only and tbl fallback proof");
}
for (const field of [
"python3_available",
"db_program_source_ready",
"linuxcnc_python_modules_ready",
"protocol_contract_ready",
"runtime_ready",
"source_proof_ready",
]) {
if (!["0", "1"].includes(row[field])) {
throw new Error(`tool DB runtime probe gate invalid ${field} ${row[field]}`);
}
}
if (
row.db_program_source_ready !== "1" ||
row.linuxcnc_python_modules_ready !== "1" ||
row.protocol_contract_ready !== "1" ||
row.source_proof_ready !== "1"
) {
throw new Error("tool DB runtime probe gate source readiness drift");
}
for (const requirement of [
"python3",
"linuxcnc",
"milltask",
"halcmd",
"axis/db_demo/db_nonran.py",
"linuxcnc.so",
"tooldb.py",
]) {
if (!row.runtime_requirements.includes(`${requirement}:`)) {
throw new Error(`tool DB runtime probe gate missing ${requirement}`);
}
}
for (const phase of [
"startup_handshake",
"initial_get_all",
"spindle_load_notify",
"tool_offset_notify",
"spindle_unload_notify",
]) {
if (!row.protocol_transactions.includes(`${phase}:`)) {
throw new Error(`tool DB runtime probe gate missing transaction ${phase}`);
}
}
if (
row.required_native_proof !== "native_db_process_protocol_probe_required" ||
row.proof_status !== "pending" ||
row.execution_enabled !== "0" ||
row.promotion_allowed !== "0"
) {
throw new Error("tool DB runtime probe gate must remain pending and disabled");
}
if (!row.notes.includes("fallback_not_sufficient")) {
throw new Error("tool DB runtime probe gate must record fallback insufficiency");
}
if (row.runtime_ready === "1") {
if (
row.missing_requirements !== "-" ||
row.gate_status !== "ready_to_implement_protocol_probe"
) {
throw new Error("ready tool DB runtime probe gate drift");
}
} else if (
row.missing_requirements === "-" ||
row.gate_status !== "blocked_missing_host_runtime"
) {
throw new Error("missing-runtime tool DB probe gate drift");
}
}
async function verifyBrowserPythonRuntimeContract() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/python-remap-runtime-contract.tsv"),
@@ -920,6 +1020,91 @@
}
}
async function verifyBrowserPythonNativeRuntimeProbeGate() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/python-remap-native-runtime-probe-gate.tsv"),
);
if (rows.length !== 1) {
throw new Error(`browser_python_native_runtime_probe_gate: row count drift ${rows.length}`);
}
const row = rows[0];
if (
row.family !== "axis/remap/stop-lookahead/nc_files" ||
row.blocked !== "L4-PYTHON-REMAP" ||
row.fixture_id !== "stop_lookahead_python_runtime_lifecycle" ||
row.required_runtime !== "linuxcnc_python_remap_runtime"
) {
throw new Error(`${row.family}: Python runtime probe gate identity drift`);
}
if (row.python3_sufficient !== "0") {
throw new Error(`${row.family}: python3 alone must not satisfy Python remap readiness`);
}
for (const field of [
"python3_available",
"linuxcnc_available",
"runtime_owner_sources_ready",
"representative_modules_ready",
"runtime_ready",
"source_proof_ready",
]) {
if (!["0", "1"].includes(row[field])) {
throw new Error(`${row.family}: invalid ${field} ${row[field]}`);
}
}
if (
row.runtime_owner_sources_ready !== "1" ||
row.representative_modules_ready !== "1" ||
row.source_proof_ready !== "1"
) {
throw new Error(`${row.family}: Python runtime probe gate source readiness drift`);
}
for (const requirement of [
"python3",
"linuxcnc",
"src/emc/rs274ngc/interp_python.cc",
"src/emc/pythonplugin/python_plugin.cc",
"axis/remap/stop-lookahead/python/remap.py",
"axis/remap/stop-lookahead/python/toplevel.py",
]) {
if (!row.runtime_requirements.includes(`${requirement}:`)) {
throw new Error(`${row.family}: Python runtime probe gate missing ${requirement}`);
}
}
for (const modulePath of [
"axis/remap/stop-lookahead/python/remap.py",
"axis/remap/stop-lookahead/python/toplevel.py",
]) {
if (!row.representative_module_imports.includes(`import:${modulePath}`)) {
throw new Error(`${row.family}: Python runtime probe gate missing representative import ${modulePath}`);
}
}
if (
row.required_native_proof !== "linuxcnc_python_runtime_lifecycle_probe_required" ||
row.proof_status !== "pending" ||
row.execution_enabled !== "0" ||
row.promotion_allowed !== "0"
) {
throw new Error(`${row.family}: Python runtime probe gate must remain pending and disabled`);
}
if (!row.notes.includes("python3_alone_not_sufficient")) {
throw new Error(`${row.family}: Python runtime probe gate must record python3-only guard`);
}
if (row.runtime_ready === "1") {
if (
row.missing_requirements !== "-" ||
row.gate_status !== "ready_to_implement_lifecycle_probe"
) {
throw new Error(`${row.family}: ready Python runtime probe gate drift`);
}
} else if (
row.missing_requirements === "-" ||
row.gate_status !== "blocked_missing_host_runtime"
) {
throw new Error(`${row.family}: missing-runtime Python probe gate drift`);
}
}
async function verifyBrowserPythonNativeRuntimeStatePlan() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/python-remap-native-runtime-state-plan.tsv"),
@@ -1232,6 +1417,8 @@
boundaryKind: "external_user_m_process",
target: "axis/vismach/millturn/example.ngc",
runtimeProbe: "linuxcnc_millturn_user_m_runtime_probe",
requiredNativeProof: "native_runtime_state_probe_required",
optInEnv: "ENABLE_MILLTURN_USER_M_RUNTIME_PROBE=1",
},
],
[
@@ -1240,6 +1427,8 @@
boundaryKind: "tool_database_process",
target: "axis/db_demo/base.ngc",
runtimeProbe: "linuxcnc_tool_db_runtime_probe",
requiredNativeProof: "native_db_process_protocol_probe_required",
optInEnv: "ENABLE_TOOL_DB_RUNTIME_PROBE=1",
},
],
[
@@ -1248,6 +1437,8 @@
boundaryKind: "python_runtime",
target: "axis/remap/stop-lookahead/nc_files",
runtimeProbe: "linuxcnc_python_remap_runtime_probe",
requiredNativeProof: "linuxcnc_python_runtime_lifecycle_probe_required",
optInEnv: "ENABLE_PYTHON_REMAP_RUNTIME_PROBE=1",
},
],
]);
@@ -1264,7 +1455,9 @@
if (
row.boundary_kind !== expectedRow.boundaryKind ||
row.target !== expectedRow.target ||
row.runtime_probe !== expectedRow.runtimeProbe
row.runtime_probe !== expectedRow.runtimeProbe ||
row.required_native_proof !== expectedRow.requiredNativeProof ||
row.opt_in_env !== expectedRow.optInEnv
) {
throw new Error(`${row.boundary_class}: native runtime probe metadata drift`);
}
@@ -1289,6 +1482,25 @@
if (row.runtime_ready === "0" && row.probe_status !== "skipped_missing_host_runtime") {
throw new Error(`${row.boundary_class}: non-ready runtime must remain skipped`);
}
if (row.runtime_ready === "0" && !row.probe_note.includes("missing_host_runtime")) {
throw new Error(`${row.boundary_class}: missing-runtime probe note drift`);
}
if (
row.probe_status === "ready_disabled_by_default" &&
!row.probe_note.includes(`set_${row.opt_in_env.split("=")[0]}`)
) {
throw new Error(`${row.boundary_class}: ready-disabled probe note drift`);
}
if (
row.probe_status.startsWith("runtime_") &&
row.probe_status.endsWith("_passed") &&
!row.probe_note.includes("without_promotion")
) {
throw new Error(`${row.boundary_class}: passed probe note drift`);
}
if (row.probe_note === "-") {
throw new Error(`${row.boundary_class}: native runtime probe lacks note`);
}
if (row.execution_enabled !== "0" || row.promotion_allowed !== "0") {
throw new Error(`${row.boundary_class}: native runtime probe must not enable execution or promotion`);
}
@@ -1298,6 +1510,288 @@
}
}
async function verifyBrowserRuntimeProbeGateAlignment() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/runtime-probe-gate-alignment.tsv"),
);
const expected = new Map([
[
"L4-USER-M-PROCESS",
{
boundaryKind: "external_user_m_process",
target: "axis/vismach/millturn/example.ngc",
gateArtifact: "user-m-process-native-runtime-probe-gate.tsv",
requiredNativeProof: "native_runtime_state_probe_required",
},
],
[
"L4-TOOL-DB",
{
boundaryKind: "tool_database_process",
target: "axis/db_demo/base.ngc",
gateArtifact: "tool-db-process-native-runtime-probe-gate.tsv",
requiredNativeProof: "native_db_process_protocol_probe_required",
},
],
[
"L4-PYTHON-REMAP",
{
boundaryKind: "python_runtime",
target: "axis/remap/stop-lookahead/nc_files",
gateArtifact: "python-remap-native-runtime-probe-gate.tsv",
requiredNativeProof: "linuxcnc_python_runtime_lifecycle_probe_required",
},
],
]);
if (rows.length !== expected.size) {
throw new Error(`browser_runtime_probe_gate_alignment: row count drift ${rows.length}`);
}
for (const row of rows) {
const expectedRow = expected.get(row.boundary_class);
if (!expectedRow) {
throw new Error(`browser_runtime_probe_gate_alignment: unexpected ${row.boundary_class}`);
}
if (
row.boundary_kind !== expectedRow.boundaryKind ||
row.target !== expectedRow.target ||
row.gate_artifact !== expectedRow.gateArtifact ||
row.gate_required_native_proof !== expectedRow.requiredNativeProof ||
row.native_required_native_proof !== expectedRow.requiredNativeProof
) {
throw new Error(`${row.boundary_class}: runtime probe gate alignment metadata drift`);
}
if (!/^ENABLE_[A-Z0-9_]+=1$/.test(row.native_opt_in_env)) {
throw new Error(`${row.boundary_class}: runtime probe gate alignment opt-in drift`);
}
if (row.gate_runtime_ready !== row.native_runtime_ready) {
throw new Error(`${row.boundary_class}: gate/native runtime readiness drift`);
}
if (row.gate_source_proof_ready !== "1" || row.native_source_proof_ready !== "1") {
throw new Error(`${row.boundary_class}: runtime probe gate source proof drift`);
}
for (const field of [
"missing_requirements_match",
"required_native_proof_match",
"execution_disabled_match",
"promotion_disabled_match",
"status_compatible",
"alignment_ok",
]) {
if (row[field] !== "1") {
throw new Error(`${row.boundary_class}: runtime probe gate ${field} failed`);
}
}
if (!row.notes.includes("before_promotion")) {
throw new Error(`${row.boundary_class}: runtime probe gate alignment notes drift`);
}
}
}
async function verifyBrowserNativeRuntimeProbeExecutionPlan() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/native-runtime-probe-execution-plan.tsv"),
);
const expected = new Map([
[
"L4-USER-M-PROCESS",
{
boundaryKind: "external_user_m_process",
target: "axis/vismach/millturn/example.ngc",
runtimeProbe: "linuxcnc_millturn_user_m_runtime_probe",
requiredNativeProof: "native_runtime_state_probe_required",
optInEnv: "ENABLE_MILLTURN_USER_M_RUNTIME_PROBE=1",
script: "wasm-port/tests/native/probe_millturn_user_m_runtime.sh",
expectedPassStatus: "runtime_state_probe_passed",
},
],
[
"L4-TOOL-DB",
{
boundaryKind: "tool_database_process",
target: "axis/db_demo/base.ngc",
runtimeProbe: "linuxcnc_tool_db_runtime_probe",
requiredNativeProof: "native_db_process_protocol_probe_required",
optInEnv: "ENABLE_TOOL_DB_RUNTIME_PROBE=1",
script: "wasm-port/tests/native/probe_tool_db_runtime.sh",
expectedPassStatus: "runtime_protocol_probe_passed",
},
],
[
"L4-PYTHON-REMAP",
{
boundaryKind: "python_runtime",
target: "axis/remap/stop-lookahead/nc_files",
runtimeProbe: "linuxcnc_python_remap_runtime_probe",
requiredNativeProof: "linuxcnc_python_runtime_lifecycle_probe_required",
optInEnv: "ENABLE_PYTHON_REMAP_RUNTIME_PROBE=1",
script: "wasm-port/tests/native/probe_python_remap_runtime.sh",
expectedPassStatus: "runtime_lifecycle_probe_passed",
},
],
]);
if (rows.length !== expected.size) {
throw new Error(`browser_native_runtime_probe_execution_plan: row count drift ${rows.length}`);
}
for (const row of rows) {
const expectedRow = expected.get(row.boundary_class);
if (!expectedRow) {
throw new Error(`browser_native_runtime_probe_execution_plan: unexpected ${row.boundary_class}`);
}
if (
row.boundary_kind !== expectedRow.boundaryKind ||
row.target !== expectedRow.target ||
row.runtime_probe !== expectedRow.runtimeProbe ||
row.required_native_proof !== expectedRow.requiredNativeProof ||
row.opt_in_env !== expectedRow.optInEnv ||
row.expected_pass_status !== expectedRow.expectedPassStatus
) {
throw new Error(`${row.boundary_class}: native runtime execution plan metadata drift`);
}
if (row.execution_command !== `${expectedRow.optInEnv} bash ${expectedRow.script}`) {
throw new Error(`${row.boundary_class}: native runtime execution command drift`);
}
if (row.source_proof_ready !== "1" || row.gate_alignment_ok !== "1") {
throw new Error(`${row.boundary_class}: native runtime execution plan is not source/alignment ready`);
}
if (row.execution_enabled !== "0" || row.promotion_allowed !== "0") {
throw new Error(`${row.boundary_class}: native runtime execution plan must not enable execution or promotion`);
}
for (const requirement of [
`native:${expectedRow.expectedPassStatus}`,
"node:inventory_gate_alignment_after_native_pass",
"browser:smoke_gate_alignment_after_node_pass",
"manual:promotion_lock_update_required",
]) {
if (!row.promotion_requires.includes(requirement)) {
throw new Error(`${row.boundary_class}: native runtime execution plan missing ${requirement}`);
}
}
if (row.current_probe_status === row.expected_pass_status) {
if (row.plan_status !== "native_probe_passed_waiting_for_node_browser_promotion_proof") {
throw new Error(`${row.boundary_class}: passed execution plan status drift`);
}
} else if (row.runtime_ready === "1") {
if (row.plan_status !== "ready_to_run_opt_in_probe" || row.missing_requirements !== "-") {
throw new Error(`${row.boundary_class}: ready execution plan status drift`);
}
} else if (
row.plan_status !== "blocked_missing_host_runtime" ||
row.missing_requirements === "-"
) {
throw new Error(`${row.boundary_class}: blocked execution plan status drift`);
}
if (!row.notes.includes("no_automatic_promotion")) {
throw new Error(`${row.boundary_class}: native runtime execution plan notes drift`);
}
}
}
async function verifyBrowserNativeRuntimeProbePassEvidenceContract() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/native-runtime-probe-pass-evidence-contract.tsv"),
);
const expected = new Map([
[
"L4-USER-M-PROCESS",
{
boundaryKind: "external_user_m_process",
target: "axis/vismach/millturn/example.ngc",
runtimeProbe: "linuxcnc_millturn_user_m_runtime_probe",
expectedPassStatus: "runtime_state_probe_passed",
evidence: [
"millturn_user_m_runtime_probe_status=runtime_state_probe_passed",
"millturn_user_m_M128_runtime_state_ok=1",
"millturn_user_m_M129_runtime_state_ok=1",
],
},
],
[
"L4-TOOL-DB",
{
boundaryKind: "tool_database_process",
target: "axis/db_demo/base.ngc",
runtimeProbe: "linuxcnc_tool_db_runtime_probe",
expectedPassStatus: "runtime_protocol_probe_passed",
evidence: [
"tool_db_runtime_probe_status=runtime_protocol_probe_passed",
"tool_db_protocol_version=v2.1",
"tool_db_runtime_protocol_probe_ok=1",
"tool_db_persistence_state_ok=1",
],
},
],
[
"L4-PYTHON-REMAP",
{
boundaryKind: "python_runtime",
target: "axis/remap/stop-lookahead/nc_files",
runtimeProbe: "linuxcnc_python_remap_runtime_probe",
expectedPassStatus: "runtime_lifecycle_probe_passed",
evidence: [
"python_remap_runtime_probe_status=runtime_lifecycle_probe_passed",
"python_remap_lifecycle_generator_first_yield=2",
"python_remap_runtime_lifecycle_probe_ok=1",
],
},
],
]);
if (rows.length !== expected.size) {
throw new Error(`browser_native_runtime_probe_pass_evidence_contract: row count drift ${rows.length}`);
}
for (const row of rows) {
const expectedRow = expected.get(row.boundary_class);
if (!expectedRow) {
throw new Error(`browser_native_runtime_probe_pass_evidence_contract: unexpected ${row.boundary_class}`);
}
if (
row.boundary_kind !== expectedRow.boundaryKind ||
row.target !== expectedRow.target ||
row.runtime_probe !== expectedRow.runtimeProbe ||
row.expected_pass_status !== expectedRow.expectedPassStatus ||
row.stdout_log === "-"
) {
throw new Error(`${row.boundary_class}: native pass evidence metadata drift`);
}
for (const evidence of expectedRow.evidence) {
if (!row.expected_evidence_keys.includes(evidence)) {
throw new Error(`${row.boundary_class}: native pass evidence missing ${evidence}`);
}
}
if (row.execution_enabled !== "0" || row.promotion_allowed !== "0") {
throw new Error(`${row.boundary_class}: native pass evidence contract must not enable execution or promotion`);
}
if (row.current_probe_status === row.expected_pass_status) {
if (
row.evidence_required_now !== "1" ||
row.observed_evidence_ready !== "1" ||
row.missing_evidence_keys !== "-" ||
row.evidence_status !== "native_pass_evidence_observed"
) {
throw new Error(`${row.boundary_class}: native pass evidence must be observed after pass`);
}
} else if (
row.evidence_required_now !== "0" ||
row.observed_evidence_ready !== "0" ||
row.missing_evidence_keys !== "-" ||
row.evidence_status !== "pending_until_native_pass"
) {
throw new Error(`${row.boundary_class}: native pass evidence must remain pending before pass`);
}
if (
!row.notes.includes("no_automatic_promotion") &&
!row.notes.includes("before_node_browser_promotion")
) {
throw new Error(`${row.boundary_class}: native pass evidence notes drift`);
}
}
}
async function verifyBrowserRuntimeBoundaryContractSummary() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/runtime-boundary-contract-summary.tsv"),
@@ -1442,6 +1936,346 @@
}
}
async function verifyBrowserRuntimeBoundaryPromotionReadiness() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/runtime-boundary-promotion-readiness.tsv"),
);
const expected = new Map([
[
"L4-USER-M-PROCESS",
{
boundaryKind: "external_user_m_process",
target: "axis/vismach/millturn/example.ngc",
blocked: "L4-USER-M-PROCESS",
expectedPassStatus: "runtime_state_probe_passed",
},
],
[
"L4-TOOL-DB",
{
boundaryKind: "tool_database_process",
target: "axis/db_demo/base.ngc",
blocked: "L4-TOOL-DB",
expectedPassStatus: "runtime_protocol_probe_passed",
},
],
[
"L4-PYTHON-REMAP",
{
boundaryKind: "python_runtime",
target: "axis/remap/stop-lookahead/nc_files",
blocked: "L4-PYTHON-REMAP",
expectedPassStatus: "runtime_lifecycle_probe_passed",
},
],
]);
if (rows.length !== expected.size) {
throw new Error(`browser_runtime_boundary_promotion_readiness: row count drift ${rows.length}`);
}
for (const row of rows) {
const expectedRow = expected.get(row.boundary_class);
if (!expectedRow) {
throw new Error(`browser_runtime_boundary_promotion_readiness: unexpected ${row.boundary_class}`);
}
if (
row.boundary_kind !== expectedRow.boundaryKind ||
row.target !== expectedRow.target ||
row.blocked !== expectedRow.blocked ||
row.expected_pass_status !== expectedRow.expectedPassStatus ||
row.native_evidence_status === "-"
) {
throw new Error(`${row.boundary_class}: promotion readiness metadata drift`);
}
if (
row.node_inventory_gate_complete !== "0" ||
row.browser_smoke_gate_complete !== "0" ||
row.promotion_lock_active !== "1" ||
row.manual_lock_update_required !== "1" ||
row.promotion_ready !== "0" ||
row.execution_enabled !== "0" ||
row.promotion_allowed !== "0"
) {
throw new Error(`${row.boundary_class}: promotion readiness must remain locked`);
}
if (row.current_probe_status === row.expected_pass_status) {
if (row.native_pass_ready !== "1" || row.blocking_reason === "awaiting_native_runtime_probe_pass") {
throw new Error(`${row.boundary_class}: passed promotion readiness state drift`);
}
} else if (
row.native_pass_ready !== "0" ||
row.blocking_reason !== "awaiting_native_runtime_probe_pass"
) {
throw new Error(`${row.boundary_class}: pending promotion readiness state drift`);
}
if (!row.notes.includes("no_automatic_promotion")) {
throw new Error(`${row.boundary_class}: promotion readiness notes drift`);
}
}
}
async function verifyBrowserRuntimeBoundaryPromotionBlockers() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/runtime-boundary-promotion-blockers.tsv"),
);
const expected = new Map([
[
"L4-USER-M-PROCESS",
{
boundaryKind: "external_user_m_process",
target: "axis/vismach/millturn/example.ngc",
blocked: "L4-USER-M-PROCESS",
},
],
[
"L4-TOOL-DB",
{
boundaryKind: "tool_database_process",
target: "axis/db_demo/base.ngc",
blocked: "L4-TOOL-DB",
},
],
[
"L4-PYTHON-REMAP",
{
boundaryKind: "python_runtime",
target: "axis/remap/stop-lookahead/nc_files",
blocked: "L4-PYTHON-REMAP",
},
],
]);
if (rows.length !== expected.size) {
throw new Error(`browser_runtime_boundary_promotion_blockers: row count drift ${rows.length}`);
}
for (const row of rows) {
const expectedRow = expected.get(row.boundary_class);
if (!expectedRow) {
throw new Error(`browser_runtime_boundary_promotion_blockers: unexpected ${row.boundary_class}`);
}
if (
row.boundary_kind !== expectedRow.boundaryKind ||
row.target !== expectedRow.target ||
row.blocked !== expectedRow.blocked
) {
throw new Error(`${row.boundary_class}: promotion blocker metadata drift`);
}
if (
row.promotion_ready !== "0" ||
row.execution_enabled !== "0" ||
row.promotion_allowed !== "0" ||
row.blocker_keys === "-" ||
row.next_unblock_action === "-"
) {
throw new Error(`${row.boundary_class}: promotion blocker summary must remain blocked and actionable`);
}
if (!/^[1-9][0-9]*$/.test(row.blocker_count)) {
throw new Error(`${row.boundary_class}: invalid promotion blocker count`);
}
for (const blocker of [
"node_inventory_gate_not_complete",
"browser_smoke_gate_not_complete",
"promotion_lock_active",
"manual_lock_update_required",
]) {
if (!row.blocker_keys.includes(blocker)) {
throw new Error(`${row.boundary_class}: promotion blocker missing ${blocker}`);
}
}
if (
row.missing_runtime_requirements !== "-" &&
!row.blocker_keys.includes("host_runtime_requirements_missing")
) {
throw new Error(`${row.boundary_class}: host runtime blocker missing`);
}
if (!row.notes.includes("no_automatic_promotion")) {
throw new Error(`${row.boundary_class}: promotion blocker notes drift`);
}
}
}
async function verifyBrowserRuntimeBoundaryPostNativePassGates() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/runtime-boundary-post-native-pass-gates.tsv"),
);
const expected = new Map([
[
"L4-USER-M-PROCESS",
{
boundaryKind: "external_user_m_process",
target: "axis/vismach/millturn/example.ngc",
blocked: "L4-USER-M-PROCESS",
nodeProof: "not_user_m_event_only",
browserProof: "no_full_process_claim",
},
],
[
"L4-TOOL-DB",
{
boundaryKind: "tool_database_process",
target: "axis/db_demo/base.ngc",
blocked: "L4-TOOL-DB",
nodeProof: "not_tbl_fallback",
browserProof: "opfs_persistence_only",
},
],
[
"L4-PYTHON-REMAP",
{
boundaryKind: "python_runtime",
target: "axis/remap/stop-lookahead/nc_files",
blocked: "L4-PYTHON-REMAP",
nodeProof: "not_js_semantics",
browserProof: "no_full_process_claim",
},
],
]);
if (rows.length !== expected.size) {
throw new Error(`browser_runtime_boundary_post_native_pass_gates: row count drift ${rows.length}`);
}
for (const row of rows) {
const expectedRow = expected.get(row.boundary_class);
if (!expectedRow) {
throw new Error(`browser_runtime_boundary_post_native_pass_gates: unexpected ${row.boundary_class}`);
}
if (
row.boundary_kind !== expectedRow.boundaryKind ||
row.target !== expectedRow.target ||
row.blocked !== expectedRow.blocked
) {
throw new Error(`${row.boundary_class}: post-native-pass gate metadata drift`);
}
if (
!row.required_node_proof.includes(expectedRow.nodeProof) ||
!row.required_browser_proof.includes(expectedRow.browserProof)
) {
throw new Error(`${row.boundary_class}: post-native-pass proof requirement drift`);
}
if (
row.manual_lock_update_required !== "1" ||
row.promotion_lock_active !== "1" ||
row.execution_enabled !== "0" ||
row.promotion_allowed !== "0"
) {
throw new Error(`${row.boundary_class}: post-native-pass gate must remain locked`);
}
if (row.native_evidence_ready === "1") {
if (
row.native_pass_ready !== "1" ||
row.node_gate_status !== "pending_node_inventory_promotion_gate" ||
row.browser_gate_status !== "blocked_until_node_gate_complete" ||
row.gate_status !== "waiting_for_node_browser_manual_promotion"
) {
throw new Error(`${row.boundary_class}: post-native-pass ready state drift`);
}
} else if (
row.node_gate_status !== "blocked_until_native_pass_evidence" ||
row.browser_gate_status !== "blocked_until_node_gate_complete" ||
row.gate_status !== "blocked_before_native_pass"
) {
throw new Error(`${row.boundary_class}: post-native-pass blocked state drift`);
}
if (!row.notes.includes("no_automatic_promotion")) {
throw new Error(`${row.boundary_class}: post-native-pass notes drift`);
}
}
}
async function verifyBrowserRuntimeBoundaryHostPreflight() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/runtime-boundary-host-preflight.tsv"),
);
const expected = new Map([
[
"L4-USER-M-PROCESS",
{
boundaryKind: "external_user_m_process",
target: "axis/vismach/millturn/example.ngc",
blocked: "L4-USER-M-PROCESS",
requiredRuntime: "linuxcnc_task_hal_tcl_user_m_process",
optInEnv: "ENABLE_MILLTURN_USER_M_RUNTIME_PROBE=1",
script: "probe_millturn_user_m_runtime.sh",
missingToken: "linuxcnc",
},
],
[
"L4-TOOL-DB",
{
boundaryKind: "tool_database_process",
target: "axis/db_demo/base.ngc",
blocked: "L4-TOOL-DB",
requiredRuntime: "linuxcnc_tooldata_db_process",
optInEnv: "ENABLE_TOOL_DB_RUNTIME_PROBE=1",
script: "probe_tool_db_runtime.sh",
missingToken: "milltask",
},
],
[
"L4-PYTHON-REMAP",
{
boundaryKind: "python_runtime",
target: "axis/remap/stop-lookahead/nc_files",
blocked: "L4-PYTHON-REMAP",
requiredRuntime: "linuxcnc_python_remap_runtime",
optInEnv: "ENABLE_PYTHON_REMAP_RUNTIME_PROBE=1",
script: "probe_python_remap_runtime.sh",
missingToken: "linuxcnc",
},
],
]);
if (rows.length !== expected.size) {
throw new Error(`browser_runtime_boundary_host_preflight: row count drift ${rows.length}`);
}
for (const row of rows) {
const expectedRow = expected.get(row.boundary_class);
if (!expectedRow) {
throw new Error(`browser_runtime_boundary_host_preflight: unexpected ${row.boundary_class}`);
}
if (
row.boundary_kind !== expectedRow.boundaryKind ||
row.target !== expectedRow.target ||
row.blocked !== expectedRow.blocked ||
row.required_runtime !== expectedRow.requiredRuntime ||
row.opt_in_env !== expectedRow.optInEnv
) {
throw new Error(`${row.boundary_class}: host preflight metadata drift`);
}
if (
row.source_proof_ready !== "1" ||
row.required_native_proof === "-" ||
row.runtime_requirements === "-" ||
!row.runtime_requirements.includes(`${expectedRow.missingToken}:`)
) {
throw new Error(`${row.boundary_class}: host preflight readiness evidence drift`);
}
if (row.execution_command !== `${row.opt_in_env} bash wasm-port/tests/native/${expectedRow.script}`) {
throw new Error(`${row.boundary_class}: host preflight execution command drift`);
}
if (row.execution_enabled !== "0" || row.promotion_allowed !== "0") {
throw new Error(`${row.boundary_class}: host preflight must not enable execution or promotion`);
}
if (row.runtime_ready === "1") {
if (row.missing_requirements !== "-" || row.preflight_status !== "ready_to_run_opt_in_native_probe") {
throw new Error(`${row.boundary_class}: ready host preflight drift`);
}
} else if (
!row.missing_requirements.includes(expectedRow.missingToken) ||
row.preflight_status !== "blocked_missing_host_runtime"
) {
throw new Error(`${row.boundary_class}: blocked host preflight drift`);
}
if (!row.notes.includes("no_automatic_promotion")) {
throw new Error(`${row.boundary_class}: host preflight notes drift`);
}
}
}
async function verifyBrowserNextBoundaryRecommendations() {
const rows = parseTsv(
await fetchText("../../build/wasm/sim-configs-inventory/next-boundary-recommendations.tsv"),
@@ -2086,17 +2920,26 @@
await verifyBrowserUserMNativeRuntimeProbeGate();
await verifyBrowserToolDbTransactionPlan();
await verifyBrowserToolDbNativeRuntimeReadiness();
await verifyBrowserToolDbNativeRuntimeProbeGate();
await verifyBrowserPythonRuntimeContract();
await verifyBrowserPythonNativeRuntimeReadiness();
await verifyBrowserPythonNativeRuntimeProbeGate();
await verifyBrowserPythonNativeRuntimeStatePlan();
await verifyBrowserPythonNativeRuntimeFixturePlan();
await verifyBrowserNativeProofAlignment();
const runtimeNativeAlignmentSummaryRows =
await verifyBrowserRuntimeNativeAlignmentSummary();
await verifyBrowserNativeRuntimeProbeSummary();
await verifyBrowserRuntimeProbeGateAlignment();
await verifyBrowserNativeRuntimeProbeExecutionPlan();
await verifyBrowserNativeRuntimeProbePassEvidenceContract();
await verifyBrowserRuntimeBoundaryContractSummary();
await verifyBrowserRuntimeNativeAlignmentDetails(runtimeNativeAlignmentSummaryRows);
await verifyBrowserBlockedRuntimePromotionLock();
await verifyBrowserRuntimeBoundaryPromotionReadiness();
await verifyBrowserRuntimeBoundaryPromotionBlockers();
await verifyBrowserRuntimeBoundaryPostNativePassGates();
await verifyBrowserRuntimeBoundaryHostPreflight();
await verifyBrowserNextBoundaryRecommendations();
const interp = await createLinuxCncInterpSdk({