Commit Graph

4 Commits

Author SHA1 Message Date
4ef3e7f56c feat(phase109): RuntimeProfile設計で FileBox を条件付き optional に
Phase 109 完全実装完了:
- RuntimeProfile enum (Default, NoFs) で profile 制御
- CoreBoxId.is_required_in(profile) で条件付き required/optional
- initialize_runtime() で env 読み込み責務を一元化(修正1)
- NoFsFileIo スタブで no-fs プロファイルでの FileBox 無効化(修正2)
- Logger/ConsoleService は no-fs でも有効と明示(修正2)
- Profile 拡張予定(TestMock/Sandbox/ReadOnly/Embedded)を予約(修正3)

実装ファイル:
- src/runtime/runtime_profile.rs (新規)
- src/providers/ring1/file/nofs_fileio.rs (新規)
- src/runtime/core_box_ids.rs (修正)
- src/runtime/plugin_host.rs (修正)
- src/runtime/provider_lock.rs (修正)
- docs 更新

テスト: Phase 109 11/11 PASS 
ビルド: cargo build --release SUCCESS 

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 19:37:32 +09:00
61dc4dec9b feat(filebox): Phase 108 FileBox write/write_all implementation
Implement write functionality for FileBox following Phase 108 specification,
completing the read/write pipeline via Ring0.FsApi.

## Implementation Summary

### Task 2: FsApi / Ring0FsFileIo write implementation
- Added write() method to FileIo trait
- Implemented write() in Ring0FsFileIo (truncate mode via Ring0.FsApi.write_all)
- Updated FileCaps to { read: true, write: true } for standard profile
- Added write() stub to CoreRoFileIo (returns Unsupported)

### Task 3: FileBox write/write_all implementation
- Updated FileBox.write_all() to delegate to provider.write()
- Updated FileBox.write() to convert content to text and call provider.write()
- UTF-8 conversion via String::from_utf8_lossy (text-oriented design)
- Returns "OK" on success, "Error: ..." on failure

### Task 4: Test coverage
- Round-trip test (write → read):  PASS
- Truncate mode verification:  PASS
- Write without open error:  PASS
- Read-only provider rejection:  PASS
- Auto-registration test updated:  PASS

### Task 5: Documentation updates
- phase107_fsapi_fileio_bridge.md: Added Phase 108 section
- core_boxes_design.md: Updated Ring0.FsApi relationship section
- CURRENT_TASK.md: Added Phase 108 completion entry

## Design Decisions (from phase108_filebox_write_semantics.md)

- **Write mode**: truncate (overwrite existing file each time)
- **Text-oriented**: UTF-8 conversion via from_utf8_lossy
- **Append mode**: Planned for Phase 109+
- **Error handling**: FileError::Io for failures, Fail-Fast on caps.write=false

## Test Results

```
cargo test --release --lib filebox
test result: ok. 5 passed; 0 failed; 1 ignored
```

All FileBox tests pass, including Phase 107 compatibility tests.

## Pipeline Complete

```
FileBox.write(content)
    ↓
FileBox.write_all(buf)
    ↓
provider.write(text) ← Ring0FsFileIo implementation
    ↓
Ring0.FsApi.write_all()
    ↓
std::fs::write()
```

## Next Steps (Backlog)

- Phase 109: minimal/no-fs profile
- Phase 110: FileHandleBox (multiple files simultaneously)
- Phase 111: append mode implementation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 18:40:33 +09:00
0fd4962e4c 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
2025-12-03 18:16:49 +09:00
38db674101 docs: Phase 107 Ring0.FsApi ↔ FileIo 統合設計(検討事項追加版)
- FsApi / FileIo / FileBox の関係を明確化
- UTF-8 ハンドリング、二重 open、プラグイン優先時の Err ハンドリングを明記
- Ring0FsFileIo 実装設計(read-only 版)
- 層の棲み分けと拡張ポイント(MockFileIo / NetworkFileIo / minimal/no-fs)確立

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 18:07:01 +09:00