|
|
701f1fd650
|
feat(joinir): Phase 164 Pattern3 (If-Else PHI) validation complete
- Created 4 representative test cases for Pattern3 patterns:
* test_pattern3_if_phi_no_break.hako - Core Pattern3 (if-else PHI, no break/continue)
* test_pattern3_skip_whitespace.hako - Pattern3+break style (routed to Pattern2)
* test_pattern3_trim_leading.hako - Pattern3+break style (routed to Pattern2)
* test_pattern3_trim_trailing.hako - Pattern3+break style (routed to Pattern2)
- Validated Pattern3_WithIfPhi detection:
* Pattern routing: Pattern3_WithIfPhi MATCHED confirmed
* JoinIR lowering: 3 functions, 20 blocks → 8 blocks (successful)
* [joinir/freeze] elimination: Complete (no errors on any test)
- Clarified pattern classification:
* Pattern3_WithIfPhi handles if-else PHI without break/continue
* Loops with "if-else PHI + break" are routed to Pattern2_WithBreak
* Break takes priority over if-else PHI in pattern detection
- Cumulative achievement (Phase 162-164):
* Pattern1: 6 loops working ✅
* Pattern2: 5 loops working ✅
* Pattern3 (no break): 1 loop working ✅
* Pattern3+break (as Pattern2): 3 loops working ✅
* Total: 15 loops covered, zero [joinir/freeze] errors
- Updated CURRENT_TASK.md with Phase 164 section and findings
Next: Phase 165 Pattern4 (continue) validation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-12-06 16:22:38 +09:00 |
|
|
|
e328be0307
|
Phase 122.5-126完了:ConsoleBox 品質改善・最適化・統合
## 実装成果(Phase 122.5-126)
### Phase 122.5: nyash.toml method_id 修正
- println method_id を 2 → 1 に統一(log と同じ)
- TypeRegistry slot 400 との整合性確保
### Phase 123: ConsoleBox WASM/非WASM コード統一化
- マクロ define_console_impl! による重複排除
- 67行削減(27.3% 削減達成)
- ビルド成功・全テストパス
### Phase 124: VM Method Dispatch 統一化
- TypeRegistry ベースの統一ディスパッチ (dispatch_by_slot)
- String/Array/ConsoleBox を一元化
- 100行削減、メソッド解決の高速化
### Phase 125: 削除:deprecated builtin ConsoleBox
- src/box_factory/builtin_impls/console_box.rs 削除
- Plugin-only 移行で "Everything is Plugin" 実現
- 52行削減
### Phase 126: ドキュメント統合
- consolebox_complete_guide.md (27KB統合マスター)
- core_boxes_design/logging_policy/hako_logging_design 更新
- ~750行の navigation・cross-reference 改善
## 数値成果
- **総コード削減**: 219行
- **新規ドキュメント**: 1ファイル (+27KB)
- **更新ドキュメント**: 6ファイル (+~750行)
- **テスト**: Phase 120 representative tests ✅ PASS
- **ビルド**: Zero errors
## 設計原則の完全実現
✅ println/log エイリアス統一(Phase 122)
✅ WASM/非WASM 統一化(Phase 123)
✅ TypeRegistry 統合(Phase 124)
✅ Plugin-only 移行(Phase 125)
✅ ドキュメント統合(Phase 126)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-12-04 06:02:03 +09:00 |
|
|
|
024a09c15b
|
feat(core): Phase 122 ConsoleBox.println / log unification
## Phase 122: ConsoleBox.println / log の統一 (完了)
### 概要
ConsoleBox.printlnをlogのエイリアスとしてVM/TypeRegistryレベルで統一。
Phase 120で発見されたesc_dirname_smoke.hakoの「Unknown method 'println'」
エラーを完全解消。
### 完了タスク
- ✅ TypeRegistry修正: printlnをlogのエイリアス(slot 400)として追加
- ✅ ConsoleBox実装: printlnメソッドのラッパ追加
- ✅ VM Method Dispatch: ConsoleBox専用ハンドラ追加
- ✅ Plugin設定: nyash.tomlにprintln (method_id 2)追加
- ✅ ドキュメント更新: 3ファイル(hako_logging/logging_policy/core_boxes)
### 実装詳細
#### 1. TypeRegistry (src/runtime/type_registry.rs)
```rust
const CONSOLE_METHODS: &[MethodEntry] = &[
MethodEntry { name: "log", arity: 1, slot: 400 },
MethodEntry { name: "warn", arity: 1, slot: 401 },
MethodEntry { name: "error", arity: 1, slot: 402 },
MethodEntry { name: "clear", arity: 0, slot: 403 },
// Phase 122: println は log のエイリアス
MethodEntry { name: "println", arity: 1, slot: 400 },
];
```
#### 2. ConsoleBox (src/boxes/console_box.rs)
- WASM/非WASM両方にprintln()メソッド追加
- 内部的にlog()に委譲
#### 3. VM Method Dispatch (src/backend/mir_interpreter/handlers/calls/method.rs)
- ConsoleBox専用ハンドラ追加
- log/println/warn/error/clearをサポート
- args配列の正しい処理(len > 1時はargs[1]を使用)
#### 4. Plugin設定 (nyash.toml)
- ConsoleBox.methodsにprintln追加(method_id=2)
- method_id整合性: log=1, println=2
### テスト結果
- ✅ esc_dirname_smoke.hako実行成功
- 旧エラー: "Unknown method 'println'" ← **完全解消**
- 新出力: `[Console LOG] dir1/dir2`
### Phase 120問題解決
**Phase 120ベースラインでの課題**:
- ❌ esc_dirname_smoke.hako: ConsoleBox.println未実装
**Phase 122での解決**:
- ✅ TypeRegistryレベルでprintln→log正規化
- ✅ 全経路(JSON v0/selfhost/通常VM)で一貫性保証
### ファイル構成
**新規作成**:
- docs/development/current/main/phase122_consolebox_println_unification.md
**修正**:
- src/runtime/type_registry.rs (+5行)
- src/boxes/console_box.rs (+14行, WASM/非WASM両対応)
- src/backend/mir_interpreter/handlers/calls/method.rs (+60行)
- nyash.toml (+1メソッド定義)
- docs/development/current/main/hako_logging_design.md (+40行)
- docs/development/current/main/logging_policy.md (+30行)
- docs/development/current/main/core_boxes_design.md (+20行)
### 技術的成果
- **Alias First原則**: VM/TypeRegistryレベルで正規化
- **Phase 120連携**: ベースライン確立→問題発見→根本解決
- **全経路統一**: selfhost/JSON v0/通常VMすべてで動作
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-12-04 05:16:06 +09:00 |
|
|
|
f8790b13cc
|
docs(phase 105): Logger Box Framework設計&ドキュメント整備
- Create logger_box_design.md: comprehensive Logger Box framework design
- Define 3 reference patterns (Lightweight/Structured/Contextual)
- Add pseudo-code examples for each pattern (reference only)
- Update logging_policy.md: add Logger Box reference
- Update hako_logging_design.md: Logger Box integration with Phase 104
- Update ring0-inventory.md: Phase 105 entry
- Update CURRENT_TASK.md: Phase 105 completion + Phase 106+ backlog
Design principles:
- Logger Box provides level-based logging (DEBUG/INFO/WARN/ERROR)
- Phase 105 scope: ConsoleBox output only
- Phase 106 scope: output redirection (FileBox/NetworkBox)
- Reference examples for documentation (execution testing Phase 106+)
This completes the structured logging framework design, building on
Phase 99 (logging policy), Phase 100-101 (Rust logging), Phase 104
(.hako patterns), and Phase 105.5 (console macro unification).
|
2025-12-03 14:33:04 +09:00 |
|
|
|
8203882a97
|
docs(phase 104): .hako側ロギング設計ガイド確立
- Add Section 4 (.hako側ロギング方針) to logging_policy.md
- Create hako_logging_design.md (comprehensive guide, 331 lines)
- Define 4 logging categories (user-facing/dev-debug/monitoring/internal Rust)
- Provide 3 logging box patterns (Lightweight/Structured/Contextual)
- Add best practices and anti-patterns with code examples
- Update ring0-inventory.md with Phase 104 entry
- Cross-reference documentation for consistency
This completes Phase 104: establishing user-facing logging guidelines
for Nyash applications, complementing Rust-side logging policy from
Phase 99-101.
Files modified:
- docs/development/current/main/logging_policy.md
- docs/development/current/main/hako_logging_design.md (new)
- docs/development/current/main/ring0-inventory.md
Related: Phase 99 (logging policy design), Phase 100-101 (Rust impl)
|
2025-12-03 14:07:01 +09:00 |
|
|
|
6ecd8f7f52
|
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)
|
2025-12-03 13:59:06 +09:00 |
|
|
|
0c527dcd22
|
feat(runtime): Phase 101-A dev-debug ログの Ring0.log 統一 - 34箇所完了
## Phase 101-A 完了項目
- ✅ llvm.rs: 13箇所([joinir/llvm], [parse/context]) → Ring0.log
- ✅ loop_form.rs: [loopform] 系ログ → Ring0.log
- ✅ loopform_builder.rs: 16箇所([loopform/prepare], [loopform/seal_phis]) → Ring0.log
- ✅ loop_snapshot_merge.rs: 5箇所([Option C]) → Ring0.log
- ✅ 全テストPASS(ビルド成功)
## 置き換え箇所(34箇所)
**llvm.rs**(13箇所):
- [joinir/llvm] JoinIR 実験パスログ(12箇所)
- [parse/context] プリロードファイルリスト(1箇所)
**loop_form.rs**(複数箇所):
- [loopform] 基本ログ
- [loopform/condition] 条件式処理
- [loopform/writes] 変数書き込み収集
**loopform_builder.rs**(16箇所):
- [loopform/prepare] 構造準備
- [loopform/seal_phis] PHI シーリング処理
**loop_snapshot_merge.rs**(5箇所):
- [Option C] Exit PHI 分類
- [Option C] 変数解析
## 技術的成果
- Ring0.log で dev-debug ログを一元管理
- stderr の cleanness 向上(ユーザー向けメッセージのみ)
- 環境に応じた出力制御が可能(NYASH_LOOPFORM_DEBUG等)
- Phase 99-100 で確立した 3層設計を実装レベルで完成
## 実装パターン
```rust
// Before
eprintln!("[loopform] variable_map: {:?}", map);
// After
crate::runtime::get_global_ring0().log.debug(&format!(
"[loopform] variable_map: {:?}", map
));
```
## 統計
- Phase 98: 7箇所(ConsoleService)
- Phase 100: 29箇所(ConsoleService)
- Phase 101-A: 34箇所(Ring0.log)
- **合計**: 70箇所で統一(ConsoleService/Ring0.log)
- 残り: ~905箇所(test含む)
## ドキュメント更新
- logging_policy.md: Section 7-A 追加(Phase 101-A 実装記録)
- ring0-inventory.md: Category 2 更新(dev-debug 進捗反映)
- CURRENT_TASK.md: Phase 85 セクション追記
## Phase 85-101-A 総括
- Phase 95.5-97: CoreServices 6個完全実装(String/Integer/Bool/Array/Map/Console)
- Phase 98-98.5: ConsoleService 代表パス拡張(7箇所)
- Phase 99: ログ/出力ポリシー確定(3層設計文書化)
- Phase 100: user-facing 出力の ConsoleService 化(29箇所)
- Phase 101-A: dev-debug ログの Ring0.log 統一(34箇所) ✅
次: Phase 101-B(internal/test ログの整理、別検討)
🎊 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-12-03 12:25:32 +09:00 |
|
|
|
7cf11fbc5c
|
feat(runtime): Phase 100 user-facing 出力の ConsoleService 完全統一 - 29箇所完了
## Phase 100 完了項目
- ✅ selfhost.rs: 6箇所 → console_println!
- ✅ llvm.rs: 23箇所(主要メッセージ) → console_println!
- ✅ 全テストPASS(core_services: 11, plugin_host: 7)
- ✅ ドキュメント更新完了
## 置き換え箇所(29箇所)
**selfhost.rs**(6箇所):
- Line 57: CoreInitError 出力
- Lines 194/363/418/519/570: Result 出力
**llvm.rs**(23箇所、ユーザー向けメッセージのみ):
- エラーメッセージ(❌): ファイル読み込み、using/parse エラー
- 成功メッセージ(📊): MIR コンパイル成功
- LLVM/harness 関連エラー
- 実行結果出力
- Mock LLVM メッセージ
## 意図的に除外(Phase 101 対象)
- llvm.rs の `[joinir/llvm]`, `[parse/context]` デバッグログ
- hack_check: .hako アプリ(Nyash言語の ConsoleBox 経由)
- bench.rs: テスト・性能表示(dev-debug)
- mir.rs: 内部 MIR ダンプ(dev-debug)
## 技術的成果
- selfhost/LLVM runner のユーザー向けメッセージを ConsoleService に統一
- Phase 99 で確立したログ/出力ポリシーを実装レベルで実現
- デバッグログとユーザー向け出力の明確な分離
- Graceful Degradation パターンの実用確認
## 統計
- Phase 98: 7箇所
- Phase 100: 29箇所
- **合計**: 36箇所で ConsoleService 経由に移行完了
- 残り user-facing: ~330箇所(Phase 101-102 で段階的拡張)
## ドキュメント更新
- logging_policy.md: Section 7 追加(Phase 100 実装完了記録)
- ring0-inventory.md: Category 1 更新(Phase 100 進捗反映)
- CURRENT_TASK.md: Phase 85 セクション追記
## Phase 85-100 総括
- Phase 95.5-97: CoreServices 6個完全実装(String/Integer/Bool/Array/Map/Console)
- Phase 98-98.5: ConsoleService 代表パス拡張(7箇所)
- Phase 99: ログ/出力ポリシー確定(3層設計文書化)
- Phase 100: user-facing 出力の ConsoleService 化(29箇所) ✅
次: Phase 101(dev-debug/test/internal 出力の整理、Ring0.log 活用)
🎊 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-12-03 11:55:14 +09:00 |
|
|
|
c181aeac4d
|
docs(runtime): Phase 99 ログ/出力ポリシー確定 - 3層設計の文書化完成
## Phase 99 完了項目(ドキュメント設計フェーズ)
- ✅ logging_policy.md 新規作成(312行)
- ✅ ring0-inventory.md 更新(455行)
- ✅ core_boxes_design.md Section 15.6-A 追記(+58行)
- ✅ CURRENT_TASK.md Phase 85 セクション更新
## 確定した3層ログ/出力設計
【Ring0.log】(OS API層)
- 用途: ランタイム/OS内部ログ
- 対象: 開発者向けデバッグ・計測・内部状態
- API: ring0.log.debug/info/warn/error(...)
【ConsoleService】(Box層・ユーザー向け)
- 用途: CLIの直接的な出力(ユーザー向けメッセージ)
- 対象: エンドユーザー
- アクセス: console_println! マクロ
【素のprintln!/eprintln!】(制限用途)
- 用途: テスト・一時デバッグのみ限定
- テスト内: 約299箇所そのまま許可
- 本番経路: 撤退すべき
## println!/eprintln! 残件分類(1477箇所)
- user-facing: ~366箇所(HIGH)→ console_println!
- dev-debug: TBD(MEDIUM)→ Ring0.log or dev_* macros
- test: ~299箇所(LOW)→ そのまま許可
- internal: ~812箇所(TBD)
## 設計の価値
- **コード変更なし**: リスク最小(ドキュメントのみ)
- **後工程の基盤**: Phase 100-101で残り~366箇所を片付け可能
- **Fail-Fast原則**: マクロ方針でエラーメッセージは確実に出力
- **段階的移行**: Graceful Degradation パターンで初期化前後を対応
## 新規ドキュメント構成
logging_policy.md:
- Section 1: 3層の役割分担
- Section 2: Macroポリシー
- Section 3: テスト内println!の扱い
- Section 4: 完全統合の完了条件
- Section 5: 設計原則
- Section 6: 関連ドキュメント
ring0-inventory.md:
- Section 1: Ring0.log利用状況
- Section 2: println! 残件分類(4カテゴリ)
- Section 3: Ring0.log活用計画
- Section 4-8: 配布状況・ロードマップ・コマンド・履歴・成功基準
## AI協働開発の成功例
- 設計と実装の分離(Phase 99=設計、Phase 100+=実装)
- 段階的アプローチ(80/20ルール:完璧より進捗)
- ドキュメント優先(コードより先に設計を固める)
## Phase 85-99 総括
- Phase 95.5: StringService/ConsoleService実装
- Phase 96-96.5: ArrayService/MapService & コード整理
- Phase 97: IntegerService/BoolService(#[allow(dead_code)] 根絶)
- Phase 98-98.5: ConsoleService代表パス拡張(7箇所)
- Phase 99: ログ/出力ポリシー確定(設計フェーズ) ✅
次: Phase 100-101(user-facing移行、~366箇所段階的実装)
🎊 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-12-03 11:31:35 +09:00 |
|