2025-12-03 11:31:35 +09:00
# Ring0 Inventory & println! Categorization (Phase 99)
2025-12-02 21:52:18 +09:00
2025-12-03 11:31:35 +09:00
## Overview
This document provides an inventory of Ring0.log infrastructure and categorizes the remaining println!/eprintln! call sites across the codebase. This inventory serves as the foundation for future migration planning.
2025-12-03 13:42:05 +09:00
**Status**: Phase 101-B in progress — planning baseline plus partial internal/dev migration to Ring0.log (113 call sites converted across 5 batches).
2025-12-02 21:52:18 +09:00
---
2025-12-03 11:31:35 +09:00
## Section 1: Ring0.log Utilization Status
2025-12-02 21:52:18 +09:00
2025-12-03 11:31:35 +09:00
### Current Infrastructure (Phase 99 Start)
2025-12-02 21:52:18 +09:00
2025-12-03 11:31:35 +09:00
**Implemented**:
- `Ring0Context` contains `log: Arc<dyn LogApi>`
- `LogApi` trait with methods:
- `debug(message: &str)`
- `info(message: &str)`
- `warn(message: &str)`
- `error(message: &str)`
- `StdLog` implementation outputs to stdout/stderr
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
2025-12-03 11:31:35 +09:00
**Location**: `crates/nyash_kernel/src/ring0/log.rs`
---
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
2025-12-03 11:31:35 +09:00
### Phase 95-98 Usage
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
2025-12-03 11:31:35 +09:00
**ConsoleService Implementation (Phase 95-98)**:
- PluginHost established with CoreServices
- ConsoleService provides user-facing output
- `console_println!` macro consolidates user messages
- Ring0.log remains underutilized (future expansion target)
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
2025-12-03 11:31:35 +09:00
**Current Ring0.log Usage**: Minimal
- Primary logging still uses raw println!/eprintln!
- Opportunity for consolidation exists
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
2025-12-03 11:31:35 +09:00
---
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
2025-12-03 11:31:35 +09:00
## Section 2: println!/eprintln! Remaining Call Sites
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
### Overall Statistics
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Total**: 1776 locations (Phase 99 initial assessment)
- Test code: ~299 locations
- Production code: ~1477 locations
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Source**: Phase 99 initial assessment via `rg 'println!|eprintln!'`
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Historical Context (Phase 88-90)**:
- Phase 88-90 migrated 56 locations to ring0.log.*
- Phase 90 migrated 12 locations to ring0.fs/time/thread.*
- Previous total: 3,955 locations → Current: 1,776 locations
2025-12-02 23:46:32 +09:00
2025-12-02 21:52:18 +09:00
---
2025-12-03 11:31:35 +09:00
### Category Breakdown (Design Phase)
#### Category 1: user-facing (~366 locations, HIGH priority)
**Description**: CLI messages, errors, help text, and other user-visible output
**Target Migration**: `console_println!` macro
2025-12-02 21:52:18 +09:00
2025-12-03 11:31:35 +09:00
**Priority**: HIGH (directly visible to end users)
2025-12-02 21:52:18 +09:00
2025-12-03 11:31:35 +09:00
**Phase 98 Progress**: 7 locations completed (representative paths)
2025-12-02 21:52:18 +09:00
2025-12-03 11:55:14 +09:00
**Phase 100 Progress**: 29 locations completed (selfhost + LLVM runner)
- selfhost.rs: 6箇所( CoreInitError, Result 出力)
- llvm.rs: 23箇所( エラー、成功メッセージ、実行結果)
**合計完了**: Phase 98 (7) + Phase 100 (29) = **36箇所**
**残り**: ~330箇所( その他の runner/modes/*)
**Phase 101-102 Plan**: 段階的拡張継続
2025-12-02 21:52:18 +09:00
2025-12-03 11:31:35 +09:00
**Example Locations**:
- `src/runner/` - CLI entry points
- Error messages in main execution paths
- Help text and usage information
- Progress indicators
2025-12-02 21:52:18 +09:00
---
2025-12-03 12:25:32 +09:00
#### Category 2: dev-debug (~615 locations, MEDIUM priority)
2025-12-02 21:52:18 +09:00
2025-12-03 11:31:35 +09:00
**Description**: Temporary debug output for development purposes
2025-12-03 12:25:32 +09:00
**Target Migration**: Ring0.log (Phase 101-A で Ring0.log に統一決定)
2025-12-03 11:31:35 +09:00
**Priority**: MEDIUM
**Phase 99 Scope**: Assessment only - determine if Ring0.log is appropriate
2025-12-03 12:25:32 +09:00
**Phase 101-A Progress**: 34箇所完了( 代表的なデバッグログ)
- llvm.rs: 13箇所( `[joinir/llvm]` , `[parse/context]` )
- loop_form.rs: 全 `[loopform]` ログ
- phi_core: 21箇所( `[loopform/prepare]` , `[loopform/seal_phis]` , `[Option C]` )
**合計完了**: Phase 101-A で **34箇所** → Ring0.log
**残り**: ~585箇所( 全体 ~615箇所から Phase 101-A の 34箇所を除く)
**Phase 101-B/C Plan**: 段階的に Ring0.log へ移行継続
2025-12-03 11:31:35 +09:00
**Considerations**:
- Is this debug output needed in production?
- Should it use Ring0.log.debug()?
- Or should it be removed entirely?
- Or should it use a special dev_* macro?
2025-12-02 21:52:18 +09:00
---
2025-12-03 11:31:35 +09:00
#### Category 3: test (~299 locations, LOW priority)
**Description**: Test output and verification messages
**Target Migration**: **None - keep as-is**
2025-12-02 21:52:18 +09:00
2025-12-03 11:31:35 +09:00
**Priority**: LOW (safe in isolated environment)
**Phase 99-101 Plan**: No changes
**Rationale**:
- Tests run in isolated environments
- println! is appropriate for test output
- No migration needed
**Example Locations**:
- Test assertion messages
- Test progress indicators
- Debug output during test execution
2025-12-02 21:52:18 +09:00
2025-12-02 23:46:32 +09:00
---
2025-12-03 11:31:35 +09:00
#### Category 4: internal (~812 locations, TBD)
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Description**: Internal processing println! remnants
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Target Migration**: TBD
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Priority**: To be determined in Phase 99
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Phase 99 Scope**: Initial categorization
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Subcategories** (to be refined):
- Internal errors (could use Ring0.log.error)
- State transitions (could use Ring0.log.debug)
- Legacy debug output (could be removed)
- Performance metrics (could use Ring0.log.info)
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
---
2025-12-02 23:46:32 +09:00
2025-12-03 13:42:05 +09:00
### Phase 101-B Update (2025-12-04)
- internal/dev ログ 26 箇所を Ring0.log 化( stderr ノイズ削減)[第1バッチ]
- runtime: provider_lock.rs, type_meta.rs, deprecations.rs, leak_tracker.rs, plugin_loader_unified.rs
- plugin loader v2: loader/config.rs, loader/library.rs, loader/metadata.rs, instance_manager.rs, ffi_bridge.rs
- internal/dev ログ 21 箇所を追加で Ring0.log 化 [第2バッチ]
- runtime: provider_verify.rs, scheduler.rs, gc_controller.rs, box_registry.rs
- plugin loader v2: loader/specs.rs( TypeBox ABI/trace)
- runner: runner/trace.rs( cli_verbose トレース)
- mir: mir/verification.rs( NYASH_BREAKFINDER_SSA_TRACE / NYASH_DEBUG_VERIFIER)
- internal/dev ログ 20 箇所を追加で Ring0.log 化 [第3バッチ]
- mir core: basic_block.rs( insert-after-phis trace) 、control_form.rs、hints.rs、effect.rs、printer.rs、optimizer.rs
- internal/dev ログ 26 箇所を追加で Ring0.log 化 [第4バッチ]
- mir builder/region: loop_builder/phi_ops.rs、builder/type_registry.rs、region/observer.rs
- plugin loader v2: enabled/extern_functions.rs( call/console trace) 、enabled/types.rs( finalize trace)
- internal/dev ログ 20 箇所を追加で Ring0.log 化 [第5バッチ]
- mir loop_builder JoinIR 系: joinir_if_phi_selector.rs( dry-run trace) 、control.rs( LoopForm debug)
- mir builder observe: observe/types.rs( NYASH_MIR_TYPE_TRACE) 、observe/resolve.rs( NYASH_DEBUG_KPI_KNOWN)
- joinir VM bridge: join_ir_vm_bridge_dispatch/exec_routes.rs( run_generic_joinir_route trace)
- plugin loader v2: enabled/extern_functions.rs( NYASH_DEBUG_TRACE / runtime_checkpoint_trace / NYASH_BOX_INTROSPECT_TRACE)
- 役目: internal/diagnostic ログの責務を Ring0.log に寄せ、ConsoleService とテスト出力を分離
- 残件概算:
- dev-debug: ~475– 495 箇所( Phase 101-A の 34 箇所 + 5バッチ合計 113 箇所以外の残り)
- internal: ~699 箇所( 812 から 113 箇所控除のラフ値)
- test: ~299 箇所(方針どおり維持)
- hack_check (.hako) は別フェーズで扱う( Rust 側とは切り離し)
---
2025-12-03 11:31:35 +09:00
## Section 3: Ring0.log Expansion Plan (Sketch)
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
### Future Directions (Not Implemented)
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
This section outlines **potential** future uses of Ring0.log. Implementation is deferred to Phase 100+.
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
---
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
#### Option 1: Error Log Consolidation
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Concept**: Unify error logging through Ring0.log
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Examples**:
```rust
// VM execution errors
ring0.log.error(& format!("VM execution failed: {}", err));
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
// Parser errors
ring0.log.error(& format!("Parse error at line {}: {}", line, msg));
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
// MIR lowering errors
ring0.log.error(& format!("Lowering failed for {}: {}", node, reason));
```
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Benefits**:
- Centralized error logging
- Consistent error format
- Easy to redirect to files or monitoring systems
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Phase 99 Decision**: Concept documented, implementation deferred
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
---
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
#### Option 2: Internal State Logging
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Concept**: Use Ring0.log for runtime state tracking
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Examples**:
```rust
// Memory usage
ring0.log.debug(& format!("Memory allocated: {} bytes", size));
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
// GC triggers
ring0.log.info("Garbage collection triggered");
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
// Cache events
ring0.log.debug(& format!("Cache hit rate: {}%", rate));
```
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Benefits**:
- Non-intrusive diagnostics
- Performance monitoring
- Debugging production issues
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Phase 99 Decision**: Concept documented, implementation deferred
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
---
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
#### Option 3: Execution Tracing
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Concept**: Trace program execution through Ring0.log
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Examples**:
```rust
// Function entry/exit
ring0.log.debug(& format!("Entering function: {}", name));
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
// State transitions
ring0.log.info(& format!("State changed: {} -> {}", old, new));
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
// Performance markers
ring0.log.debug(& format!("Operation completed in {}ms", duration));
```
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Benefits**:
- Detailed execution visibility
- Performance profiling
- Bug reproduction
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Phase 99 Decision**: Concept documented, implementation deferred
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
---
### Implementation Priority (Future)
**Phase 100-101 Focus**: User-facing migrations (console_println!)
**Phase 102+ Candidates**:
1. Error log consolidation (HIGH impact)
2. Internal state logging (MEDIUM impact)
3. Execution tracing (LOW impact, high cost)
**Decision Point**: After console_println! migration is complete
2025-12-02 23:46:32 +09:00
---
2025-12-03 11:31:35 +09:00
## Section 4: Call Site Distribution
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
### By Module (Approximate)
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**src/runner/**: ~366 locations
- Priority: HIGH (user-facing)
- Target: console_println!
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**src/mir/**: ~200 locations
- Priority: MEDIUM (internal/debug)
- Target: Ring0.log or removal
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**src/parser/**: ~150 locations
- Priority: MEDIUM (internal/debug)
- Target: Ring0.log or removal
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**tests/**: ~299 locations
- Priority: LOW (keep as-is)
- Target: None
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Other**: ~761 locations
- Priority: TBD
- Target: TBD
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
---
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
### By Type (Approximate)
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Error messages**: ~400 locations
- User errors → console_println!
- Internal errors → Ring0.log.error
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Debug output**: ~600 locations
- Development debug → Ring0.log.debug or removal
- Temporary debug → removal
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Progress/info**: ~200 locations
- User progress → console_println!
- Internal progress → Ring0.log.info
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Test output**: ~299 locations
- Keep as-is
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Other**: ~277 locations
- TBD
2025-12-02 23:46:32 +09:00
2025-12-03 14:07:01 +09:00
### Phase 104: .hako側ロギング設計 (COMPLETED)
**Scope**:
- ConsoleBox適切な使い方ガイド
- ユーザー定義Boxからのロギングベストプラクティス
- 4つのロギングカテゴリ確立( user-facing/dev-debug/monitoring/internal Rust)
- 3つのロギングBoxパターン( Lightweight/Structured/Contextual)
**Files Created/Updated**:
- docs/development/current/main/logging_policy.md (Section 4 追加)
- docs/development/current/main/hako_logging_design.md (new)
**Status**: Complete - .hako側ロギング設計確立
2025-12-03 11:31:35 +09:00
---
2025-12-02 23:46:32 +09:00
2025-12-03 14:33:04 +09:00
### Phase 105: Logger Box Framework (COMPLETED)
**Scope**:
- Logger Box インターフェース設計(ログレベル: DEBUG/INFO/WARN/ERROR)
- 3つの設計パターン( Lightweight/Structured/Contextual) のリファレンス実装例
- Phase 99-104 ロギングポリシーとの整合確認
**Files Created/Updated**:
- docs/development/current/main/logger_box_design.md (new)
- docs/development/current/main/logging_policy.md (updated)
- docs/development/current/main/hako_logging_design.md (updated)
**Status**: Design + reference examples complete. Runtime implementation deferred to Phase 106+.
---
2025-12-03 11:31:35 +09:00
## Section 5: Migration Roadmap
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
### Phase 99 (Current): Documentation & Planning
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Objectives**:
- ✅ Document Ring0.log infrastructure
- ✅ Categorize remaining println!/eprintln! call sites
- ✅ Establish migration strategy
- ✅ Define completion criteria
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Deliverables**:
- This document (ring0-inventory.md)
- Logging policy (logging_policy.md)
- Updated core_boxes_design.md Section 15.6-A
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
---
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
### Phase 100-101: User-Facing Migrations
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Objectives**:
- Migrate ~366 user-facing println! to console_println!
- Focus on src/runner/ paths
- Ensure all CLI messages use ConsoleService
2025-12-02 23:46:32 +09:00
2025-12-03 11:31:35 +09:00
**Estimated Effort**: Medium (straightforward replacements)
**Success Criteria**:
- All user-visible messages use console_println!
- No println! in main execution paths
- Tests still pass
---
### Phase 102+: Internal Logging
**Objectives**:
- Evaluate Ring0.log usage for internal logging
- Migrate or remove dev-debug println!
- Consolidate error logging
**Estimated Effort**: Variable (requires case-by-case analysis)
**Success Criteria**:
- Clear separation: Ring0.log (internal) vs ConsoleService (user)
- No unnecessary println! in production code
- Test println! remains untouched
2025-12-02 23:46:32 +09:00
---
2025-12-03 11:31:35 +09:00
## Section 6: Grep Commands for Investigation
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
### Finding Call Sites
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
```bash
# All println!/eprintln! in source code
rg 'println!|eprintln!' --type rust
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
# Excluding tests
rg 'println!|eprintln!' --type rust --glob '!**/tests/**' --glob '!**/test_*.rs'
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
# Only in src/runner/
rg 'println!|eprintln!' --type rust src/runner/
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
# Only in src/mir/
rg 'println!|eprintln!' --type rust src/mir/
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
# Only in tests
rg 'println!|eprintln!' --type rust --glob '**/tests/**' --glob '**/test_*.rs'
```
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
---
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
### Finding console_println! Usage
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
```bash
# Current console_println! usage
rg 'console_println!' --type rust
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
# Potential candidates for console_println!
rg 'eprintln!\("Error:|Warning:|Info:' --type rust
```
---
### Finding Ring0.log Usage
```bash
# Current Ring0.log usage
rg 'ring0\.log\.(debug|info|warn|error)' --type rust
# LogApi trait implementations
rg 'impl.*LogApi' --type rust
```
---
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
## Section 7: Historical Migration Data (Phase 88-90)
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
### Phase 88-90: ring0.log.* Migration (56 locations)
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
**Migrated Files**:
- `src/runner/selfhost.rs` : 11 locations
- `src/runner/modes/vm.rs` : 22 locations
- `src/runner/modes/vm_fallback.rs` : 4 locations
- `src/runner/modes/common_util/hack_check.rs` : 19 locations
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
**Impact**: Consolidated user-facing error messages to Ring0.log.error()
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
---
### Phase 90: Ring0 API Migration (12 locations)
**Phase 90-A: fs API (7 locations)**:
- `src/runner/modes/common_util/resolve/strip.rs` : 4 locations
- `src/runner/dispatch.rs` : 1 location
- `src/runner/mod.rs` : 3 locations
- Migration: `std::fs::read_to_string` → `ring0.fs.read_to_string`
**Phase 90-C: time API (3 locations)**:
- `src/runner/modes/common_util/selfhost_exe.rs` : 1 location
- `src/runner/modes/common_util/io.rs` : 1 location
- `src/runtime/plugin_loader_unified.rs` : 1 location
- Migration: `Instant::now() + elapsed()` → `ring0.time.monotonic_now() + ring0.time.elapsed()`
**Phase 90-D: thread API (2 locations)**:
- `src/runtime/global_hooks.rs` : 1 location
- `src/runtime/plugin_loader_unified.rs` : 1 location
- Migration: `std::thread::sleep` → `ring0.thread.sleep`
---
## Section 8: Success Metrics
### Completion Criteria
**Phase 99 Complete** when:
- ✅ Ring0.log infrastructure documented
- ✅ println!/eprintln! call sites categorized
- ✅ Migration strategy established
- ✅ Roadmap defined for Phase 100+
**Phase 100-101 Complete** when:
- All user-facing println! migrated to console_println!
- src/runner/ paths use ConsoleService exclusively
- Test println! remains untouched
**Phase 102+ Complete** when:
- Internal logging uses Ring0.log appropriately
- No unnecessary println! in production code
- Clear separation of concerns maintained
---
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
## Related Documentation
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
2025-12-03 11:31:35 +09:00
- [Logging Policy ](logging_policy.md ) - Role separation and macro policy
- [CoreBoxes Design - Section 15.6-A ](core_boxes_design.md#section-156-a-logsoutput-unified-design ) - Architectural context
- [Phase 85 CURRENT_TASK ](../../../CURRENT_TASK.md ) - Implementation timeline
feat(phase90): Ring0Context fs/time/thread migration complete
Phase 90 完了: IO/fs/time/thread 系の Ring0 移行
**Phase 90-A: fs 系移行(7箇所)**
- FsApi trait 追加(6メソッド)
- StdFs 実装(std::fs ベース)
- IoError 拡張(4バリアント追加)
- 移行: strip.rs(4), dispatch.rs(1), mod.rs(3)
**Phase 90-B: io 系移行**
- Phase 88 完了済み(スキップ)
**Phase 90-C: time 系移行(3箇所)**
- TimeApi に elapsed() 追加
- 移行: selfhost_exe.rs(1), io.rs(1), plugin_loader_unified.rs(1)
**Phase 90-D: thread 系移行(2箇所)**
- ThreadApi trait 追加(sleep メソッド)
- StdThread 実装
- 移行: global_hooks.rs(1), plugin_loader_unified.rs(1)
**Phase 90-E: 統合テスト**
- ビルド成功(6 warnings, 0 errors)
- テスト: 522/554 passed (94.2%)
- 退行なし
**実装成果**:
- Ring0Context 拡張: fs, thread フィールド追加
- 総移行: 12箇所(fs: 7, time: 3, thread: 2)
- 移行率: fs(2.9%), time(2.1%), thread(5.4%)
**次のステップ**: Phase 91 (PluginHost/CoreServices skeleton)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:14:57 +09:00
---
2025-12-03 13:42:05 +09:00
### Phase 102: MemApi Bridge Skeleton (COMPLETED)
**Completed Tasks**:
- ✅ StdMem implementation (stdlib alloc/free)
- ✅ default_ring0() unified to use StdMem
- ✅ Unit tests for StdMem allocation and statistics
- ✅ NoopMem retained for compatibility
**Status**: Skeleton ready for Phase 102B (hakmem bridge integration)
**Files Modified**:
- src/runtime/ring0/std_impls.rs (added StdMem)
- src/runtime/ring0/mod.rs (updated default_ring0, exports)
- docs/development/current/main/phase-85-ring0-runtime/README.md (added Phase 102 section)
- docs/development/current/main/ring0-inventory.md (this file)
---
2025-12-03 13:59:06 +09:00
### Phase 103: CoreServices Optional化 (COMPLETED)
**Scope**:
- CoreServicesConfig struct (from_env, minimal, all_enabled)
- with_core_from_registry_optional() implementation
- Environment variable control (NYASH_CORE_DISABLE_* pattern)
- CoreBoxesImpl updated to Option< Arc < dyn XyzService > >
**Status**: Optional initialization ready for memory-constrained environments
**Files Modified**:
- src/runtime/plugin_host.rs (added CoreServicesConfig, with_core_from_registry_optional)
- src/runtime/core_services.rs (CoreBoxesImpl fields → Option type)
- docs/development/current/main/core_optional_design.md (new)
- docs/development/current/main/ring0-inventory.md (this file)
---
2025-12-03 11:31:35 +09:00
## Summary
2025-12-02 23:46:32 +09:00
2025-12-03 19:37:32 +09:00
Phase 85– 108 で、Ring0 / CoreServices / FileBox / Logging の基礎はほぼ出揃った:
2025-12-02 23:46:32 +09:00
2025-12-03 19:37:32 +09:00
- Ring0Context: Mem/Io/Time/Log/Fs/Thread の抽象化が確立
- CoreBoxId/CoreMethodId: Box 名・メソッド名の SSOT 化
- CoreServices/PluginHost: ring1-core (String/Integer/Bool/Array/Map/Console) の service 化
- ConsoleService/Logging: 3層設計( Ring0.log / ConsoleService / test println!)が定着
- FileBox: CoreRequired 扱い + Ring0FsFileIo 経由で read/write 両対応
2025-12-02 21:52:18 +09:00
2025-12-03 19:37:32 +09:00
Phase 99 は logging infrastructure と println! call site の在庫を整理し:
2025-12-03 13:42:05 +09:00
2025-12-03 19:37:32 +09:00
1. **Ring0.log** : dev/debug ログの受け皿として拡張準備済み
2. **println!/eprintln!** : ~1400 箇所を 4 カテゴリに分類( user-facing/dev/test/internal)
3. **Migration strategy** : user-facing → Ring0.log/internal の順で段階的移行
Phase 102 では StdMem 実装により hakmem 統合の足場を用意し、
Phase 106– 108 では FileBox provider_lock / Ring0FsFileIo / write/write_all 実装により、
`FileBox → FileIo → Ring0.FsApi → std::fs` のパイプラインが完成した。
### Next Phases( 計画)
今後の候補フェーズ(優先度の高い順):
2025-12-03 20:28:33 +09:00
- ✅ **Phase 109: runtime profiles( default/no-fs) ** (COMPLETED)
2025-12-03 19:37:32 +09:00
- `NYASH_PROFILE={default|no-fs}` などのプロファイル導入
- default では FileBox 必須、no-fs では FileBox provider 未登録(エラー文字列で通知)
2025-12-03 20:28:33 +09:00
- ✅ **Phase 110: FileHandleBox** (COMPLETED - 2025-12-03)
2025-12-03 19:37:32 +09:00
- FileBox を「1ファイル専用」に保ちつつ、複数ファイル同時アクセスは FileHandleBox 側に切り出す
- Ring0FsFileIo を再利用してハンドル単位の管理を行う
2025-12-03 20:28:33 +09:00
- ハンドルベース複数回アクセス I/O 完全実装
- 実装: `src/boxes/file/handle_box.rs` (7テスト全PASS)
- API: open(path, mode) → read/write → close()
- プロファイル対応: Default ✅、NoFs ❌
- **Phase 111: Fs metadata 拡張 + append mode**
- FileHandleBox に append mode ("a") を追加
2025-12-03 19:37:32 +09:00
- `exists/metadata/canonicalize` を FileIo / FileBox 側にきちんとエクスポート
- Ring0.FsApi の stat 情報を Nyash 側から扱えるようにする
さらに長期的には、Ring0 全体を「統一サービスレジストリ」として扱うフェーズ( Mem/Io/Time/Log/Fs/Thread の trait 統合)を
Phase 11x 以降で検討する予定だよ。