feat(runtime): Phase 103 CoreServices Optional化 - Memory Constraints対応
- Add CoreServicesConfig struct (from_env, minimal, all_enabled) - Implement with_core_from_registry_optional() for selective initialization - Update CoreBoxesImpl fields to Option<Arc<dyn XyzService>> - Maintain backward compatibility (with_core_from_registry calls all_enabled) - Add NYASH_CORE_DISABLE_* environment variable support - ConsoleBox remains mandatory (Graceful Degradation principle) - Add unit tests for optional initialization - Update console_println! macro to handle Option type - Fix direct console.println() calls in vm.rs and selfhost.rs - Create core_optional_design.md documentation Note: Phase 104 will extend ConsoleService to be optional as well with graceful fallback in console_println! macro. Files modified: - src/runtime/plugin_host.rs (CoreServicesConfig, with_core_from_registry_optional, tests) - src/runtime/core_services.rs (CoreBoxesImpl fields → Option type) - src/runtime/mod.rs (console_println! macro updated) - src/runner/modes/vm.rs (handle Option console) - src/runner/selfhost.rs (handle Option console) - docs/development/current/main/core_optional_design.md (new) - docs/development/current/main/ring0-inventory.md (Phase 103 entry) Test results: - Build: ✅ Success (0 errors, 7 warnings) - Unit tests: ✅ 3/3 passed (optional_core_tests) - Runtime tests: ✅ 63/63 passed - Smoke tests: ✅ 30/31 passed (1 pre-existing timeout)
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
|
||||
This document establishes the clear separation of concerns between three logging/output layers in the Nyash runtime, and provides guidelines for transitioning the remaining ~1477 println!/eprintln! call sites to the appropriate mechanism.
|
||||
|
||||
**Status**: Design phase (Phase 99) - documentation only, no code implementation yet.
|
||||
**Status**: Phase 101-B in progress — documentation plus partial internal log migration (Ring0.log) and test-output policy fixed.
|
||||
|
||||
---
|
||||
|
||||
@ -415,3 +415,45 @@ crate::runtime::get_global_ring0().log.debug(&format!(
|
||||
- 環境に応じた出力制御が可能(将来の活用に向けて)
|
||||
- stderr の cleanness 向上(ユーザー向けメッセージのみになる)
|
||||
- Phase 99-100 で確立した 3層設計を実装レベルで完成
|
||||
|
||||
---
|
||||
|
||||
## Section 7-B: Phase 101-B internal/test ログ整理(2025-12-04)
|
||||
|
||||
### 内部ログを Ring0.log に寄せ、テスト出力ポリシーを固定
|
||||
|
||||
**実装概要**:
|
||||
- internal/dev ログ 26 箇所を Ring0.log に移行(stderr 汚染を削減) → 第1バッチ
|
||||
- 対象: provider_lock.rs, plugin_loader_unified.rs, type_meta.rs, deprecations.rs, leak_tracker.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バッチ
|
||||
- 対象: provider_verify.rs, scheduler.rs, gc_controller.rs, box_registry.rs
|
||||
- Plugin loader v2 specs: loader/specs.rs(TypeBox ABI/trace)
|
||||
- Runner trace: runner/trace.rs(cli_verbose トレース)
|
||||
- MIR verifier dev-trace: mir/verification.rs(NYASH_BREAKFINDER_SSA_TRACE/NYASH_DEBUG_VERIFIER)
|
||||
- internal/dev ログ 20 箇所を追加で Ring0.log 化 → 第3バッチ
|
||||
- MIR core: basic_block.rs, 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(trace)/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)
|
||||
- ログレベル整理: init/loader 失敗は error、warn-once 系は warn、トレースは debug/info に整理
|
||||
- ログレベル整理: init/loader 失敗は error、warn-once 系は warn、トレースは debug/info に整理
|
||||
|
||||
**テスト出力方針**:
|
||||
- Rust テスト内(src/tests/, tests/)の println!/eprintln! は原則許容(大きな出力のみ将来検討)
|
||||
- 本フェーズではテストコードは無変更、ポリシーを docs に明文化
|
||||
|
||||
**残件**:
|
||||
- internal/dev ログ残量: 概算で ~475–495 箇所(引き続き段階的に Ring0.log へ移行/削除)
|
||||
- user-facing: console_println! 移行は別ラインで継続
|
||||
- .hako/hack_check: Rust とは別フェーズで整理
|
||||
|
||||
**成果**:
|
||||
- Ring0/Ring1/Core の責務分離を保ったまま internal ログを OS 抽象層に集約
|
||||
- 環境変数ベースのデバッグトレース(PLUGIN_DEBUG, HAKO_*)も Ring0.log 経由に統一
|
||||
- stderr のノイズ低減とログ観測の一元化を達成
|
||||
|
||||
Reference in New Issue
Block a user