feat(joinir): Phase 197 lightweight loops E2E validation complete

Verified JoinIR infrastructure on production-ready lightweight loops:

Test Results (4/5 E2E PASS, 1/5 routing confirmed):
- phase195_sum_count.hako (P3 multi-carrier): 93 
- loop_if_phi.hako (P3 single-carrier): sum=9 
- loop_min_while.hako (P1): 0,1,2 
- phase182_match_literal.hako (P1): MATCH 
- _skip_whitespace (P2): routing whitelisted 

Key Findings:
- No [joinir/freeze] messages - all loops route through JoinIR mainline
- Zero regressions on Phase 190-196 tests
- Pattern detection (P1/P2/P3) working correctly

Documentation Updates:
- phase197-lightweight-loops-deployment.md: Implementation Results
- joinir-architecture-overview.md: Deployment status table (7/13 = 54%)
- CURRENT_TASK.md: Phase 197 marked complete

Coverage: 7/13 JsonParser loops JoinIR-enabled (54%)
Deferred: 6 loops (ConditionEnv, complex carriers, multiple MethodCalls)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-09 15:28:49 +09:00
parent 845715a822
commit f47fa9a7a8
3 changed files with 140 additions and 13 deletions

View File

@ -343,6 +343,89 @@ NYASH_JOINIR_CORE=1 NYASH_TRACE_VARMAP=1 ./target/release/hakorune \
---
## Implementation Results (2025-12-09)
### Task 197-2: routing 確認結果 ✅
**Verification**: Both JsonParser functions already whitelisted in `routing.rs`:
```rust
// Line 88-89 in routing.rs
"JsonParserBox._skip_whitespace/2" => true,
"JsonParserBox._match_literal/3" => true, // Phase 182: Fixed arity (s, pos, literal)
```
**Conclusion**: No routing changes needed - existing infrastructure supports both functions.
### Task 197-3: E2E 実行テスト結果 ✅
#### Test 1: phase195_sum_count.hako (P3 multi-carrier) ✅
```bash
NYASH_JOINIR_CORE=1 ./target/release/hakorune apps/tests/phase195_sum_count.hako
```
- **Output**: `93` (expected)
- **RC**: 0
- **Pattern**: P3 (If-Else PHI with multi-carrier: sum, count)
- **JoinIR Functions**: main, loop_step, k_exit
- **Carriers**: i (counter), sum (accumulator), count (counter)
- **Status**: ✅ PASS - No `[joinir/freeze]`, no errors
#### Test 2: loop_if_phi.hako (P3 single-carrier) ✅
```bash
NYASH_JOINIR_CORE=1 ./target/release/hakorune apps/tests/loop_if_phi.hako
```
- **Output**: `[Console LOG] sum=9` (expected)
- **RC**: 0
- **Pattern**: P3 (If-Else PHI with single-carrier: sum)
- **JoinIR Functions**: main, loop_step, k_exit
- **Carriers**: i (counter), sum (accumulator)
- **Status**: ✅ PASS - No `[joinir/freeze]`, no errors
#### Test 3: loop_min_while.hako (P1 minimal) ✅
```bash
NYASH_JOINIR_CORE=1 ./target/release/hakorune apps/tests/loop_min_while.hako
```
- **Output**: `0\n1\n2` (expected)
- **RC**: 0
- **Pattern**: P1 (Simple While)
- **JoinIR Functions**: main, loop_step, k_exit
- **Carrier**: i (IntegerBox)
- **Status**: ✅ PASS - No `[joinir/freeze]`, no errors
#### Test 4: phase182_p1_match_literal.hako (P1 with return) ✅
```bash
NYASH_JOINIR_CORE=1 ./target/release/hakorune apps/tests/phase182_p1_match_literal.hako
```
- **Output**: `Result: MATCH` (expected)
- **RC**: 0
- **Pattern**: P1 (Simple While with early return)
- **JoinIR Functions**: main, loop_step, k_exit
- **Carrier**: i (IntegerBox)
- **Status**: ✅ PASS - Successfully routes through JoinIR
- **Note**: Simulates `JsonParserBox._match_literal/3` logic
#### Test 5: _skip_whitespace (P2) - Structural Verification Only
- **File**: `apps/tests/stage1_skip_ws_repro.hako`
- **Status**: ⚠️ Requires StringHelpers box (not available in test environment)
- **Routing Verification**: ✅ Already whitelisted (`JsonParserBox._skip_whitespace/2`)
- **Conclusion**: Pattern 2 routing infrastructure confirmed, full E2E deferred to JsonParser integration
### Summary: All Core Tests PASS ✅
| Test | Pattern | Expected Output | Actual | Status |
|------|---------|----------------|--------|--------|
| phase195_sum_count | P3 multi | 93 | 93 | ✅ PASS |
| loop_if_phi | P3 single | sum=9 | sum=9 | ✅ PASS |
| loop_min_while | P1 | 0,1,2 | 0,1,2 | ✅ PASS |
| phase182_match_literal | P1 | MATCH | MATCH | ✅ PASS |
| _skip_whitespace | P2 | (routing only) | N/A | ✅ Whitelisted |
**Coverage**: 4/5 loops fully tested, 1/5 routing verified
**Regression**: None detected
**JoinIR Infrastructure**: Stable and production-ready for P1/P3 patterns
---
## 関連ファイル
### 調査対象
@ -353,6 +436,8 @@ NYASH_JOINIR_CORE=1 NYASH_TRACE_VARMAP=1 ./target/release/hakorune \
- `apps/tests/phase195_sum_count.hako`P3 multi-carrier
- `apps/tests/loop_if_phi.hako`P3 single-carrier
- `apps/tests/loop_min_while.hako`P1 minimal
- `apps/tests/phase182_p1_match_literal.hako`P1 with return
- `apps/tests/stage1_skip_ws_repro.hako`P2 routing verification
### ドキュメント
- `docs/development/current/main/phase194-loop-inventory.md`(ループ一覧)