phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0
This commit is contained in:
@ -39,6 +39,36 @@ pub fn run_json_v0(runner: &NyashRunner, json: &str) -> i32 {
|
||||
}
|
||||
let mut payload = json.to_string();
|
||||
|
||||
// Optional: downconvert/canonicalize even for v1 when requested (dev diagnostics)
|
||||
if crate::config::env::nyvm_v1_downconvert() {
|
||||
if let Ok(j) = crate::runner::modes::common_util::core_bridge::canonicalize_module_json(&payload) {
|
||||
payload = j;
|
||||
}
|
||||
}
|
||||
|
||||
// Prefer v1 bridge when schema_version is present (JSON v1). This must run
|
||||
// before the v0 fast-path because v1 payloads also contain `functions` and
|
||||
// `blocks`, which would otherwise be misrouted to the v0 loader.
|
||||
if payload.contains("\"schema_version\"") {
|
||||
match crate::runner::json_v1_bridge::try_parse_v1_to_module(&payload) {
|
||||
Ok(Some(module)) => {
|
||||
super::json_v0_bridge::maybe_dump_mir(&module);
|
||||
crate::runner::child_env::pre_run_reset_oob_if_strict();
|
||||
let rc = runner.execute_mir_module_quiet_exit(&module);
|
||||
if crate::config::env::oob_strict_fail() && crate::runtime::observe::oob_seen() {
|
||||
eprintln!("[gate-c][oob-strict] Out-of-bounds observed → exit(1)");
|
||||
return 1;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
Ok(None) => { /* fall through to v0 path */ }
|
||||
Err(e) => {
|
||||
eprintln!("❌ JSON v1 bridge error: {}", e);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fast-path: accept MIR(JSON v0) directly when it looks like a module (functions/blocks)
|
||||
if payload.contains("\"functions\"") && payload.contains("\"blocks\"") {
|
||||
match super::mir_json_v0::parse_mir_v0_to_module(&payload) {
|
||||
@ -59,15 +89,13 @@ pub fn run_json_v0(runner: &NyashRunner, json: &str) -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
// Always try the v1 bridge first (Stage‑B Program JSON → MIR module).
|
||||
// This is no‑op when input is already MIR(JSON v0) with functions/blocks.
|
||||
// For non‑v1 input, attempt canonicalization and v1 bridge (Stage‑B program → MIR).
|
||||
if let Ok(j) = crate::runner::modes::common_util::core_bridge::canonicalize_module_json(&payload) {
|
||||
payload = j;
|
||||
}
|
||||
match crate::runner::json_v1_bridge::try_parse_v1_to_module(&payload) {
|
||||
Ok(Some(module)) => {
|
||||
super::json_v0_bridge::maybe_dump_mir(&module);
|
||||
// OOB strict: reset observation flag
|
||||
crate::runner::child_env::pre_run_reset_oob_if_strict();
|
||||
let rc = runner.execute_mir_module_quiet_exit(&module);
|
||||
if crate::config::env::oob_strict_fail() && crate::runtime::observe::oob_seen() {
|
||||
|
||||
Reference in New Issue
Block a user