feat(runtime): Phase 98 ConsoleService 代表パス拡張 - 7箇所置き換え完了
## Phase 98 完了項目 - ✅ println!/eprintln! 7箇所 → ConsoleService 経由に移行 - ✅ console_println! マクロ追加(Graceful Degradation パターン) - ✅ try_get_core_plugin_host() 追加(安全なアクセサー) - ✅ 全テストPASS(core_services: 11, plugin_host: 7) ## 置き換え箇所(7箇所) **selfhost/child.rs** (3箇所): - spawn失敗エラー - タイムアウトメッセージ(stdout/stderr) **core_bridge.rs** (2箇所): - DUMP書き込みエラー - DUMP_MUT書き込みエラー **vm.rs** (1箇所): - RC(return code)出力 **selfhost/json.rs** (2箇所, オプション達成): - PyVM MIR JSON emit エラー - PyVM 使用ログ(verbose時) ## 技術的成果 **Graceful Degradation パターン確立**: - PluginHost 初期化前: eprintln! フォールバック - PluginHost 初期化後: ConsoleService 使用(Ring0直結) - Fail-Fast原則との整合性: 出力先選択のみ動的 **実装インフラ**: - src/runtime/mod.rs: console_println! マクロ & try_get_core_plugin_host() - 既存の get_core_plugin_host() は panic! 保持(Fail-Fast) ## 統計 - 置き換え完了: 7箇所(全体の約2%) - 残り候補: 約359箇所(Phase 99以降) - テスト: ビルド成功、全ユニットテストPASS ## ドキュメント - docs/development/current/main/core_boxes_design.md: Section 15 追加(128行) - 実装パターン、設計判断、テスト結果を完全記録 ## Phase 85-98 総括 - Phase 85-94: 構造設計 & 箱化モジュール化 - Phase 95.5: StringService/ConsoleService(Ring0直結型・純粋関数型) - Phase 96-96.5: ArrayService/MapService(downcast型)& コード整理 - Phase 97: IntegerService/BoolService(純粋関数型、#[allow(dead_code)] 根絶) - Phase 98: ConsoleService 実用拡大(7箇所)✅ 完了 次: Phase 99(CoreServices 完全統合、残り約359箇所の段階的移行) 🎊 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -76,6 +76,23 @@ pub fn get_core_plugin_host() -> std::sync::Arc<plugin_host::PluginHost> {
|
||||
.clone()
|
||||
}
|
||||
|
||||
/// Phase 98: Safe accessor that returns None if not initialized
|
||||
pub fn try_get_core_plugin_host() -> Option<std::sync::Arc<plugin_host::PluginHost>> {
|
||||
GLOBAL_CORE_PLUGIN_HOST.get().cloned()
|
||||
}
|
||||
|
||||
/// Phase 98: Helper macro to print using ConsoleService if available, otherwise eprintln
|
||||
#[macro_export]
|
||||
macro_rules! console_println {
|
||||
($($arg:tt)*) => {
|
||||
if let Some(host) = $crate::runtime::try_get_core_plugin_host() {
|
||||
host.core.console.println(&format!($($arg)*));
|
||||
} else {
|
||||
eprintln!($($arg)*);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Runtime 初期化(Phase 95: global accessor 実装完了)
|
||||
///
|
||||
/// Phase 94: フォールバック削除 - 常に実際の Box を使用
|
||||
|
||||
Reference in New Issue
Block a user