|
|
42b09b3c1c
|
feat(phase88): Ring0Context Skeleton implementation
Phase 88: OS API abstraction layer implementation
**Implementation**:
- Ring0Context module added (4 files)
- mod.rs: Public API, global initialization (OnceLock)
- traits.rs: MemApi, IoApi, TimeApi, LogApi trait definitions
- std_impls.rs: std-based default implementations
- errors.rs: IoError, TimeError type definitions
**Design Principles**:
- Ring0 knows nothing about Box
- Ring0 knows nothing about Nyash
- Pure OS API abstraction
**Global Initialization**:
- NyashRunner::new() initializes Ring0Context globally
- OnceLock ensures safe initialization (idempotent)
**Migration (2 paths)**:
- src/runner/selfhost.rs:27: eprintln! → ring0.log.error() (OOB strict)
- src/runner/selfhost.rs:177: eprintln! → ring0.log.error() (PyVM error)
**Tests**:
- 4 unit tests added (ring0 module)
- All tests passed
- Build successful (0 errors)
**Migration Status**:
- Migrated: 2/3,955 (0.05%)
- Remaining: 3,953 paths (Phase 89+)
**Files Changed**:
- src/runtime/ring0/mod.rs (new, 100 lines)
- src/runtime/ring0/traits.rs (new, 93 lines)
- src/runtime/ring0/std_impls.rs (new, 77 lines)
- src/runtime/ring0/errors.rs (new, 26 lines)
- src/runtime/mod.rs (Ring0Context export)
- src/runner/mod.rs (global initialization)
- src/runner/selfhost.rs (2 paths migrated)
- docs/development/current/main/ring0-inventory.md (Phase 88 status)
Phase 88 complete. Ready for Phase 89 (gradual migration).
🐱✨
|
2025-12-02 22:38:27 +09:00 |
|
|
|
268a56fdfe
|
feat(box_factory): Phase 86 BoxFactory Priority normalization
Phase 86: BoxFactory Priority 正常化プロジェクト完了
目的:
- BoxFactory のデフォルトポリシーを BuiltinFirst から StrictPluginFirst に変更
- プラグイン版 StringBox/ArrayBox/MapBox が正常に使用できるよう正常化
- Phase 85 (Ring0/Ring1-Core 境界設計) の土台準備
実装内容:
1. ドキュメント作成
- docs/development/current/main/factory_priority.md: 完全仕様文書化
2. コード修正 (1行のみ)
- UnifiedBoxRegistry::new() が with_env_policy() を使用
- デフォルトポリシーが StrictPluginFirst に変更
3. テスト追加 (5件, 全パス)
- test_default_policy_is_strict_plugin_first: デフォルトポリシー確認
- test_env_policy_override: 環境変数制御確認
- test_reserved_type_protection: 予約型保護動作確認
- test_plugin_override_with_env: 予約型 override 確認
- test_non_reserved_plugin_priority: 非予約型プラグイン優先確認
効果:
- ✅ プラグイン版 StringBox/ArrayBox/MapBox が正常に使用可能
- ✅ core_required Box の予約名保護維持
- ✅ 環境変数による柔軟な制御が可能
- ✅ テスト改善: 500→506 passed, 34→33 failed (+6 passed, -1 failed)
core_required Box リスト (暫定):
- Core value types: StringBox, IntegerBox, BoolBox, FloatBox, NullBox
- Core containers: ArrayBox, MapBox, ResultBox
- Core method indirection: MethodBox
環境変数:
- NYASH_BOX_FACTORY_POLICY: ポリシー選択 (default: strict_plugin_first)
- NYASH_USE_PLUGIN_BUILTINS: core_required override 許可
- NYASH_PLUGIN_OVERRIDE_TYPES: 個別 Box override 許可
Phase 85 準備:
- Ring0/Ring1-Core 境界設計の土台が整った
- ConsoleBox の扱いは Phase 85 で最終決定
完了条件:
- ✅ factory_priority.md 作成完了
- ✅ UnifiedBoxRegistry::new() 修正完了
- ✅ デフォルトポリシー StrictPluginFirst 確定
- ✅ テスト 5件追加・全パス
- ✅ CURRENT_TASK.md 更新完了
- ✅ Phase 85 README 準備完了
参考:
- 設計文書: docs/development/current/main/factory_priority.md
- Phase 85 計画: docs/private/roadmap2/phases/phase-85-ring0-runtime/README.md
🎉 Phase 86 完了!次は Phase 85 で Ring0/Ring1-Core 境界の文書化へ
|
2025-12-02 21:52:18 +09:00 |
|