feat(phase21.5/22.1): MirBuilder JsonFrag refactor + FileBox ring-1 + registry tests
Phase 21.5 (AOT/LLVM Optimization Prep) - FileBox ring-1 (core-ro) provider: priority=-100, always available, no panic path - src/runner/modes/common_util/provider_registry.rs: CoreRoFileProviderFactory - Auto-registers at startup, eliminates fallback panic structurally - StringBox fast path prototypes (length/size optimization) - Performance benchmarks (C/Python/Hako comparison baseline) Phase 22.1 (JsonFrag Unification) - JsonFrag.last_index_of_from() for backward search (VM fallback) - Replace hand-written lastIndexOf in lower_loop_sum_bc_box.hako - SentinelExtractorBox for Break/Continue pattern extraction MirBuilder Refactor (Box → JsonFrag Migration) - 20+ lower_*_box.hako: Box-heavy → JsonFrag text assembly - MirBuilderMinBox: lightweight using set for dev env - Registry-only fast path with [registry:*] tag observation - pattern_util_box.hako: enhanced pattern matching Dev Environment & Testing - Dev toggles: SMOKES_DEV_PREINCLUDE=1 (point-enable), HAKO_MIR_BUILDER_SKIP_LOOPS=1 - phase2160: registry opt-in tests (array/map get/set/push/len) - content verification - phase2034: rc-dependent → token grep (grep -F based validation) - run_quick.sh: fast smoke testing harness - ENV documentation: docs/ENV_VARS.md Test Results ✅ quick phase2034: ALL GREEN (MirBuilder internal patterns) ✅ registry phase2160: ALL GREEN (array/map get/set/push/len) ✅ rc-dependent tests → content token verification complete ✅ PREINCLUDE policy: default OFF, point-enable only where needed Technical Notes - No INCLUDE by default (maintain minimalism) - FAIL_FAST=0 in Bring-up contexts only (explicit dev toggles) - Tag-based route observation ([mirbuilder/min:*], [registry:*]) - MIR structure validation (not just rc parity) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -68,20 +68,32 @@ fn call_hako_box(name: &str, ctx: &SsotCtx) -> Option<String> {
|
||||
nn
|
||||
));
|
||||
|
||||
// Write to a temp file
|
||||
// Write ephemeral file; any failure → None (delegate to legacy)
|
||||
let mut tf = tempfile::Builder::new()
|
||||
// Write to a temp file (Fail-Fast aware)
|
||||
let mut tf = match tempfile::Builder::new()
|
||||
.prefix("ny_ssot_")
|
||||
.suffix(".hako")
|
||||
.tempfile()
|
||||
.ok()?;
|
||||
.tempfile() {
|
||||
Ok(f) => f,
|
||||
Err(e) => {
|
||||
if crate::config::env::fail_fast() {
|
||||
eprintln!("[failfast/ssot/tempfile] {}", e);
|
||||
panic!("Fail-Fast: SSOT tempfile creation failed");
|
||||
}
|
||||
return None;
|
||||
}
|
||||
};
|
||||
let _ = write!(tf, "{}", code);
|
||||
let path = tf.path().to_path_buf();
|
||||
// Resolve nyash binary; fallback to current exe or default path on failure
|
||||
let bin = std::env::var("NYASH_BIN").ok().unwrap_or_else(|| {
|
||||
if let Ok(p) = std::env::current_exe() { p.to_string_lossy().to_string() }
|
||||
else { "target/release/nyash".to_string() }
|
||||
});
|
||||
// Resolve nyash binary; Fail-Fast aware fallback
|
||||
let bin = if let Ok(b) = std::env::var("NYASH_BIN") { b } else {
|
||||
if let Ok(p) = std::env::current_exe() { p.to_string_lossy().to_string() } else {
|
||||
if crate::config::env::fail_fast() {
|
||||
eprintln!("[failfast/ssot/nyash-bin] unable to resolve NYASH_BIN/current_exe");
|
||||
panic!("Fail-Fast: cannot resolve nyash binary for SSOT child");
|
||||
}
|
||||
"target/release/nyash".to_string()
|
||||
}
|
||||
};
|
||||
|
||||
// Stage‑3 + tolerance (matches smokes wrappers)
|
||||
let mut cmd = Command::new(bin);
|
||||
@ -99,9 +111,30 @@ fn call_hako_box(name: &str, ctx: &SsotCtx) -> Option<String> {
|
||||
.env("HAKO_USING_SSOT_HAKO", "0")
|
||||
.env("HAKO_USING_SSOT_RELATIVE", "0")
|
||||
.env("HAKO_USING_SSOT_INVOKING", "1");
|
||||
// Any spawn/IO error → None (fail-safe to legacy)
|
||||
let out = cmd.output().ok()?;
|
||||
if !out.status.success() { return None; }
|
||||
// Any spawn/IO error → Fail-Fast or None
|
||||
let out = match cmd.output() {
|
||||
Ok(o) => o,
|
||||
Err(e) => {
|
||||
if crate::config::env::fail_fast() {
|
||||
eprintln!("[failfast/ssot/hako-spawn] {}", e);
|
||||
panic!("Fail-Fast: SSOT child spawn failed");
|
||||
}
|
||||
return None;
|
||||
}
|
||||
};
|
||||
if !out.status.success() {
|
||||
if crate::config::env::fail_fast() {
|
||||
eprintln!("[failfast/ssot/hako-exit] status={}", out.status);
|
||||
panic!("Fail-Fast: SSOT child exited with error");
|
||||
}
|
||||
return None;
|
||||
}
|
||||
let s = String::from_utf8_lossy(&out.stdout).trim().to_string();
|
||||
if s.is_empty() { None } else { Some(s) }
|
||||
if s.is_empty() {
|
||||
if crate::config::env::fail_fast() {
|
||||
eprintln!("[failfast/ssot/hako-empty]");
|
||||
panic!("Fail-Fast: SSOT child produced empty output");
|
||||
}
|
||||
None
|
||||
} else { Some(s) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user