Stage‑B fallback TTL: HAKO_STAGEB_ALLOW_FALLBACK (default ON); Runner helper child_env (OOB strict helpers) and use in Gate‑C; Add quick smokes: map len/set/get, string index/substring; Bridge canonicalize tests default‑on; Update bridge scripts to robust root detection.

This commit is contained in:
nyash-codex
2025-11-01 19:48:40 +09:00
parent aa6cd566e8
commit 6279d93e9a
8 changed files with 137 additions and 19 deletions

21
src/runner/child_env.rs Normal file
View File

@ -0,0 +1,21 @@
/*!
* child_env.rs — Runner helper utilities (OOB strict, quiet exit policies)
*/
pub fn pre_run_reset_oob_if_strict() {
if crate::config::env::oob_strict_fail() {
crate::runtime::observe::reset();
}
}
pub fn post_run_exit_if_oob_strict_triggered() -> ! {
if crate::config::env::oob_strict_fail() && crate::runtime::observe::oob_seen() {
eprintln!("[gate-c][oob-strict] Out-of-bounds observed → exit(1)");
std::process::exit(1);
}
// If not strict or no OOB, return to caller path; caller should exit(…) itself.
// This function is defined as diverging only when it actually exits above; otherwise it does nothing.
// To keep signature simple for callers, they should not rely on this returning.
std::process::exit(0)
}

View File

@ -10,6 +10,7 @@
*/
use super::*;
use crate::runner::child_env;
impl NyashRunner {
/// Try to handle `--ny-parser-pipe` / `--json-file` flow.
@ -47,7 +48,7 @@ impl NyashRunner {
Ok(Some(module)) => {
super::json_v0_bridge::maybe_dump_mir(&module);
// GateC(Core) strict OOB failfast: reset observe flag before run
if crate::config::env::oob_strict_fail() { crate::runtime::observe::reset(); }
child_env::pre_run_reset_oob_if_strict();
let rc = self.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)");
@ -120,7 +121,7 @@ impl NyashRunner {
}
}
// Default: Execute via MIR interpreter (quiet) and exit with rc mirrored from return value
if crate::config::env::oob_strict_fail() { crate::runtime::observe::reset(); }
child_env::pre_run_reset_oob_if_strict();
let rc = self.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)");