feat(runtime): Phase 87 CoreBoxId/CoreMethodId 箱化完了

ハードコード文字列から型安全な enum への箱化により、
Box名・メソッド名管理を完全にコンパイル時検証可能に。

主な実装:
- CoreBoxId enum 定義(19個)
  - core_required: 6個(String, Integer, Bool, Array, Map, Console)
  - core_optional: 9個(Float, Null, File, Path, Regex, Math, Time, Json, Toml)
  - 特殊型: 4個(Function, Result, Method, Missing)
- CoreMethodId enum 定義(30個)
  - 各 Box のメソッドを型安全に管理
  - 引数数、戻り値型情報を統合
- is_reserved_type() を CoreBoxId ベースにリファクタリング
- infer_boxcall_return_type() を CoreMethodId ベースに改良(75行 → 25行、67%削減)

検証結果:
- テスト:  11/11 passed(新規追加)
- ビルド:  成功(0エラー)
- 型安全性:  タイポ不可能

効果:
- SSOT 確立(src/runtime/core_box_ids.rs に一元化)
- コンパイル時検証(実行時エラー → コンパイルエラー)
- 保守性向上(変更箇所の一元化)
- IDE 支援(enum 補完可能)

ドキュメント:
- core_boxes_design.md 作成(Phase 87 完全仕様)
- Phase 85 README 更新(Phase 87 セクション追加)

Phase 15.5「Everything is Plugin」アーキテクチャ基盤完成

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-02 22:22:32 +09:00
parent 268a56fdfe
commit 8cd9729375
5 changed files with 715 additions and 65 deletions

View File

@ -3,6 +3,7 @@
//! プラグインシステムとBox管理の中核
pub mod box_registry;
pub mod core_box_ids; // Phase 87: CoreBoxId/CoreMethodId 型安全enum
pub mod deprecations;
pub mod gc;
pub mod gc_controller;
@ -35,6 +36,7 @@ pub mod type_registry; // Phase 12: TypeId→TypeBox 解決(雛形) // env.m
mod tests;
pub use box_registry::{get_global_registry, BoxFactoryRegistry, BoxProvider};
pub use core_box_ids::{CoreBoxCategory, CoreBoxId, CoreMethodId}; // Phase 87: 型安全enum
pub use plugin_config::PluginConfig;
pub use plugin_loader_unified::{
get_global_plugin_host, init_global_plugin_host, MethodHandle, PluginBoxType, PluginHost,