97675b4035
docs: Phase 114 DONE
...
Phase 114完了に伴うドキュメント更新:
- 30-Backlog.md: Phase 114の次候補から完了済みに移行
- design/control-tree.md: Phase 110-112の進捗反映
- design/README.md, joinir-design-map.md, phases/README.md: マイナー更新
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-18 02:19:41 +09:00
80be814fa4
test: Phase 114 if-only return+post parity (VM + LLVM EXE)
...
Phase 114 validates that if-only lowering correctly handles cases with:
- Early return in the if-only branch
- Post-if statements that execute on the else path
- Different return values from each path
Fixture: apps/tests/phase114_if_only_return_then_post_min.hako
- Expected output: 7\n2
- f(1): condition true → early return 7
- f(0): condition false → x=1+1=2, return 2
Testing:
- VM backend: phase114_if_only_return_then_post_vm.sh ✅
- LLVM EXE backend: phase114_if_only_return_then_post_llvm_exe.sh ✅
- Regression: Phase 103/113 maintained ✅
Implementation: No new code required - validates existing if-only
exit line routing and post-if statement processing.
Documentation:
- docs/development/current/main/phases/phase-114/README.md
- Updated: 10-Now.md, 01-JoinIR-Selfhost-INDEX.md
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-18 02:18:57 +09:00
70fe0da549
docs: Phase 113 if-only partial assign parity
...
- Create phases/phase-113/README.md (background, fixed pattern, verification)
- Update 10-Now.md with Phase 113 completion
- Update 01-JoinIR-Selfhost-INDEX.md with Phase 113 entry
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-18 01:58:56 +09:00
7829b23cf4
docs: note Phase 110-112 control_tree status
...
- Update 10-Now.md with Phase 112 completion
- Note: StepTree capability guard (strict-only) implemented
- Note: Default behavior unchanged, only affects HAKO_JOINIR_STRICT=1
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-18 01:39:06 +09:00
14730c227f
feat(control_tree): add StepTreeContract and signature (dev-only)
2025-12-18 00:57:58 +09:00
67a2408da5
docs: clarify StepTree boundary (no routing)
2025-12-18 00:30:04 +09:00
b32480823d
docs: add ControlTree/StepTree SSOT
2025-12-18 00:14:04 +09:00
a27e3ce908
docs: Phase 109 DONE
...
- Create phases/phase-109/README.md
- Update 10-Now.md with completion report
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-17 23:45:55 +09:00
23e7f4629f
docs: Phase 109 plan (error_tags hints SSOT)
...
- Add hint policy to joinir-design-map.md
- Document format: [joinir/<category>/<tag>] <msg> Hint: <hint>
- Establish SSOT for error messages
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-17 23:45:32 +09:00
46c924ac6d
docs: add Phase 108 entry
2025-12-17 23:30:13 +09:00
6a21382d44
docs: add Phase 107 to Now/INDEX and backlog
2025-12-17 23:15:57 +09:00
3c934dc69d
test: Phase 107 add find_balanced_object_end fixture + smokes
2025-12-17 23:12:49 +09:00
d42117ac5f
test: Phase 107 find_balanced_array_end fixture + smokes
2025-12-17 22:47:42 +09:00
97c65a9e6f
docs: Phase 107 plan (find_balanced_array_end)
2025-12-17 22:21:42 +09:00
af3b851984
docs: add Phase 107 prep for find_balanced
2025-12-17 22:01:23 +09:00
712e1ad755
docs: update Phase104 status and JoinIR map
2025-12-17 21:47:37 +09:00
a05ce39a1f
test: add Phase104 json_cur read_digits fixture and smokes
2025-12-17 21:25:12 +09:00
950560a3d9
test(joinir): Phase 104 read_digits loop(true) parity
2025-12-17 18:29:27 +09:00
ce501113a7
docs: Phase 103 P1 DONE (early return)
2025-12-17 17:45:16 +09:00
a5cec824c2
docs: Phase 103 DONE (if-only parity smokes)
2025-12-17 17:41:10 +09:00
935d475882
docs: Phase 103 plan (if-only parity baseline)
2025-12-17 17:39:12 +09:00
733b4fa950
docs: Phase 102 entry (real-app regression smokes)
2025-12-17 16:57:15 +09:00
bad8ee1571
docs: Phase 100 P3 string accumulator contract
...
- Add P3 section to phases/phase-100/README.md
- Document allowed form: out = out + ch (Variable RHS only)
- List Fail-Fast cases (Literal RHS, MethodCall RHS, non-string-ish)
- Add example with length-based output
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-17 16:33:03 +09:00
0ea2b7d2cb
fix(llvm_py): stabilize PHI incoming selection (no overwrite by failed candidate)
2025-12-17 16:12:16 +09:00
61c9d7929c
docs: Phase 100 P2.1 - LLVM EXE parity for mutable accumulator
...
- Update phases/phase-100/README.md with LLVM EXE smoke note
- Update 10-Now.md with P2.1 short report
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-17 06:31:21 +09:00
b45035597d
docs: Phase 100 P2 mutable accumulator contract
...
- Add P2 section to phases/phase-100/README.md
- Document allowed form: s = s + x (x must be read-only)
- List Fail-Fast cases (reversed ops, complex RHS, multiple updates)
- Add example with numeric output
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-17 06:10:26 +09:00
682fc11f7c
docs: Phase 100 P1 pinned receiver integration tests complete
...
- Update docs/development/current/main/phases/phase-100/README.md
* Document P1 implementation and pinned receiver example
- Update docs/development/current/main/10-Now.md
* Add Phase 100 P1 completion short report
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-17 05:43:54 +09:00
692d44da62
docs: Phase 100 rollout plan (Pinned then mutable carrier)
2025-12-17 05:18:09 +09:00
8ab95666c8
docs: Phase 100 pinned read-only captures plan
2025-12-17 05:03:07 +09:00
90a8f1650d
docs: Phase 99 notes and indices
...
Trim/escape実コード寄り強化の記録:
- phase-96: 3ケース追記
- phase-95: 末尾バックスラッシュ扱い追記
- phase-99: 新規README作成
- 10-Now.md: Phase 99短報追加
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-17 04:26:23 +09:00
6d73fc3404
feat(llvm): Phase 97 Box/Policy refactoring complete
...
Box化完了:
- CallRoutePolicyBox: Call routing SSoT
- PrintArgMarshallerBox: Print marshalling SSoT
- TypeFactsBox: Type propagation SSoT
- PhiSnapshotPolicyBox: PHI contract SSoT
- PluginErrorContext: Structured error reporting
📋 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-17 04:14:26 +09:00
1a0d9ce8a0
docs: add Phase 97 LLVM EXE parity entry
2025-12-17 02:26:42 +09:00
bc1a09f2c3
fix(joinir): Phase 96 next_non_ws break condition SSOT
2025-12-17 01:59:21 +09:00
db4453eb3c
test: strengthen phase96 next_non_ws fixture
2025-12-17 01:35:43 +09:00
ba87afd35c
test: add phase96 trim loop fixture and smoke
2025-12-17 01:25:06 +09:00
5b4de7b495
docs: add phase95 json_loader escape entry
2025-12-17 01:01:16 +09:00
7ab459503b
feat(joinir): Phase 94 - P5b escape full E2E (derived ch + +1/+2)
2025-12-17 00:59:33 +09:00
93e62b1433
docs(phase93): Phase 93 P0完了記録 & ドキュメント整理
...
## 追加
- docs/development/current/main/phases/phase-93/README.md
- Phase 93 P0 (ConditionOnly Derived Slot) 完了記録
- 実装内容・テスト結果の詳細
## 更新
- CURRENT_TASK.md: Phase 93 P0完了に伴う更新
- 10-Now.md: 現在の進捗状況更新
- 30-Backlog.md: Phase 92/93関連タスク整理
- phase-91/92関連ドキュメント: historical化・要約化
## 削減
- 735行削減(historical化により詳細をREADMEに集約)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-16 23:30:39 +09:00
d2972c1437
feat(joinir): Phase 92完了 - ConditionalStep + body-local変数サポート
...
## Phase 92全体の成果
**Phase 92 P0-P2**: ConditionalStep JoinIR生成とbody-local変数サポート
- ConditionalStep(条件付きキャリア更新)のJoinIR生成実装
- Body-local変数(ch等)の条件式での参照サポート
- 変数解決優先度: ConditionEnv → LoopBodyLocalEnv
**Phase 92 P3**: BodyLocalPolicyBox + 安全ガード
- BodyLocalPolicyDecision実装(Accept/Reject判定)
- BodyLocalSlot + DualValueRewriter(JoinIR/MIR二重書き込み)
- Fail-Fast契約(Cannot promote LoopBodyLocal検出)
**Phase 92 P4**: E2E固定+回帰最小化 (本コミット)
- Unit test 3本追加(body-local変数解決検証)
- Integration smoke追加(phase92_pattern2_baseline.sh、2ケースPASS)
- P4-E2E-PLAN.md、P4-COMPLETION.md作成
## 主要な実装
### ConditionalStep(条件付きキャリア更新)
- `conditional_step_emitter.rs`: JoinIR Select命令生成
- `loop_with_break_minimal.rs`: ConditionalStep検出と統合
- `loop_with_continue_minimal.rs`: Pattern4対応
### Body-local変数サポート
- `condition_lowerer.rs`: body-local変数解決機能
- `lower_condition_to_joinir`: body_local_env パラメータ追加
- 変数解決優先度実装(ConditionEnv優先)
- Unit test 3本追加: 変数解決/優先度/エラー
- `header_break_lowering.rs`: break条件でbody-local変数参照
- 7ファイルで後方互換ラッパー(lower_condition_to_joinir_no_body_locals)
### Body-local Policy & Safety
- `body_local_policy.rs`: BodyLocalPolicyDecision(Accept/Reject)
- `body_local_slot.rs`: JoinIR/MIR二重書き込み
- `dual_value_rewriter.rs`: ValueId書き換えヘルパー
## テスト体制
### Unit Tests (+3)
- `test_body_local_variable_resolution`: body-local変数解決
- `test_variable_resolution_priority`: 変数解決優先度(ConditionEnv優先)
- `test_undefined_variable_error`: 未定義変数エラー
- 全7テストPASS(cargo test --release condition_lowerer::tests)
### Integration Smoke (+1)
- `phase92_pattern2_baseline.sh`:
- Case A: loop_min_while.hako (Pattern2 baseline)
- Case B: phase92_conditional_step_minimal.hako (条件付きインクリメント)
- 両ケースPASS、integration profileで発見可能
### 退行確認
- ✅ 既存Pattern2Breakテスト正常(退行なし)
- ✅ Phase 135 smoke正常(MIR検証PASS)
## アーキテクチャ設計
### 変数解決メカニズム
```rust
// Priority 1: ConditionEnv (loop params, captured)
if let Some(value_id) = env.get(name) { return Ok(value_id); }
// Priority 2: LoopBodyLocalEnv (body-local like `ch`)
if let Some(body_env) = body_local_env {
if let Some(value_id) = body_env.get(name) { return Ok(value_id); }
}
```
### Fail-Fast契約
- Delta equality check (conditional_step_emitter.rs)
- Variable resolution error messages (ConditionEnv)
- Body-local promotion rejection (BodyLocalPolicyDecision::Reject)
## ドキュメント
- `P4-E2E-PLAN.md`: 3レベルテスト戦略(Level 1-2完了、Level 3延期)
- `P4-COMPLETION.md`: Phase 92完了報告
- `README.md`: Phase 92全体のまとめ
## 将来の拡張(Phase 92スコープ外)
- Body-local promotionシステム拡張
- P5bパターン認識の汎化(flagベース条件サポート)
- 完全なP5b E2Eテスト(body-local promotion実装後)
🎯 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-16 21:37:07 +09:00
568619df89
feat(mir): Phase 92 P2-2 - Body-local variable support for ConditionalStep
...
Phase 92 P2-2完了:ConditionalStepのcondition(ch == '\\'など)でbody-local変数をサポート
## 主要変更
### 1. condition_lowerer.rs拡張
- `lower_condition_to_joinir`に`body_local_env`パラメータ追加
- 変数解決優先度:ConditionEnv → LoopBodyLocalEnv
- すべての再帰ヘルパー(comparison, logical_and, logical_or, not, value_expression)対応
### 2. conditional_step_emitter.rs修正
- `emit_conditional_step_update`に`body_local_env`パラメータ追加
- condition loweringにbody-local環境を渡す
### 3. loop_with_break_minimal.rs修正
- break condition loweringをbody-local init の**後**に移動(line 411)
- header_break_lowering::lower_break_conditionにbody_local_env渡す
- emit_conditional_step_updateにbody_local_env渡す(line 620)
### 4. header_break_lowering.rs修正
- `lower_break_condition`に`body_local_env`パラメータ追加
- scope_managerにbody-local環境を渡す
### 5. 全呼び出し箇所修正
- expr_lowerer.rs (2箇所)
- method_call_lowerer.rs (2箇所)
- loop_with_if_phi_if_sum.rs (3箇所)
- loop_with_continue_minimal.rs (1箇所)
- carrier_update_emitter.rs (1箇所・legacy)
## アーキテクチャ改善
### Break Condition Lowering順序修正
旧: Header → **Break Cond** → Body-local Init
新: Header → **Body-local Init** → Break Cond
理由:break conditionが`ch == '\"'`のようにbody-local変数を参照する場合、body-local initが先に必要
### 変数解決優先度(Phase 92 P2-2)
1. ConditionEnv(ループパラメータ、captured変数)
2. LoopBodyLocalEnv(body-local変数like `ch`)
## テスト
### ビルド
✅ cargo build --release成功(30 warnings、0 errors)
### E2E
⚠️ body-local promotion問題でブロック(Phase 92範囲外)
- Pattern2はbody-local変数をcarrier promotionする必要あり
- 既存パターン(A-3 Trim, A-4 DigitPos)に`ch = get_char(i)`が該当しない
- **Phase 92 P2-2目標(condition loweringでbody-local変数サポート)は達成**
## 次タスク(Phase 92 P3以降)
- body-local variable promotion拡張(Pattern2で`ch`のような変数を扱う)
- P5b E2Eテスト完全動作確認
## Phase 92 P2-2完了
✅ Body-local変数のcondition lowering対応完了
✅ ConditionalStepでbody-local変数参照可能
✅ Break condition lowering順序修正
2025-12-16 17:08:15 +09:00
51017a0f9a
feat(joinir): Phase 92 P0-2 - Skeleton to LoopPatternContext (Option A)
...
SSOT principle: Pass canonicalizer-derived ConditionalStep info to Pattern2 lowerer
without re-detecting from AST.
Changes:
- router.rs: Add skeleton: Option<&'a LoopSkeleton> to LoopPatternContext
- parity_checker.rs: Return (Result, Option<LoopSkeleton>) to reuse skeleton
- routing.rs: Pass skeleton to context when joinir_dev_enabled()
- pattern2_with_break.rs: Detect ConditionalStep in can_lower()
Next: P0-3 implements actual JoinIR generation for ConditionalStep.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-16 15:22:29 +09:00
7e03cb6425
docs(phase-91): Update Phase 91 README with Step 2 completion status
...
### Updates
#### 1. Status Section
- Updated Status to reflect all completed steps (1, 2-A/B/D, 2-E)
- Documented parity verification success
#### 2. Completion Status Section (NEW)
- Added dedicated section for Phase 91 Step 2 completion
- Listed all deliverables with checkmarks
- Documented test results: 1062/1062 PASS
#### 3. Next Steps
- Clarified Phase 92 lowering requirements
- Updated timeline expectations
#### 4. Test Fixture Fix
- Fixed syntax error in test_pattern5b_escape_minimal.hako
(field declarations: changed `console: ConsoleBox` to `console ConsoleBox`)
### Context
Phase 91 Step 2 is now fully complete:
- ✅ AST recognizer (detect_escape_skip_pattern)
- ✅ Canonicalizer integration (UpdateKind::ConditionalStep)
- ✅ Unit tests (test_escape_skip_pattern_recognition)
- ✅ Parity verification (strict mode green)
Ready for Phase 92 lowering implementation.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-16 14:55:40 +09:00
9e3b258046
feat(phase-91): JoinIR Selfhost depth-2 advancement - Pattern P5b design & planning
...
## Overview
Analyzed 34 loops across selfhost codebase to identify JoinIR coverage gaps.
Current readiness: 47% (16/30 loops). Next frontier: Pattern P5b (Escape Handling).
## Current Status
- Phase 91 planning document: Complete
- Loop inventory across 6 key files
- Priority ranking: P5b (escape) > P5 (guard) > P6 (nested)
- Effort estimates and ROI analysis
- Pattern P5b Design: Complete
- Problem statement (variable-step carriers)
- Pattern definition with Skeleton layout
- Recognition algorithm (8-step detection)
- Capability taxonomy (P5b-specific guards)
- Lowering strategy (Phase 92 preview)
- Test fixture: Created
- Minimal escape sequence parser
- JSON string with backslash escape
- Loop Canonicalizer extended
- Capability table updated with P5b entries
- Fail-Fast criteria documented
- Implementation checklist added
## Key Findings
### Loop Readiness Matrix
| Category | Count | JoinIR Status |
|----------|-------|--------------|
| Pattern 1 (simple bounded) | 16 | ✅ Ready |
| Pattern 2 (with break) | 1 | ⚠️ Partial |
| **Pattern P5b (escape seq)** | ~3 | ❌ NEW |
| Pattern P5 (guard-bounded) | ~2 | ❌ Deferred |
| Pattern P6 (nested loops) | ~8 | ❌ Deferred |
### Top Candidates
1. **P5b**: json_loader.hako:30 (8 lines, high reuse)
- Effort: 2-3 days (recognition)
- Impact: Unlocks all escape parsers
2. **P5**: mini_vm_core.hako:541 (204 lines, monolithic)
- Effort: 1-2 weeks
- Impact: Major JSON optimization
3. **P6**: seam_inspector.hako:76 (7+ nesting)
- Effort: 2-3 weeks
- Impact: Demonstrates nested composition
## Phase 91 Strategy
**Recognition-only phase** (no lowering in P1):
- Step 1: Design & planning ✅
- Step 2: Canonicalizer implementation (detect_escape_pattern)
- Step 3: Unit tests + parity verification
- Step 4: Lowering deferred to Phase 92
## Files Added
- docs/development/current/main/phases/phase-91/README.md - Full analysis & planning
- docs/development/current/main/design/pattern-p5b-escape-design.md - Technical design
- tools/selfhost/test_pattern5b_escape_minimal.hako - Test fixture
## Files Modified
- docs/development/current/main/design/loop-canonicalizer.md
- Capability table extended with P5b entries
- Pattern P5b full section added
- Implementation checklist updated
## Acceptance Criteria (Phase 91 Step 1)
- ✅ Loop inventory complete (34 loops across 6 files)
- ✅ Pattern P5b design document ready
- ✅ Test fixture created
- ✅ Capability taxonomy extended
- ⏳ Implementation deferred (Step 2+)
## References
- JoinIR Architecture: joinir-architecture-overview.md
- Phase 91 Plan: phases/phase-91/README.md
- P5b Design: design/pattern-p5b-escape-design.md
Next: Implement detect_escape_pattern() recognition in Phase 91 Step 2
🤖 Generated with Claude Code
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-16 14:22:36 +09:00
26077186aa
docs: Phase 142 P2 Step 3-B design decisions fixed
...
- Pattern5 handles return (not Pattern4) - prevents bloat as parse_*/continue family expands
- ExitMeta expansion NOT needed initially - return ends function, no carrier reconnect needed
- Return payload self-contained within Pattern5 (temporary/direct return, no phi merge)
- ContinueReturn asset reuse: extract consistency checks only (not exit_line machinery)
- Implementation checklist prepared for next session
🤖 Generated with Claude Code
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-16 14:18:42 +09:00
2674e074b6
feat(joinir): Phase 142 P2 Step 3-A - Pattern4 early return fail-fast
2025-12-16 13:48:30 +09:00
42339ca77f
feat(mir): Phase 143 P1 - Add parse_string pattern to canonicalizer
...
Expand loop canonicalizer to recognize parse_string patterns with both
continue (escape handling) and return (quote found) statements.
## Implementation
### New Pattern Detection (ast_feature_extractor.rs)
- Add `detect_parse_string_pattern()` function
- Support nested continue detection using `has_continue_node()` helper
- Recognize both return and continue in same loop body
- Return ParseStringInfo { carrier_name, delta, body_stmts }
- ~120 lines added
### Canonicalizer Integration (canonicalizer.rs)
- Try parse_string pattern first (most specific)
- Build LoopSkeleton with HeaderCond, Body, Update steps
- Set ExitContract: has_continue=true, has_return=true
- Route to Pattern4Continue (both exits present)
- ~45 lines modified
### Export Chain
- Add re-exports through 7 module levels:
ast_feature_extractor → patterns → joinir → control_flow → builder → mir
- 10 lines total across 7 files
### Unit Test
- Add `test_parse_string_pattern_recognized()` in canonicalizer.rs
- Verify skeleton structure (3+ steps)
- Verify carrier (name="p", delta=1, role=Counter)
- Verify exit contract (continue=true, return=true, break=false)
- Verify routing decision (Pattern4Continue, no missing_caps)
- ~180 lines added
## Target Pattern
`tools/selfhost/test_pattern4_parse_string.hako`
Pattern structure:
- Check for closing quote → return
- Check for escape sequence → continue (nested inside another if)
- Regular character processing → p++
## Results
- ✅ Strict parity green: Pattern4Continue
- ✅ All 19 unit tests pass
- ✅ Nested continue detection working
- ✅ ExitContract correctly set (first pattern with both continue+return)
- ✅ Default behavior unchanged
## Technical Challenges
1. Nested continue detection required recursive search
2. First pattern with both has_continue=true AND has_return=true
3. Variable step updates (p++ vs p+=2) handled with base delta
## Statistics
- New patterns: 1 (parse_string)
- Total patterns: 4 (skip_whitespace, parse_number, continue, parse_string)
- New capabilities: 0 (uses existing ConstStep)
- Lines added: ~300
- Files modified: 9
- Parity status: Green ✅
Phase 143 P1: Complete
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-16 12:37:47 +09:00
d605611a16
feat(canonicalizer): Phase 143-P0 - parse_number pattern support
...
Add parse_number pattern recognition to canonicalizer, expanding adaptation
range for digit collection loops with break in THEN clause.
## Changes
### New Recognizer (ast_feature_extractor.rs)
- `detect_parse_number_pattern()`: Detects `if invalid { break }` pattern
- `ParseNumberInfo`: Struct for extracted pattern info
- ~150 lines added
### Canonicalizer Integration (canonicalizer.rs)
- Parse_number pattern detection before skip_whitespace
- LoopSkeleton construction with 4 steps (Header + Body x2 + Update)
- Routes to Pattern2Break (has_break=true)
- ~60 lines modified
### Export Chain (6 files)
- patterns/mod.rs → joinir/mod.rs → control_flow/mod.rs
- builder.rs → mir/mod.rs
- 8 lines total
### Tests
- `test_parse_number_pattern_recognized()`: Unit test for recognition
- Strict parity verification: GREEN (canonical and router agree)
- ~130 lines added
## Pattern Comparison
| Aspect | Skip Whitespace | Parse Number |
|--------|----------------|--------------|
| Break location | ELSE clause | THEN clause |
| Pattern | `if cond { update } else { break }` | `if invalid { break } rest... update` |
| Body after if | None | Required (result append) |
## Results
- ✅ Skeleton creation successful
- ✅ RoutingDecision matches router (Pattern2Break)
- ✅ Strict parity OK (canonicalizer ↔ router agreement)
- ✅ Unit test PASS
- ✅ Manual test: test_pattern2_parse_number.hako executes correctly
## Statistics
- New patterns: 1 (parse_number)
- Total patterns: 3 (skip_whitespace, parse_number, continue)
- Lines added: ~280
- Files modified: 8
- Parity status: Green ✅
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-16 09:08:37 +09:00
521e58d061
docs: mark loop canonicalizer Phase 137-141 complete
2025-12-16 07:54:33 +09:00
632e495e51
docs(mir): Phase 137-6-S3 - Router委譲の準備コメント追加
...
## 目的
将来の Router → Canonicalizer 委譲に備えた TODO コメント拡充
## 変更内容
### routing.rs の TODO コメント拡充
- 有効化条件を明記(新フラグ or 既存フラグ)
- 注意事項追加(全 Pattern の parity green 必須)
- コード例を追加(将来実装時の参考)
### Phase 137 README 更新
- Phase 137-6(完了)セクション追加
- S1/S2/S3 の実装内容を記録
- 効果と受け入れ基準達成を記録
## 効果
- ✅ 将来の委譲に備えた明確なガイド
- ✅ Phase 137-6 完了記録
- ✅ 既定挙動不変(フラグOFF時)
## Phase 137-6 完了サマリー
### 実装完了内容
- **S1**: choose_pattern_kind SSOT 入口(61行追加)
- **S2**: dev-only parity check 統合(52行追加)
- **S3**: Router 委譲準備コメント(ドキュメント拡充)
### 受け入れ基準
- ✅ strict parity green(skip_whitespace)
- ✅ 既定挙動不変(フラグOFF時)
- ✅ 新 env 追加なし
- ✅ choose_pattern_kind が SSOT 入口として機能
- ✅ 全テスト PASS(退行なし)
### テスト結果
- ✅ `cargo build --release`: 成功
- ✅ スモークテスト(simple_*): 5/5 PASS
- ✅ parity check 動作確認:
```
NYASH_JOINIR_DEV=1 HAKO_JOINIR_STRICT=1 ./target/release/hakorune \
tools/selfhost/test_pattern3_skip_whitespace.hako
→ [choose_pattern_kind/PARITY] OK
```
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-16 07:44:57 +09:00
3026251323
docs(mir): Phase 141-P7-C - Phase 138-141 完了記録
...
## 変更内容
### 追加セクション
- Phase 138(完了): 基盤整備
- Phase 139(完了): 型安全化
- Phase 140(完了): 共通化と統合
- Phase 141(完了): ドキュメント & Cleanup
### 最終成果サマリー
- **コード品質メトリクス表**: 5 つの指標で改善率を明示
- 最大ファイルサイズ: 931行 → 414行(-55%)
- モジュール数: 1個 → 4個(+300%)
- 重複コード: 100行 → 29行(-71%)
- 型安全性: string → enum(✅ )
- 環境変数: 直呼び出し → SSOT(✅ )
- **アーキテクチャ改善リスト**: 5 つの達成項目
- 単一責任の原則
- Capability Guard 型安全化
- Pattern Detection SSOT 化
- Context 統合
- ドキュメント充実
## 効果
- Phase 137-141 の成果を一覧可能
- メトリクスで定量的な改善を可視化
- 次 Phase 着手時の基準点として活用可能
Status: Phase 138-141 完全完了 ✅
2025-12-16 07:24:51 +09:00