11e68203c8
feat(joinir): Phase 76 - promoted_bindings map (dev-only)
...
Phase 76 introduces type-safe promotion tracking via promoted_bindings
(BindingId→BindingId map). Replaces fragile string matching hacks with
compiler-checked identity mapping.
Changes:
- carrier_info.rs: Added promoted_bindings field and resolution methods
- pattern4_carrier_analyzer.rs: Updated for BindingId integration
- pattern_pipeline.rs: Carrier resolution via promoted_bindings
- loop_with_break_minimal/tests.rs: Added promoted_bindings tests
- normalized/fixtures.rs: Extended with Phase 76 fixtures
Tests: 5/5 new unit tests PASS (record/resolve/merge/default/overwrite)
Tests: lib 958/958 PASS, normalized_dev 54/54 PASS (no regressions)
Design: Dual-path (BindingId OR name) enables gradual Phase 77+ transition.
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-13 05:35:14 +09:00
c18dde238a
feat(joinir): Phase 75 - BindingId pilot lookup (dev-only)
...
Phase 75 pilots BindingId-based variable lookup in the ScopeManager and
ConditionEnv components. Demonstrates "BindingId priority → name fallback"
strategy with comprehensive testing and zero production impact.
Changes:
- scope_manager.rs: Added lookup_with_binding() trait method
- condition_env.rs: Implemented resolve_var_with_binding() with 3-tier fallback
- expr_lowerer.rs: Integrated pilot lookup paths
- condition_lowering_box.rs: Updated with BindingId support
Tests: 3/3 new pilot tests PASS (priority/fallback/legacy)
Tests: lib 958/958 PASS, normalized_dev 54/54 PASS (no regressions)
Design: Feature-gated with normalized_dev, enables Phase 76 expansion.
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-13 05:35:04 +09:00
e1574af741
feat(mir): Phase 74 - BindingId infrastructure (dev-only)
...
Phase 74 implements BindingId as parallel allocation alongside ValueId for
lexical scope tracking and shadowing-aware variable identity.
Changes:
- binding_id.rs: New BindingId type with overflow protection (5 unit tests)
- builder.rs: Added next_binding_id counter and binding_map (4 integration tests)
- lexical_scope.rs: Extended restoration logic for BindingId management
- mod.rs: Public re-export of BindingId
Tests: 9/9 new PASS, lib 958/958 PASS (no regressions)
Architecture: Parallel BindingId/ValueId allocation for deterministic shadowing
Phase 75-77 will build on this infrastructure for type-safe promotion tracking.
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-13 05:34:56 +09:00
851bf4f8a5
design(joinir): Phase 73 - ScopeManager BindingId Migration Design + PoC
...
Phase 73 plans migration from name-based to BindingId-based scope management
in JoinIR lowering, aligning with MIR's lexical scope model.
Design decision: Option A (Parallel BindingId Layer) with gradual migration.
Migration roadmap: Phases 74-77, ~8-12 hours total, zero production impact.
Changes:
- phase73-scope-manager-design.md: SSOT design (~700 lines)
- phase73-completion-summary.md: Deliverables summary
- phase73-index.md: Navigation index
- scope_manager_bindingid_poc/: Working PoC (437 lines, dev-only)
Tests: 6/6 PoC tests PASS, lib 950/950 PASS
Implementation: Parallel layer (no changes to existing code paths)
🤖 Generated with Claude Code
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-13 03:41:40 +09:00
c2df1cacf6
feat(joinir): Phase 70-B - Multihop Relay Passthrough Support (dev-only)
...
Phase 70-B relaxes runtime guard from "always error" to "unsupported only".
Adds structural detection (is_supported_multihop_pattern) to distinguish:
- Simple passthrough (no self-updates): ACCEPT
- Complex patterns (self-conflict, etc): REJECT with [ownership/relay:runtime_unsupported]
Changes:
- plan_validator.rs: +is_supported_multihop_pattern() method + unit tests
- normalized_joinir_min.rs: +2 integration tests for passthrough/rejection
- phase70-relay-runtime-guard.md: Phase 70 series status table added
Tests: normalized_dev 52/52 PASS, lib 950/950 PASS
Design: Structural detection only (no by-name branching)
🤖 Generated with Claude Code
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-13 03:41:20 +09:00
db9c9055fa
obs(joinir): Phase 72 - PHI Reserved Region Observation Complete
...
## Summary
Observed PHI dst ValueId distribution to determine if verifier can enforce
reserved region (0-99). **Conclusion: Verifier strengthening NOT recommended.**
## Key Finding
PHI dst allocation does NOT architecturally respect reserved region:
- PHI dst comes from `builder.next_value_id()` (host MirBuilder)
- Reserved region (0-99) is a JoinValueSpace contract for JoinIR lowering
- These are separate allocation pools with no enforcement mechanism
- Current stability is accidental (ValueId allocation ordering)
## Evidence
Manual verification (`apps/tests/loop_min_while.hako`):
- PHI dst = %3 (ValueId(3)) ✅ in reserved region
- Works because PHI allocated early in function (0-20 typical)
- JoinValueSpace allocates high (100+, 1000+)
- Accidental separation, not enforced
## Implementation
Added observation infrastructure (debug-only):
- `src/mir/join_ir/verify_phi_reserved.rs` (266 lines)
- PHI dst observer with distribution analyzer
- Region classifier (Reserved/Param/Local)
- Human-readable report generator
- Instrumentation at PHI allocation points:
- loop_header_phi_builder.rs:94, 151
- Debug-only `observe_phi_dst()` calls
## Test Results
- Unit tests: ✅ 4/4 PASS (verify_phi_reserved module)
- Lib tests: ✅ 950/950 PASS, 56 ignored
- Normalized tests: ✅ 54/54 PASS
- Manual verification: ✅ PHI dst in 0-99 observed
## Decision: Document, Don't Enforce
**Rationale**:
1. No architectural mechanism to enforce PHI dst ∈ [0, 99]
2. Adding verifier creates false assumptions about allocation order
3. Current system stable through separate pools (950/950 tests)
4. Future architectural fix possible (Phase 73+) but not urgent
## Documentation
- PHASE_72_SUMMARY.md: Executive summary and implementation record
- phase72-phi-reserved-observation.md: Detailed findings and analysis
- CURRENT_TASK.md: Phase 72 completion entry
## Next Steps
- Phase 73: Update architecture overview with Phase 72 findings
- Optional: Explicit PHI reserved pool (future enhancement)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-13 03:23:02 +09:00
1424aac901
refactor(joinir): Phase 71-Pre - OwnershipPlanValidator Box (dev-only)
...
pattern3_with_if_phi.rs の check_ownership_plan_consistency() を独立した
OwnershipPlanValidator Box に抽出。P2/P4 での再利用を可能にする。
Key changes:
- plan_validator.rs: 新規作成 (~190行)
- validate_relay_support(): Multi-hop relay Fail-Fast (Phase 70-A タグ)
- validate_carrier_consistency(): Carrier set 整合性チェック (warn-only)
- validate_condition_captures(): Condition captures チェック (warn-only)
- validate_all(): All-in-one 検証
- pattern3_with_if_phi.rs: Validator box への委譲
- check_ownership_plan_consistency() → OwnershipPlanValidator::validate_all()
Unit tests: 3 PASS
- test_validate_relay_support_single_hop_ok
- test_validate_relay_support_multihop_rejected
- test_validate_all_with_consistent_data
Tests: normalized_dev 50/50 PASS, lib 950/950 PASS
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-13 02:30:12 +09:00
7b56a7c01d
docs(joinir): Phase 70-A - Relay Runtime Guard (dev-only)
...
Phase 66で analysis/plan層はmultihop受理可能になったが、runtime lowering
(実行導線)はまだ未対応。このPhaseでは「未対応は同じタグで必ず落ちる」を
docs + テストで固定する。
Key changes:
- phase70-relay-runtime-guard.md: Runtime guard設計doc新規追加
- 現状(plan OK / runtime NG)の明確化
- Fail-Fastタグ [ownership/relay:runtime_unsupported] の標準化
- Phase 70-B以降の解除条件
- pattern3_with_if_phi.rs: エラーメッセージのタグ統一
- [ownership/relay:runtime_unsupported] 形式に変更
- var/owner_scope/relay_path の診断情報追加
- normalized_joinir_min.rs: 固定テスト追加
- test_phase70a_multihop_relay_runtime_unsupported_tag
- Plan層のmultihop受理確認 + runtime拒否の文書化
Tests: normalized_dev 50/50 PASS (+1), lib 950/950 PASS
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-13 02:22:29 +09:00
795d68ecf1
joinir(ownership): shadowing-aware AST ownership analyzer
2025-12-13 02:04:04 +09:00
0913ee8bbc
MIR: fix free-vars lexical scoping
2025-12-13 01:35:39 +09:00
1fae4f1648
MIR: lexical scoping + builder vars modules
2025-12-13 01:30:04 +09:00
5c75506dcc
feat(joinir): Phase 66 - Ownership-Relay Multihop Implementation (dev-only)
...
Phase 65設計に基づき、relay_path.len() > 1 を analysis/plan 層で受理するよう実装。
Key changes:
- plan_to_lowering.rs: relay_path.len() > 1 制限撤去 + 構造的 Fail-Fast 維持
- relay_path.is_empty() → Err(loop relay は最低 1 hop)
- relay_path[0] != plan.scope_id → Err(この scope が最初の hop)
- relay.owner_scope == plan.scope_id → Err(relay と owned は排他)
- owned_vars ∩ relay_writes ≠ ∅ → Err(同名は不変条件違反)
- ast_analyzer.rs: 3階層 multihop テスト追加
- multihop_relay_detected_for_3_layer_nested_loops
Unit tests (plan_to_lowering):
- test_relay_multi_hop_accepted_in_with_relay
- test_relay_path_empty_rejected_in_with_relay
- test_relay_path_not_starting_at_plan_scope_rejected
- test_relay_owner_same_as_plan_scope_rejected
- test_owned_and_relay_same_name_rejected
Tests: normalized_dev 49/49 PASS, lib 947/947 PASS
Design: Analysis-only, no behavior change in production lowering
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-12 23:33:16 +09:00
ba6e420f31
feat(joinir): Phase 64 - Ownership P3 production integration (dev-only)
...
P3(if-sum) 本番ルートに OwnershipPlan 解析を接続(analysis-only)。
Key changes:
- ast_analyzer.rs: Added analyze_loop() helper
- Loop-specific analysis API for production integration
- build_plan_for_scope() helper for single-scope extraction
- pattern3_with_if_phi.rs: P3 production integration
- OwnershipPlan analysis after ConditionEnv building
- check_ownership_plan_consistency() for validation
- Feature-gated #[cfg(feature = "normalized_dev")]
Consistency checks:
- Fail-Fast: Multi-hop relay (relay_path.len() > 1)
- Warn-only: Carrier set mismatch (order SSOT deferred)
- Warn-only: Condition captures (some patterns have extras)
Tests: 49/49 PASS (2 new Phase 64 tests)
- test_phase64_p3_ownership_prod_integration
- test_phase64_p3_multihop_relay_detection
- Zero regressions
Design: Analysis-only, no behavior change
- Integration point: After ConditionEnv, before JoinIR lowering
- Dev-only validation for future SSOT migration
Next: Phase 65+ - Carrier order SSOT, owner-based init
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-12 23:02:40 +09:00
0ff96612cf
docs(joinir): Phase 63 - AST ownership analyzer (dev-only)
...
ASTNode → OwnershipPlan の解析器を追加(analysis-only, normalized_dev)。
Key changes:
- New ast_analyzer.rs (~370 lines):
- AstOwnershipAnalyzer: AST → Vec<OwnershipPlan>
- ScopeKind: Function/Loop/If/Block
- Invariants: owned_vars/relay_writes/captures/condition_captures
Design:
- JSON v0 "Local=rebind" を使わず、AST の Statement::Local を正しく扱う
- "読むのは自由、管理は直下だけ" アーキテクチャ維持
Tests: 3 unit tests + 47/47 normalized_dev PASS
- loop_local_carrier_is_owned_and_written
- condition_capture_is_reported_for_loop
- relay_write_detected_for_outer_owned_var
Next: Phase 64 - P3(if-sum) 本番ルートへ dev-only で接続
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-12 22:51:21 +09:00
acb6720d9b
Phase 61: structural if-sum+break lowering (dev-only)
2025-12-12 22:15:41 +09:00
6aba138950
feat(joinir): Phase 59 - Ownership P3 plumbing (dev-only)
...
P3 (if-sum) パターン用の OwnershipPlan → lowering inputs 変換を追加。
Key changes:
- plan_to_lowering.rs (+153 lines):
- P3LoweringInputs struct (same structure as P2)
- plan_to_p3_inputs() converter
- 4 unit tests (multi-carrier, 5+, condition-only, relay-rejected)
P3 specific features:
- Multi-carrier support (sum, count, 5+ carriers)
- Same Fail-Fast on relay_writes (Phase 59 scope)
- Same CarrierRole discrimination (LoopState vs ConditionOnly)
Integration tests:
- test_phase59_ownership_p3_relay_failfast: Verifies relay detection
- test_phase59_ownership_p3_loop_local_success: Verifies loop-local success
Design: Perfect parallelism with P2
- Same struct layout (carriers, captures, condition_captures)
- Same conversion logic (skip loop var, filter written vars)
- Same error handling (Fail-Fast on relay)
Tests: 946/946 PASS (16 ownership tests)
All code under #[cfg(feature = "normalized_dev")] - zero impact on canonical.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-12 18:45:08 +09:00
fcf85313e5
feat(joinir): Phase 58 - Ownership P2 plumbing (dev-only)
...
OwnershipPlan → P2 lowering inputs 変換の dev 経路を追加。
Key changes:
- New plan_to_lowering.rs (~210 lines):
- P2LoweringInputs struct (carriers/captures/condition_captures)
- plan_to_p2_inputs() converter
- Fail-Fast on relay_writes (Phase 58 scope limitation)
Conversion rules:
- owned_vars where is_written=true → carriers
- Loop variable skipped (pinned, handled separately)
- is_condition_only=true → CarrierRole::ConditionOnly
- Read-only captures preserved
Entry point strategy:
- Analysis-only testing (no lowering path modification yet)
- Proves OwnershipAnalyzer can analyze P2 fixtures
- Full integration deferred to Phase 60+
Tests: 946/946 PASS (7 ownership tests)
- test_simple_p2_conversion
- test_relay_rejected (Fail-Fast verification)
- test_phase58_ownership_p2_comparison
All code under #[cfg(feature = "normalized_dev")] - zero impact on canonical path.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-12 18:08:00 +09:00
c722dc3bf6
feat(joinir): Phase 57 - OwnershipAnalyzer implementation (dev-only)
...
AST/ProgramJSON から OwnershipPlan を生成する解析箱を実装。
Key changes:
- New analyzer.rs (632 lines):
- OwnershipAnalyzer: Main analysis engine
- ScopeKind: Function/Loop/Block/If scope types
- ScopeInfo: Internal scope representation with reads/writes tracking
Algorithm:
1. Build scope tree (Function/Loop/Block/If hierarchy)
2. Collect reads/writes/condition_reads per scope
3. Apply body-local ownership rule (if/block locals → enclosing Loop/Function)
4. Generate OwnershipPlan: owned_vars, relay_writes, captures, condition_captures
Core invariants enforced:
- Ownership Uniqueness: Each variable has exactly one owner
- Carrier Locality: carriers = writes ∩ owned
- Relay Propagation: writes to ancestor-owned → relay up
- Capture Read-Only: captures have no PHI at this scope
Tests: 7 ownership unit tests + 946 existing (0 regressions)
- test_simple_loop_ownership: relay writes to function
- test_loop_local_carrier: owned AND written = carrier
- test_capture_read_only: read-only captures
- test_nested_loop_relay: relay chains through nested loops
Design: "読むのは自由、管理は直下だけ"
Phase 57 is dev-only - not yet connected to lowering.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-12 17:51:53 +09:00
2d10c5ce3f
docs(joinir): Phase 56 - Ownership-Relay Design + interface skeleton
...
「読むのは自由、管理は直下 owned だけ」アーキテクチャの設計文書と型定義。
Key changes:
- Design doc: phase56-ownership-relay-design.md
- Core definitions: owned/carriers/captures/relay
- Invariants: Ownership Uniqueness, Carrier Locality, Relay Propagation
- Shadowing rules, multi-writer merge semantics
- JoinIR mapping from current system to new system
- Implementation phases roadmap (56-61)
- New module: src/mir/join_ir/ownership/
- types.rs: ScopeId, ScopeOwnedVar, RelayVar, CapturedVar, OwnershipPlan
- mod.rs: Module documentation with responsibility boundaries
- README.md: Usage guide and examples
- API methods:
- OwnershipPlan::carriers() - owned AND written variables
- OwnershipPlan::condition_only_carriers() - condition-only carriers
- OwnershipPlan::verify_invariants() - invariant checking
Tests: 942/942 PASS (+3 unit tests)
Zero behavioral change - analysis module skeleton only.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-12 17:39:59 +09:00
80e952b83a
feat(joinir): Phase 54 SELFHOST-SHAPE-GROWTH - 構造軸育成 + 偽陽性観測
...
Phase 53 成果を踏まえ、構造シグネチャ軸を 5+ に育て、
偽陽性観測テストで name ガード縮小準備を整えた。
方針変更: 新ループ追加 → 構造軸育成 + 偽陽性率測定に焦点変更
- 理由: Phase 53 で selfhost P2/P3 実戦パターン追加済み
- 焦点: 既存ループに対する構造軸拡張 + 精度測定
主な成果:
1. 構造軸 5+ 達成:
- carrier 数
- carrier 型
- Compare パターン
- branch 構造
- NEW: Compare op 分布 (count_compare_ops ヘルパー)
2. 偽陽性観測テスト追加:
- test_phase54_structural_axis_discrimination_p2()
- test_phase54_structural_axis_discrimination_p3()
3. 重要な発見 - 偽陽性率 ~50%:
- P2: selfhost P2 が正しく検出されず (name ガード依存)
- P3: selfhost P3 が Pattern4ContinueMinimal と誤検出 (構造的類似性)
- 結論: 構造判定のみでは分離不十分、name ガード必須と判明
変更内容:
- shape_guard.rs (+80 lines):
- count_compare_ops() 構造軸ヘルパー追加
- detect_shapes() pub 化 (テストから呼び出し可能に)
- SelfhostVerifySchemaP2/SelfhostDetectFormatP3 enum 追加 (将来用)
- normalized_joinir_min.rs (+110 lines):
- 偽陽性観測テスト 2 個追加 (P2/P3 各1)
- canonical shapes vs selfhost shapes 構造判定精度測定
- phase49 doc (+200 lines):
- Phase 54 節完成版
- 偽陽性分析結果記録
- name ガード縮小方針明記
- enum 拡張対応:
- bridge.rs (+8 lines)
- normalized.rs (+8 lines)
- ast_lowerer/mod.rs (+2 lines)
偽陽性観測結果 (2025-12-12):
- P2 構造判定: selfhost P2 検出失敗 → name ガード必須
- P3 構造判定: selfhost P3 が Pattern4 と誤判定 → 構造的類似性問題
- 総合: 偽陽性率 ~50% → 構造軸 5 本では不十分
次フェーズ方針 (Phase 55+):
- Phase 55-A: 条件複雑度軸追加 (BinOp/UnaryOp ネスト深度)
- Phase 55-B: 算術パターン軸追加 (Mul/Sub/Div 出現パターン)
- Phase 56: selfhost 実戦ループ追加 (6 本以上蓄積)
- Phase 57: 誤判定率 < 5% 達成後に name ガード縮小開始
name ガード撤去条件 (Phase 57):
- 構造軸 8+ 本確立
- selfhost P2/P3 各 6 本以上蓄積
- 誤判定率 < 5% 達成
- 複合的特徴量ベース判定実装
回帰テスト: ✅ 939 PASS, 0 FAIL (既存挙動不変)
Files Modified: 8 files
Lines Added: ~408 lines (net)
Implementation: Pure additive (feature-gated)
Phase 54 完了!構造軸育成・偽陽性観測基盤確立!
2025-12-12 17:12:58 +09:00
7b0db59100
feat(joinir): Phase 53 - SELFHOST-NORM-DEV-EXPAND implementation
...
Expanded selfhost dev Normalized target with 2 practical P2/P3 loop variations,
strengthened structural signature axis, and implemented two-stage detection.
Key Changes:
1. Documentation (phase49-selfhost-joinir-depth2-design.md +128 lines):
- Added Phase 53 section with candidate selection rationale
- Documented two-stage detector strategy (structural primary + dev-only name guard)
- Defined structural axis strengthening (carrier count/type, branch patterns)
2. Fixtures (+210 lines):
- selfhost_args_parse_p2.program.json (60 lines): P2 with String carrier + conditional branching
- selfhost_stmt_count_p3.program.json (150 lines): P3 with 5 carriers + multi-branch if-else
3. Structured Builders (fixtures.rs +48 lines):
- build_selfhost_args_parse_p2_structured_for_normalized_dev()
- build_selfhost_stmt_count_p3_structured_for_normalized_dev()
4. ShapeGuard Two-Stage Detection (shape_guard.rs +80 lines):
- Added SelfhostArgsParseP2/SelfhostStmtCountP3 to NormalizedDevShape enum
- Implemented is_selfhost_args_parse_p2(): P2 core family + name guard
- Implemented is_selfhost_stmt_count_p3(): 2-10 carrier check + name guard
- Updated capability_for_shape() mappings
5. Bridge Integration (bridge.rs +8 lines, normalized.rs +10 lines):
- Added shape handlers delegating to existing normalizers
- Added roundtrip reconstruction handlers
6. Entry Point Registration (ast_lowerer/mod.rs +2 lines):
- Registered selfhost_args_parse_p2/selfhost_stmt_count_p3 as LoopFrontend routes
7. Dev VM Comparison Tests (normalized_joinir_min.rs +40 lines):
- normalized_selfhost_args_parse_p2_vm_bridge_direct_matches_structured()
- normalized_selfhost_stmt_count_p3_vm_bridge_direct_matches_structured()
8. Test Context Fix (dev_env.rs):
- Added thread-local test context depth counter
- Fixed deadlock in nested test_ctx() calls via reentrant with_dev_env_if_unset()
Structural Axis Growth:
P2 family:
- Carrier count: 1-3 (unchanged)
- NEW: Type diversity (Integer/String mixed)
- NEW: Conditional branching patterns (Eq-heavy comparisons)
P3 family:
- NEW: Carrier count upper bound: 2-10 (was 2-4)
- NEW: Multi-branch if-else (5+ branches with nested structure)
- NEW: Complex conditional patterns
Test Results:
- normalized_dev: 40/40 PASS (including 2 new tests)
- lib regression: 939 PASS, 56 ignored
- Existing behavior unchanged (normalized_dev feature-gated)
Phase 53 Achievements:
✅ P2/P3 each gained 1 practical variation (2 total)
✅ Two-stage detection: structural primary + dev-only name guard
✅ Structural axis expanded: 4 axes (carrier count/type/Compare/branch patterns)
✅ All tests PASS, no regressions
✅ Test context deadlock fixed (0.04s for 29 tests)
Files Modified: 14 files
Lines Added: ~516 lines (net)
Implementation: Pure additive (feature-gated)
Next Phase (54+):
- Accumulate 6+ loops per P2/P3 family
- Achieve 5+ stable structural axes
- Target < 5% false positive rate
- Then shrink/remove name guard scope
2025-12-12 16:40:20 +09:00
386cbc1915
Phase47-B/C: extend P3 normalized shapes and quiet dev warnings
2025-12-12 07:13:34 +09:00
7200309cc3
feat(joinir): Phase 48-A - P4 (continue) Normalized minimal implementation
...
Pattern4 (continue) integration into Normalized JoinIR pipeline complete.
Key changes:
- P4 minimal fixture: skip i==2 pattern, single carrier (acc)
- ShapeGuard: Pattern4ContinueMinimal detector (structure-based)
- StepScheduleBox: ContinueCheck step (eval order: HeaderCond → ContinueCheck → Updates → Tail)
- normalize_pattern4_continue_minimal(): Delegates to P2 (95% infrastructure reuse)
- Tests: 4 integration tests (normalization/runner/VM Bridge comparison×2)
Design validation:
- P4 (continue) = reverse control flow of P2 (break)
- Same loop_step(env, k_exit) skeleton
- Same EnvLayout/ConditionEnv/CarrierInfo infrastructure
- Only difference: evaluation order and control flow direction
Architecture proof:
- Normalized JoinIR successfully handles P1/P2/P3/P4 uniformly
- Infrastructure reuse rate: 95%+ as designed
Tests: 939/939 PASS (+1 from baseline 938, target exceeded!)
Files modified: 10 files (~305 lines added, pure additive)
- pattern4_continue_min.program.json (NEW +126 lines) - P4 fixture
- fixtures.rs (+31 lines) - P4 fixture loader
- shape_guard.rs (+60 lines) - Shape detection
- step_schedule.rs (+18 lines) - Schedule + test
- normalized.rs (+35 lines) - Normalization function
- loop_with_break_minimal.rs (+4 lines) - ContinueCheck handler
- bridge.rs (+5 lines) - VM bridge routing
- ast_lowerer/mod.rs (+2 lines) - Function registration
- normalized_joinir_min.rs (+84 lines) - Integration tests
- CURRENT_TASK.md (+13 lines) - Phase 48-A completion
Next steps:
- Phase 48-B: Extended P4 (multi-carrier, complex continue)
- Phase 48-C: Canonical promotion (always use Normalized for P4)
2025-12-12 06:31:13 +09:00
99bdf93dfe
feat(joinir): Phase 47-A-LOWERING - P3 Normalized→MIR(direct)
...
Implement full Pattern3 (if-sum) Normalized→MIR(direct) support, completing
the P3 minimal implementation.
Key changes:
1. P3 Shape Detection (shape_guard.rs):
- Implemented is_pattern3_if_sum_minimal() with structure-based detection
- Detects P3 characteristics:
- Has Compare instruction (loop condition)
- Has Select instruction (conditional carrier update)
- Has tail call (Call with k_next: None)
- Reasonable param count (2-4 for i, sum carriers)
- Handles both JoinInst::Select and Compute(MirLikeInst::Select)
- Added unit test: test_detect_pattern3_if_sum_minimal_shape ✅
2. P3 Normalization Function (normalized.rs):
- Implemented normalize_pattern3_if_sum_minimal()
- Guards: Validates Structured JoinIR + P3 shape detection
- Phase 47-A minimal: Delegates to P2 normalization (works for simple cases)
- Updated normalized_dev_roundtrip_structured() integration
- Returns Result<NormalizedModule, String> for proper error handling
3. Bridge Integration (bridge.rs):
- Updated normalize_for_shape() to call P3 normalization
- No changes needed to direct.rs (already handles P3 instructions)
4. Integration Tests (normalized_joinir_min.rs):
- Added test_phase47a_pattern3_if_sum_minimal_normalization
- Tests Structured→Normalized transformation
- Verifies shape detection + normalization succeeds
- Validates function count and phase correctness
- Added test_phase47a_pattern3_if_sum_minimal_runner
- Basic smoke test for P3 fixture validity
- Verifies 3-function structure and entry point
Benefits:
- P3 now uses Normalized→MIR(direct) pipeline (same as P1/P2)
- Structure-based detection (no name-based heuristics)
- Minimal implementation (delegates to P2 for simplicity)
- Pure additive (no P1/P2 behavioral changes)
Tests: 938/938 PASS (lib), shape_guard P3 test PASS
- test_detect_pattern3_if_sum_minimal_shape ✅
- test_phase47a_pattern3_if_sum_minimal_normalization ✅
- test_phase47a_pattern3_if_sum_minimal_runner ✅
Next phase: Phase 47-B (proper P3-specific normalization, array_filter, multi-carrier)
Design note: This minimal implementation reuses P2 normalization for simplicity.
Proper P3-specific normalization (IfCond, ThenUpdates, ElseUpdates step sequence)
will be implemented in Phase 47-B when needed for more complex P3 patterns.
2025-12-12 05:53:23 +09:00
c3a26e705e
feat(joinir): Phase 47-A-IMPL - P3 Normalized infrastructure
...
Implement Pattern3 (if-sum) Normalized infrastructure, extending existing P2
StepSchedule and ShapeGuard systems.
Key changes:
1. StepSchedule generalization (P2 → P2/P3):
- Renamed: pattern2_step_schedule.rs → step_schedule.rs
- Extended StepKind enum with P3 variants:
- IfCond (if condition in body)
- ThenUpdates (carrier updates in then branch)
- ElseUpdates (carrier updates in else branch)
- Added pattern3_if_sum_schedule() function
- Added unit test: test_pattern3_if_sum_schedule()
- Updated module references (mod.rs, loop_with_break_minimal.rs)
2. ShapeGuard extension:
- Added Pattern3IfSumMinimal variant to NormalizedDevShape
- Added is_pattern3_if_sum_minimal() detector (placeholder)
- Updated shape detector table
- Extended capability_for_shape() mapping
3. Bridge integration:
- bridge.rs: Added P3 shape handling in normalize_for_shape()
- normalized.rs: Added P3 roundtrip match (uses P2 temporarily)
4. P2/P3 separation:
- loop_with_break_minimal.rs: Added panic for P3 steps in P2 lowering
- Clear boundary enforcement (P2 lowerer rejects P3 steps)
5. Documentation:
- CURRENT_TASK.md: Phase 47-A-IMPL status
- phase47-norm-p3-design.md: Implementation status section
Benefits:
- Reuses 90% of P2 infrastructure (ConditionEnv, CarrierInfo, ExitLine)
- Clean P2/P3 separation via StepKind
- Pure additive changes (no P2 behavioral changes)
- Ready for Phase 47-A-LOWERING (full P3 Normalized implementation)
Tests: 938/938 PASS (+1 from step_schedule unit test)
- All existing P1/P2 tests pass (no regressions)
- P3 test uses Structured path temporarily (proper lowering in next phase)
Next phase: Implement full P3 Normalized→MIR(direct) lowering
2025-12-12 05:23:18 +09:00
42ecd7a7e7
feat(joinir): Phase 47-A prep - P3 fixture and test stub
...
Preparation for Phase 47-A (P3 Normalized minimal implementation).
Added fixture and test stub for pattern3_if_sum_minimal.
Changes:
- fixtures.rs: Added pattern3_if_sum_minimal fixture
- Source: phase212_if_sum_min.hako
- Pattern: Single carrier (sum), simple condition (i > 0)
- Dev-only fixture for P3 Normalized development
- normalized_joinir_min.rs: Added test stub
- test_normalized_pattern3_if_sum_minimal_runner
- Currently returns early (implementation pending)
- Feature-gated: #[cfg(feature = "normalized_dev")]
- Documentation updates:
- CURRENT_TASK.md: Phase 47-A status
- PHASE_43_245B_NORMALIZED_COMPLETION.md: P3 forward reference
- joinir-architecture-overview.md: Minor formatting
- phase47-norm-p3-design.md: Implementation notes
Next steps (Phase 47-A implementation):
1. Rename pattern2_step_schedule.rs → step_schedule.rs
2. Add P3 StepKind (IfCond, ThenUpdates, ElseUpdates)
3. Implement Normalized→MIR(direct) for P3
4. Complete test implementation
Tests: 937/937 PASS (no behavioral changes yet)
2025-12-12 05:07:01 +09:00
d4b9ae3ba5
feat(joinir): Phase 46 - P2-Mid canonical Normalized promotion
...
Promote P2-Mid patterns (_atoi real, _parse_number real) to canonical
Normalized→MIR(direct) route, completing P2 line transition.
Canonical set expansion (Phase 41 → Phase 46):
- P2-Core: Pattern2Mini, skip_ws mini/real, atoi mini
- P2-Mid: atoi real, parse_number real (NEW)
All JsonParser P2 loops (_skip_whitespace, _atoi, _parse_number) now
canonical Normalized - Structured→MIR is legacy/comparison-only.
Key changes:
- shape_guard.rs: Expanded is_canonical_shape() (+2 patterns)
- JsonparserAtoiReal
- JsonparserParseNumberReal
- Made NormalizedDevShape enum public
- bridge.rs: Updated canonical routing comments (Phase 41 → 46)
- normalized.rs: Made shape_guard module public
- normalized_joinir_min.rs: Added Phase 46 canonical verification test
- phase46-norm-canon-p2-mid.md: Complete design documentation
Out of scope (deferred):
- P3/P4 Normalized support → NORM-P3/NORM-P4 phases
- Selfhost complex loops → separate phases
Benefits:
- Clear P2 boundary: All JsonParser P2 = Normalized canonical
- Infrastructure validation: Phase 43/245B proven production-ready
- Simplified mental model: P2 = Normalized-first, P3/P4 = future
Tests: 937/937 PASS (lib), 20/20 PASS (normalized_dev feature)
Phase 46 test: test_phase46_canonical_set_includes_p2_mid ✅
2025-12-12 04:40:46 +09:00
c82ae2365f
refactor(joinir): Phase 44 - Capability-based shape guard
...
Refactor shape detection from function-name-based to capability-based
architecture for better extensibility and maintainability.
Key changes:
- ShapeCapabilityKind enum: P2CoreSimple/SkipWs/Atoi/ParseNumber
- ShapeCapability: Capability descriptor with future extensibility
- Helper functions:
- capability_for_shape(): Map shape to capability
- is_canonical_shape(): Exact shape-level check
- is_p2_core_capability(): Broad capability family check
- is_supported_by_normalized(): Normalized dev support
Benefits:
- Extensibility: Easy to add new capability kinds
- Clarity: Shape purpose explicit in kind names
- Maintainability: Centralized mapping vs scattered ifs
- Future-ready: Infrastructure for carrier roles, method signatures
Backward compatibility:
- Zero behavioral changes (pure refactoring)
- Canonical set preserved: Pattern2Mini, skip_ws mini/real, atoi mini
- All existing code paths unchanged
Tests: 937/937 PASS
Files: +78 lines (shape_guard.rs), design doc created
2025-12-12 04:06:03 +09:00
a763651162
refactor(joinir): Modularize function_scope_capture (1588→4 modules)
...
Break down monolithic function_scope_capture.rs into 4 focused Box-First modules:
**File structure**:
- mod.rs (57 lines): Public API and module organization
- types.rs (110 lines): CapturedVar, CapturedEnv type definitions
- helpers.rs (411 lines): 11 helper functions for AST analysis
- analyzers.rs (1015 lines): Core analysis functions and FunctionScopeCaptureAnalyzer
**Separation of concerns**:
- types.rs: Pure data structures
- helpers.rs: Reusable utility functions (find_stmt_index, ast_matches, etc.)
- analyzers.rs: High-level analysis logic and orchestration
- mod.rs: Clean public API
**Benefits**:
- Single Responsibility Principle: Each module has one clear purpose
- Maintainability: ~400 line modules instead of 1588 line monolith
- Testability: 12 tests organized by module
- Box-First design: Clear separation with well-defined boundaries
**Verification**:
- 937/937 tests PASS (no regression)
- cargo build --release succeeds
- All docs and comments preserved
- No functional changes
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-12 03:42:57 +09:00
879d3ee08e
feat(joinir): Phase 45 - JoinIR mode unification
...
Unified JoinIR routing logic through centralized JoinIrMode enum:
Key changes:
- Added JoinIrMode enum (StructuredOnly / NormalizedDev / NormalizedCanonical)
- Added current_joinir_mode() for centralized mode determination
- Refactored normalized_dev_enabled() as thin wrapper over mode enum
- Updated bridge.rs: mode-based routing with canonical P2-Core special handling
- Updated runner.rs: mode pattern matching for dev roundtrip path
Files modified:
- joinir_dev.rs: JoinIrMode enum + current_joinir_mode() (+49 lines)
- bridge.rs: Replaced boolean checks with mode pattern matching (+29 lines)
- runner.rs: Mode-based routing logic (+9 lines)
- CURRENT_TASK.md: Phase 45 implementation summary
Documentation:
- phase45-norm-mode-design.md: Complete design spec and implementation guide
Behavior preservation:
- Canonical P2-Core shapes: always Normalized→MIR(direct) (mode-independent)
- NormalizedDev mode: Structured→Normalized→MIR for supported shapes
- StructuredOnly mode: Structured→MIR direct (default)
Tests: 937/937 PASS (no regression, pure refactor)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-12 03:31:58 +09:00
ed8e2d3142
feat(joinir): Phase 248 - Normalized JoinIR infrastructure
...
Major refactoring of JoinIR normalization pipeline:
Key changes:
- Structured→Normalized→MIR(direct) pipeline established
- ShapeGuard enhanced with Pattern2 loop validation
- dev_env.rs: New development fixtures and env control
- fixtures.rs: jsonparser_parse_number_real fixture
- normalized_bridge/direct.rs: Direct MIR generation from Normalized
- pattern2_step_schedule.rs: Extracted step scheduling logic
Files changed:
- normalized.rs: Enhanced NormalizedJoinModule with DevEnv support
- shape_guard.rs: Pattern2-specific validation (+300 lines)
- normalized_bridge.rs: Unified bridge with direct path
- loop_with_break_minimal.rs: Integrated step scheduling
- Deleted: step_schedule.rs (moved to pattern2_step_schedule.rs)
New files:
- param_guess.rs: Loop parameter inference
- pattern2_step_schedule.rs: Step scheduling for Pattern2
- phase43-norm-canon-p2-mid.md: Design doc
Tests: 937/937 PASS (+6 from baseline 931)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-12 03:15:45 +09:00
12e2f87c6f
Refine normalized bridge direct path and env guard
2025-12-11 22:50:23 +09:00
a4756f3ce1
Add dev normalized→MIR bridge for P1/P2 mini and JP _atoi
2025-12-11 22:12:46 +09:00
af6f95cd4b
Phase 33 NORM canon test: enforce normalized dev route for P1/P2/JP mini
2025-12-11 20:54:33 +09:00
59a985b7fa
joinir: clean pattern visibility and refactor pattern2 pipeline
2025-12-11 19:11:26 +09:00
eb00d97fdb
feat(joinir): Phase 246-EX Part 2 - Exit PHI & step scheduling fixes
...
Phase 246-EX Part 2 completes the _atoi JoinIR integration:
Key fixes:
- Exit PHI connection: ExitLineReconnector now correctly uses exit PHI dsts
- Jump args preservation: BasicBlock.jump_args field stores JoinIR exit values
- instruction_rewriter: Reads jump_args, remaps JoinIR→HOST values by carrier order
- step_schedule.rs: New module for body-local init step ordering
Files changed:
- reconnector.rs: Exit PHI connection improvements
- instruction_rewriter.rs: Jump args reading & carrier value mapping
- loop_with_break_minimal.rs: Refactored step scheduling
- step_schedule.rs: NEW - Step ordering logic extracted
Tests: 931/931 PASS (no regression)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 17:16:10 +09:00
e356524b0a
feat(joinir): Phase 246-EX Part 1 - FromHost carrier infrastructure
...
Extends Phase 247-EX dual-value architecture for _atoi NumberAccumulation
support. Implements FromHost carrier handling throughout JoinIR pipeline.
## Problem Analysis
_atoi requires `result = result * 10 + digit_pos` where:
- digit_pos is promoted to dual carriers: is_digit_pos (bool) + digit_value (int)
- digit_value is used in NumberAccumulation but NOT updated itself
- Existing infrastructure filtered out carriers without updates
## Implementation
### 1. Carrier Filtering (pattern2_with_break.rs:507-514)
**Added FromHost retention**:
```rust
carrier_updates.contains_key(&carrier.name)
|| carrier.role == CarrierRole::ConditionOnly
|| carrier.init == CarrierInit::FromHost // Phase 247-EX
```
**Effect**: Keeps digit_value carrier despite no update expression
### 2. Carrier Update Passthrough (loop_with_break_minimal.rs:411-426)
**Added FromHost passthrough**:
- FromHost carriers without updates pass through from env
- Similar to Phase 227 ConditionOnly handling
- Logged as `[loop/carrier_update] Phase 247-EX: FromHost carrier passthrough`
### 3. Exit Bindings Collection (meta_collector.rs:156-172)
**Added FromHost exit_bindings inclusion**:
```rust
Some((CarrierRole::LoopState, CarrierInit::FromHost)) => {
// Include in exit_bindings for latch incoming
// Not for exit PHI or variable_map
}
```
**Effect**: digit_value gets latch incoming for header PHI
## Test Results
- **Before**: 931 tests PASS
- **After**: 931 tests PASS (0 regressions)
## Verification
**Phase 247-EX UpdateEnv working**:
```
[update_env/phase247ex] Resolved promoted 'digit_pos' → 'digit_value' (integer carrier): ValueId(111)
```
**NumberAccumulation MIR generated**:
```
%39 = %14 Mul %38 ← result * 10
%40 = %39 Add %9 ← tmp + digit_value
```
## Status
- ✅ Pattern2 classification
- ✅ NumberAccumulation detection
- ✅ dual-value carrier resolution
- ✅ FromHost carrier handling
- ⚠️ RC:0 issue (runtime value problem, Part 2)
## Related
- Phase 247-EX: DigitPos dual-value architecture (commit 8900a3cc )
- Phase 227: ConditionOnly carrier handling
- Phase 228-8: ConditionOnly exit_bindings
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-11 15:28:36 +09:00
8900a3cc44
feat(joinir): Phase 247-EX - DigitPos dual-value architecture
...
Extends DigitPos promotion to generate TWO carriers for Pattern A/B support:
- Boolean carrier (is_digit_pos) for break conditions
- Integer carrier (digit_value) for NumberAccumulation
## Implementation
1. **DigitPosPromoter** (loop_body_digitpos_promoter.rs)
- Generates dual carriers: is_<var> (bool) + <base>_value (int)
- Smart naming: "digit_pos" → "digit" (removes "_pos" suffix)
2. **UpdateEnv** (update_env.rs)
- Context-aware promoted variable resolution
- Priority: <base>_value (int) → is_<var> (bool) → standard
- Pass promoted_loopbodylocals from CarrierInfo
3. **Integration** (loop_with_break_minimal.rs)
- UpdateEnv constructor updated to pass promoted list
## Test Results
- **Before**: 925 tests PASS
- **After**: 931 tests PASS (+6 new tests, 0 failures)
## New Tests
- test_promoted_variable_resolution_digit_pos - Full dual-value
- test_promoted_variable_resolution_fallback_to_bool - Fallback
- test_promoted_variable_not_a_carrier - Error handling
## Impact
| Pattern | Before | After |
|---------|--------|-------|
| _parse_number | ✅ Works (bool only) | ✅ Works (bool used, int unused) |
| _atoi | ❌ Failed (missing int) | ✅ READY (int carrier available!) |
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-11 15:08:14 +09:00
d4597dacfa
feat(joinir): Phase 245C - Function parameter capture + test fix
...
Extend CapturedEnv to include function parameters used in loop conditions,
enabling ExprLowerer to resolve variables like `s` in `loop(p < s.length())`.
Phase 245C changes:
- function_scope_capture.rs: Add collect_names_in_loop_parts() helper
- function_scope_capture.rs: Extend analyze_captured_vars_v2() with param capture logic
- function_scope_capture.rs: Add 4 new comprehensive tests
Test fix:
- expr_lowerer/ast_support.rs: Accept all MethodCall nodes for syntax support
(validation happens during lowering in MethodCallLowerer)
Problem solved: "Variable not found: s" errors in loop conditions
Test results: 924/924 PASS (+13 from baseline 911)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 13:13:08 +09:00
00ecddbbc9
Add pattern router tests and tidy pattern4 lowering
2025-12-11 04:22:08 +09:00
d4f90976da
refactor(joinir): Phase 244 - ConditionLoweringBox trait unification
...
Unify condition lowering logic across Pattern 2/4 with trait-based API.
New infrastructure:
- condition_lowering_box.rs: ConditionLoweringBox trait + ConditionContext (293 lines)
- ExprLowerer implements ConditionLoweringBox trait (+51 lines)
Pattern migrations:
- Pattern 2 (loop_with_break_minimal.rs): Use trait API
- Pattern 4 (loop_with_continue_minimal.rs): Use trait API
Benefits:
- Unified condition lowering interface
- Extensible for future lowering strategies
- Clean API boundary between patterns and lowering logic
- Zero code duplication
Test results: 911/911 PASS (+2 new tests)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-11 02:35:31 +09:00
2dfe363365
refactor(joinir): Phase 242-EX-A - Delete legacy Pattern3 lowerer
...
Remove hardcoded Pattern3 PoC implementation (loop_with_if_phi_minimal.rs)
and enhance if-sum mode to handle complex conditions like `i % 2 == 1`.
Key changes:
- condition_pattern.rs: Accept BinaryOp in comparison operands (+58 lines)
- loop_with_if_phi_if_sum.rs: Dynamic complex condition lowering (+147 lines)
- pattern3_with_if_phi.rs: Remove lower_pattern3_legacy() (-130 lines)
- loop_with_if_phi_minimal.rs: Delete entire file (-437 lines)
- loop_patterns/with_if_phi.rs: Update stub (-45 lines)
- mod.rs: Remove module reference (-4 lines)
Net reduction: -664 lines of hardcoded PoC code
Test results: 909/909 PASS (legacy mode completely removed)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 01:27:08 +09:00
811dfebf98
fix(joinir): Phase 241-EX - Remove hardcoded 'sum' check from Pattern3
...
Remove legacy hardcoded 'sum' carrier validation that was blocking
array_filter patterns with different accumulator names (e.g., 'out').
Before: Pattern3 required carrier named 'sum' to exist
After: Pattern3 uses carrier_info generically (any carrier name works)
Test results:
- phase49_joinir_array_filter_smoke: PASS ✅
- phase49_joinir_array_filter_fallback: PASS ✅
- phase49_joinir_array_filter_ab_comparison: PASS ✅
- Full suite: 909/909 PASS, 0 FAIL
Also: Archive old roadmap documentation (67k lines moved to docs/archive/)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 00:48:42 +09:00
a7dbc15878
feat(joinir): Phase 240-EX - Pattern2 header condition ExprLowerer integration
...
Implementation:
- Add make_pattern2_scope_manager() helper for DRY
- Header conditions use ExprLowerer for supported patterns
- Legacy fallback for unsupported patterns
- Fail-Fast on supported patterns that fail
Tests:
- 4 new tests (all pass)
- test_expr_lowerer_supports_simple_header_condition_i_less_literal
- test_expr_lowerer_supports_header_condition_var_less_var
- test_expr_lowerer_header_condition_generates_expected_instructions
- test_pattern2_header_condition_via_exprlowerer
Also: Archive old phase documentation (34k lines removed)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 00:33:04 +09:00
448bf3d8c5
docs(joinir): Phase 232-239 documentation and ExprLowerer refinements
...
Documentation:
- Move completion reports to docs/archive/reports/
- Add phase232-238 design/inventory documents
- Update joinir-architecture-overview.md
- Add doc-status-policy.md
Code refinements:
- ExprLowerer: condition catalog improvements
- ScopeManager: boundary clarifications
- CarrierInfo: cleanup
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-11 00:21:29 +09:00
13a676d406
feat(joinir): Phase 231 - ExprLowerer/ScopeManager pilot implementation
...
Pilot implementation of unified expression lowering for Pattern2 break conditions:
New files:
- scope_manager.rs (280 lines) - ScopeManager trait + Pattern2ScopeManager
- expr_lowerer.rs (455 lines) - ExprLowerer with Condition context support
Features:
- Unified variable lookup across ConditionEnv/LoopBodyLocalEnv/CapturedEnv/CarrierInfo
- Pre-validation of condition AST before lowering
- Fail-safe design with fallback to legacy path
- 8 new unit tests (all pass)
Integration:
- Pattern2 break condition uses ExprLowerer for pre-validation
- Existing proven lowering path preserved
- Zero impact on existing functionality (890/897 tests pass)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 22:48:45 +09:00
b07329b37f
feat(joinir): Phase 224-E - DigitPos condition normalization
...
Add DigitPosConditionNormalizer to transform integer comparison to boolean:
- `digit_pos < 0` → `!is_digit_pos`
This eliminates the type error caused by comparing Bool carrier with Integer:
- Before: Bool(is_digit_pos) < Integer(0) → Type error
- After: !is_digit_pos → Boolean expression, no type mismatch
Implementation:
- New Box: digitpos_condition_normalizer.rs (173 lines)
- Pattern2 integration: normalize after promotion success
- 5 unit tests (all pass)
- E2E test passes (type error eliminated)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 22:10:28 +09:00
38e810d071
refactor(joinir): Phase 229 - Remove redundant ConditionAlias
...
Replace static alias mapping with dynamic condition variable resolution using:
- promoted_loopbodylocals as source of truth
- Naming conventions: is_<var> or is_<var>_match
- Pattern-aware inference during lowering
Benefits:
- Simpler data structure (6 fields → 5)
- Single source of truth
- Self-documenting with explicit naming conventions
- Fewer maintenance points
Net: -25 lines (60 additions, 85 deletions)
Tests: 877/884 PASS (no regressions)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 21:53:27 +09:00
717a50ceeb
feat(joinir): Phase 228-8 - ConditionOnly carrier latch incoming support
...
- ExitMetaCollector includes ConditionOnly carriers in exit_bindings (for latch)
- ExitLineReconnector skips ConditionOnly in variable_map updates
- Pattern 2/3/4 pass carrier_info to ExitMetaCollector
- Resolves "has no latch incoming set" error
Role separation:
- Header PHI: entry + latch for both LoopState and ConditionOnly
- Exit PHI: LoopState only (ConditionOnly excluded)
- variable_map: LoopState only (ConditionOnly skipped)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 21:30:03 +09:00
192620f842
feat(joinir): Phase 228 - CarrierInit for ConditionOnly header PHI initialization
...
- Add CarrierInit enum (FromHost/BoolConst) for explicit initialization policy
- LoopHeaderPhiBuilder generates Const instruction for BoolConst carriers
- merge/mod.rs uses carrier_info to include ALL carriers in header PHI
- Pattern 2/4 pass carrier_info to boundary builder
- ConditionOnly carriers (is_digit_pos) now included in header PHI
Remaining: latch incoming for ConditionOnly carriers (Phase 228-8)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2025-12-10 21:10:28 +09:00