Phase 20.12b: quick green + structural cleanup

- Deprecations: add warn-once for nyash.toml (runtime::deprecations); apply in plugin loader v2 (singletons/method_resolver)
- Child env + runner hygiene: unify Stage‑3/quiet/disable-fallback env in test/runner; expand LLVM noise filters
- Docs/branding: prefer  and hako.toml in README.md/README.ja.md and smokes README
- VM: implement Map.clear in MIR interpreter (boxes_map)
- Stage‑B: gate bundle/alias/require smokes behind SMOKES_ENABLE_STAGEB; fix include cwd and resolve() call even for require-only cases
- Core‑Direct: gate rc boundary canary behind SMOKES_ENABLE_CORE_DIRECT
- Smokes: inject Stage‑3 and disable selfhost fallback for LLVM runs; filter using/* logs
- Quick profile: 168/168 PASS locally

This commit accelerates Phase 20.33 (80/20) by stabilizing quick suite, reducing noise, and gating heavy/experimental paths for speed.
This commit is contained in:
nyash-codex
2025-11-02 17:50:06 +09:00
parent 0cd2342b05
commit dd6876e1c6
46 changed files with 323 additions and 209 deletions

View File

@ -0,0 +1,20 @@
//! Deprecation warnings with "warn once" guards
use std::sync::OnceLock;
fn warn_once(flag: &'static OnceLock<()>, msg: &str) {
if flag.get().is_none() {
let _ = flag.set(());
eprintln!("{}", msg);
}
}
static NYASH_TOML_WARN_ONCE: OnceLock<()> = OnceLock::new();
/// Warn once per process when nyash.toml is used while hako.toml is absent.
pub fn warn_nyash_toml_used_once() {
warn_once(
&NYASH_TOML_WARN_ONCE,
"[deprecate] using nyash.toml; please rename to hako.toml",
);
}

View File

@ -20,6 +20,7 @@ pub mod unified_registry;
pub mod provider_lock;
pub mod provider_verify;
pub mod observe; // Lightweight observability flags (OOB etc.)
pub mod deprecations; // Deprecation warnings with warn-once guards
// pub mod plugin_box; // legacy - 古いPluginBox
// pub mod plugin_loader; // legacy - Host VTable使用
pub mod extern_registry; // ExternCall (env.*) 登録・診断用レジストリ

View File

@ -5,7 +5,13 @@ use crate::runtime::plugin_loader_v2::enabled::{errors, host_bridge, types};
pub(super) fn prebirth_singletons(loader: &PluginLoaderV2) -> BidResult<()> {
let config = loader.config.as_ref().ok_or(BidError::PluginError)?;
let cfg_path = loader.config_path.as_deref().unwrap_or("nyash.toml");
let cfg_path = loader
.config_path
.as_deref()
.unwrap_or_else(|| if std::path::Path::new("hako.toml").exists() { "hako.toml" } else { "nyash.toml" });
if cfg_path == "nyash.toml" && !std::path::Path::new("hako.toml").exists() {
crate::runtime::deprecations::warn_nyash_toml_used_once();
}
let toml_content = errors::from_fs(std::fs::read_to_string(cfg_path))?;
let toml_value: toml::Value = errors::from_toml(toml::from_str(&toml_content))?;
for (lib_name, lib_def) in &config.libraries {
@ -33,7 +39,13 @@ pub(super) fn ensure_singleton_handle(
{
return Ok(());
}
let cfg_path = loader.config_path.as_deref().unwrap_or("nyash.toml");
let cfg_path = loader
.config_path
.as_deref()
.unwrap_or_else(|| if std::path::Path::new("hako.toml").exists() { "hako.toml" } else { "nyash.toml" });
if cfg_path == "nyash.toml" && !std::path::Path::new("hako.toml").exists() {
crate::runtime::deprecations::warn_nyash_toml_used_once();
}
let toml_value: toml::Value =
toml::from_str(&std::fs::read_to_string(cfg_path).map_err(|_| BidError::PluginError)?)
.map_err(|_| BidError::PluginError)?;

View File

@ -12,7 +12,13 @@ impl PluginLoaderV2 {
pub(crate) fn resolve_method_id(&self, box_type: &str, method_name: &str) -> BidResult<u32> {
// First try config mapping
if let Some(cfg) = self.config.as_ref() {
let cfg_path = self.config_path.as_deref().unwrap_or("nyash.toml");
let cfg_path = self
.config_path
.as_deref()
.unwrap_or_else(|| if std::path::Path::new("hako.toml").exists() { "hako.toml" } else { "nyash.toml" });
if cfg_path == "nyash.toml" && !std::path::Path::new("hako.toml").exists() {
crate::runtime::deprecations::warn_nyash_toml_used_once();
}
// Load and parse TOML
let toml_content = std::fs::read_to_string(cfg_path).map_err(|_| BidError::PluginError)?;
@ -70,7 +76,13 @@ impl PluginLoaderV2 {
/// Check if a method returns a Result type
pub fn method_returns_result(&self, box_type: &str, method_name: &str) -> bool {
if let Some(cfg) = self.config.as_ref() {
let cfg_path = self.config_path.as_deref().unwrap_or("nyash.toml");
let cfg_path = self
.config_path
.as_deref()
.unwrap_or_else(|| if std::path::Path::new("hako.toml").exists() { "hako.toml" } else { "nyash.toml" });
if cfg_path == "nyash.toml" && !std::path::Path::new("hako.toml").exists() {
crate::runtime::deprecations::warn_nyash_toml_used_once();
}
if let Ok(toml_content) = std::fs::read_to_string(cfg_path) {
if let Ok(toml_value) = toml::from_str::<toml::Value>(&toml_content) {
@ -96,7 +108,13 @@ impl PluginLoaderV2 {
method_name: &str,
) -> BidResult<(u32, u32, bool)> {
let cfg = self.config.as_ref().ok_or(BidError::PluginError)?;
let cfg_path = self.config_path.as_deref().unwrap_or("nyash.toml");
let cfg_path = self
.config_path
.as_deref()
.unwrap_or_else(|| if std::path::Path::new("hako.toml").exists() { "hako.toml" } else { "nyash.toml" });
if cfg_path == "nyash.toml" && !std::path::Path::new("hako.toml").exists() {
crate::runtime::deprecations::warn_nyash_toml_used_once();
}
let toml_value: toml::Value =
toml::from_str(&std::fs::read_to_string(cfg_path).map_err(|_| BidError::PluginError)?)
.map_err(|_| BidError::PluginError)?;
@ -124,4 +142,4 @@ pub(super) fn get_special_method_id(method_name: &str) -> Option<u32> {
"fini" => Some(999),
_ => None,
}
}
}