feat(Ring0): Phase 107 - Ring0.FsApi FileIo integration complete
Implementation Summary: Phase 107 establishes FileBox as a unified layer over Ring0.FsApi Completed Tasks: - Task 1: FsApi SSOT review and documentation - Task 2: FileIo designed as FsApi wrapper - Task 3: Ring0FsFileIo implementation added - Task 4: Fail-Fast integration verified - Task 5: Documentation integration complete Key Changes: 1. New File: src/providers/ring1/file/ring0_fs_fileio.rs - Ring0.FsApi-based FileIo implementation - Stateful wrapper (open/read/close) - UTF-8 handling via read_to_string() - One-file-at-a-time semantics (tested) 2. provider_lock.rs: - Added init_default_filebox_provider() - Auto-registration helper for Ring0FsFileIo 3. plugin_host.rs: - with_core_from_registry_optional() auto-registers default provider - Plugin priority maintained (debug logging) - Phase 106 MissingService check still active (Fail-Fast preserved) 4. Documentation: - phase107_fsapi_fileio_bridge.md: Complete design doc - phase106_filebox_design_revised.md: Phase 107 integration notes - core_boxes_design.md: Layer diagram and principles Design Decisions: - UTF-8 handling: read_to_string() for text-focused use cases - One file at a time: open() returns Err if already open - Plugin priority: init_default_filebox_provider() fails gracefully Test Results: - cargo build --release: SUCCESS - plugin_host tests: 11 passed - ring0_fs_fileio tests: 4 passed Next Steps (Phase 108+): - minimal/no-fs profile support - write operations - multi-file handle support
This commit is contained in:
@ -36,6 +36,19 @@
|
||||
- CoreBoxId: 「File が必須かどうか」を決定する窓口に
|
||||
- profile パターン: selfhost/default では必須、minimal/no-fs では optional
|
||||
|
||||
### 1.4 Phase 107 統合完了(2025-12-03)
|
||||
|
||||
**Ring0.FsApi 統合完了**:
|
||||
- ✅ Ring0FsFileIo 実装追加(src/providers/ring1/file/ring0_fs_fileio.rs)
|
||||
- ✅ provider_lock に init_default_filebox_provider() 追加
|
||||
- ✅ PluginHost.with_core_from_registry_optional で自動登録
|
||||
- ✅ Phase 106 の MissingService チェックは引き続き有効(Fail-Fast 維持)
|
||||
|
||||
**Phase 107 の効果**:
|
||||
- 標準パスで FileBox provider が自動登録される
|
||||
- MissingService エラーは基本的に起きない(プラグイン未登録時も default で補完)
|
||||
- プラグイン優先原則は維持(プラグインが先に登録すれば default は使われない)
|
||||
|
||||
---
|
||||
|
||||
## 2. Task 1: CoreBoxId を修正(カテゴリ統一)
|
||||
@ -183,40 +196,13 @@ L5 付近にコメント追加:
|
||||
|
||||
## 5. Task 4: 起動時に FileBox provider 登録を必ず確保(Fail-Fast)
|
||||
|
||||
### 5.1 修正内容
|
||||
### 5.1 実装内容(概要)
|
||||
|
||||
ファイル: `src/runtime/plugin_host.rs`
|
||||
|
||||
#### パターン: CoreBoxId.is_core_required() でチェック
|
||||
|
||||
```rust
|
||||
impl PluginHost {
|
||||
pub fn with_core_from_registry(
|
||||
ring0: Arc<Ring0Context>,
|
||||
registry: &UnifiedBoxRegistry,
|
||||
) -> Result<Self, CoreInitError> {
|
||||
// Phase 93-95: 既存のチェック処理
|
||||
for id in CoreServices::required_ids() {
|
||||
// ... (String/Integer/Bool/Array/Map/Console)
|
||||
}
|
||||
|
||||
// Phase 106: FileBox provider チェック追加
|
||||
// CoreBoxId がFileを必須と判定している場合、provider が登録されていることを確認
|
||||
if CoreBoxId::File.is_core_required() {
|
||||
if provider_lock::get_filebox_provider().is_none() {
|
||||
return Err(CoreInitError::MissingService {
|
||||
box_id: CoreBoxId::File,
|
||||
message: "FileBox provider not registered (required for selfhost/default profile)".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 93-95: CoreServices 構築(既存)
|
||||
let core = CoreServices { /* ... */ };
|
||||
Ok(PluginHost { ring0, core, optional: HashMap::new() })
|
||||
}
|
||||
}
|
||||
```
|
||||
- `CoreBoxId::is_core_required()` / `CoreServices::required_ids()` を用いて、「必須 Box は registry に型定義が存在すること」を起動時にチェック。
|
||||
- FileBox については CoreRequired 側に寄せた上で、「FileBox provider が登録されていない場合は CoreInitError::MissingService で fail-fast」するロジックを追加。
|
||||
- 具体的なコードは実装側に委ね、ここでは責務分離の方針のみを記録する。
|
||||
|
||||
#### テスト追加
|
||||
|
||||
|
||||
Reference in New Issue
Block a user