feat(joinir): Phase 286 P2.6.1 - Pattern3 Plan 完走(normalizer 実装 + Fail-Fast 統一)

## 変更内容

### Router Fail-Fast 統一
- Pattern3 stub fallback 特例を撤去
- extract 成功 → normalize/lower 失敗は即 Err(他パターンと統一)

### normalize_pattern3_if_phi() 実装
- CFG 構造: 8 blocks (preheader, header, body, then, else, merge, step, after)
- PHI 構成: 3本(header×2 + merge×1)
  - Header: loop_var_current, carrier_current
  - Merge: carrier_next (if-else 合流)
- Frag: BranchStub×2 + EdgeStub×4(Pattern1 流儀の直接構築)

### 発見・修正
- lowerer は body_bb の block_effects を無視して loop_plan.body を emit
- body_bb effects は CorePlan::Effect(...) として loop_plan.body に配置

## テスト結果
- Phase 118 smoke: PASS (出力 12)
- quick: 154/154 PASS
- Plan line 完走確認: route=plan ... Pattern3_IfPhi MATCHED

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-26 04:39:36 +09:00
parent 3abca63ebe
commit 0fca2df5be
3 changed files with 416 additions and 26 deletions

View File

@ -281,25 +281,8 @@ fn try_plan_extractors(
let log_msg = format!("route=plan strategy=extract pattern={}", entry.name);
trace::trace().pattern("route", &log_msg, true);
// Phase 286 P2.6: Pattern3 PoC exception - allow fallback to legacy
// Pattern3 extractor validates structure, but normalizer is stub
if entry.name.contains("Pattern3") {
match lower_via_plan(builder, domain_plan, ctx) {
Ok(value_id) => return Ok(value_id),
Err(_) => {
if ctx.debug {
trace::trace().debug(
"route/plan",
"Pattern3 Plan normalization stub - fallback to legacy Pattern3",
);
}
continue; // Try next extractor (will eventually reach legacy Pattern3)
}
}
}
// Phase 286 P2.4.1: Fail-Fast - extract 成功 → normalize/lower 失敗は即 Err
// 構造的 Fail-Fast: 文字列判定なし、extract が Some なら fallback 禁止
// Phase 286 P2.6.1: Fail-Fast 統一 - extract 成功 → normalize/lower 失敗は即 Err
// Pattern3 stub fallback 撤去(normalizer 実装済み)
return lower_via_plan(builder, domain_plan, ctx);
} else {
// Extraction returned None - try next extractor