feat(phase93): with_core_from_registry implementation complete

Phase 93 完了: UnifiedBoxRegistry 統合実装 & 起動パス統合

**実装内容**:
- with_core_from_registry() 実装
  - UnifiedBoxRegistry.has_type() で core Box の存在確認
  - 不足時は CoreInitError::MissingService を返す
  - ダミー Service 実装で CoreServices を構築
- ダミー Service 実装を pub に
  - DummyStringService, DummyIntegerService 等を公開
  - Phase 94 の実変換までの橋渡し
- CoreServices::dummy() ヘルパー追加
  - フォールバック用ダミー実装
- initialize_runtime() 実装(環境変数制御)
  - NYASH_USE_PLUGIN_HOST=1 で PluginHost 有効化
  - 環境変数なしで従来通り動作(後方互換性)
- selfhost に PluginHost 初期化追加
  - CoreInitError 発生時は fail-fast
  - 既存ロジックは変更なし

**Fail-Fast 設計**:
- 起動時に core Box 不足を即座に検出
- CoreInitError で明示的なエラーメッセージ
- デバッグ容易(ランタイムエラーではなく起動時エラー)

**テスト結果**:
- test_with_core_from_registry_missing_box 追加
- 7件全て成功
- ビルド成功(1分4秒)
- 526 passed(既存36失敗は Phase 93 と無関係)

**動作確認**:
- 環境変数なし: 従来通り動作 
- NYASH_USE_PLUGIN_HOST=1: PluginHost 初期化成功 
- selfhost: fail-fast 動作確認済み 

**ドキュメント更新**:
- Section 10 追加(77行)
- 段階的展開戦略、Fail-Fast 設計を文書化

**次のステップ**: Phase 94 (実際の Box → Service 変換)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-03 08:42:45 +09:00
parent 2f54e64d27
commit b3de4cac4b
5 changed files with 189 additions and 40 deletions

View File

@ -43,6 +43,21 @@ impl NyashRunner {
pub(crate) fn try_run_selfhost_pipeline(&self, filename: &str) -> bool {
use std::io::Write;
// Phase 93: PluginHost 初期化(環境変数で制御)
if std::env::var("NYASH_USE_PLUGIN_HOST").ok().as_deref() == Some("1") {
let ring0 = crate::runtime::ring0::get_global_ring0();
match crate::runtime::initialize_runtime(ring0) {
Ok(_plugin_host) => {
eprintln!("[selfhost] PluginHost initialized successfully");
}
Err(e) => {
eprintln!("[selfhost] CoreInitError: {}", e);
// Phase 93: fail-fastエラー時は即座に終了
return false;
}
}
}
// Phase 25.1b: guard selfhost pipeline to Ny-only sources.
// `.hako` / other extensionsは StageB / JSON v0 bridge 側の責務なので、
// ここでは Ny/Nyash 拡張子以外は即座にスキップする。