e404746612
refactor(mir): Phase 139-P3-B - RoutingDecision を enum 対応 + レガシー削除
...
- RoutingDecision の missing_caps を Vec<CapabilityTag> に変更(型安全化)
- error_tags は to_tag() メソッドで自動生成
- 全 callsite を enum variant に修正
- capability_tags モジュール(文字列定数群)を完全削除
- 全テスト PASS(型安全性向上を確認)
- フォーマット適用
2025-12-16 07:02:14 +09:00
8c2bc45be6
refactor(joinir): Phase 85 - Quick wins: loop_patterns removal, DebugOutputBox, dead_code audit
...
Quick Win 1: Remove loop_patterns_old.rs (COMPLETED)
- Deleted obsolete legacy loop pattern dispatcher (914 lines)
- All patterns (Break/Continue/Simple) now in modular loop_patterns/ system
- Moved helper functions (has_break_in_loop_body, has_continue_in_loop_body) to analysis.rs
- Updated loop_frontend_binding.rs to remove fallback
- Verified zero regressions: 974/974 lib tests PASS
Quick Win 2: DebugOutputBox consolidation (COMPLETED)
- New module: src/mir/join_ir/lowering/debug_output_box.rs (170 lines)
- Centralized debug output management with automatic HAKO_JOINIR_DEBUG checking
- Refactored 4 files to use DebugOutputBox:
- condition_env.rs: 3 scattered checks → 3 Box calls
- carrier_binding_assigner.rs: 1 check → 1 Box call
- scope_manager.rs: 3 checks → 3 Box calls
- analysis.rs: Updated lower_loop_with_if_meta to use new pattern system
- Benefits: Consistent formatting, centralized control, zero runtime cost when disabled
- Added 4 unit tests for DebugOutputBox
Quick Win 3: Dead code directive audit (COMPLETED)
- Audited all 40 #[allow(dead_code)] directives in lowering/
- Findings: All legitimate (Phase utilities, future placeholders, API completeness)
- No unsafe removals needed
- Categories:
- Phase 192 utilities (whitespace_check, entry_builder): Public API with tests
- Phase 231 placeholders (expr_lowerer): Explicitly marked future use
- Const helpers (value_id_ranges): API completeness
- Loop metadata (loop_update_summary): Future phase fields
Result: Net -858 lines, improved code clarity, zero regressions
Tests: 974/974 PASS (gained 4 from DebugOutputBox tests)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com >
2025-12-13 19:25:11 +09:00
9e32807a96
refactor(joinir): Phase 82-83 - Debug flag SSOT + Fallback verification
...
Phase 82: Centralized JoinIR debug flag reading
- Added is_joinir_debug() SSOT function in joinir_flags.rs
- Replaced 16 direct env::var() calls across 8 files
- Updated docs to recommend HAKO_JOINIR_DEBUG (NYASH_ deprecated)
- Backward compat: Both env vars work
Phase 83: Verified promoted carrier fallback behavior
- Confirmed NO fallback to name-based lookup for DigitPos/Trim
- Documented fallback expectations in Phase 80/81 docs
- Added verification commands and expected output
Changes:
- src/config/env/joinir_flags.rs: +187 lines (new SSOT module)
- 8 files: env var reads → is_joinir_debug() calls
- 3 docs: HAKO_JOINIR_DEBUG examples + fallback sections
- 1 summary doc: phase82-83-debug-flag-ssot-summary.md
Tests: 970/970 lib PASS, 58/58 normalized_dev PASS
Impact: Dev-only (zero production changes)
2025-12-13 19:01:14 +09:00
8b48bec962
feat(joinir): Phase 78 - BindingId infrastructure for promoted carriers (dev-only)
...
Phase 78 adds infrastructure to assign BindingIds to synthetic promoted
carriers (e.g., is_digit_pos, is_ch_match), enabling type-safe promoted
variable lookup without string-based naming conventions.
Key Changes:
1. CarrierVar.binding_id field (dev-only):
- Added Option<BindingId> to track BindingId for each carrier
- Updated all constructors and struct instantiations
2. CarrierBindingAssigner Box (new file, 273 lines):
- Allocates BindingIds for promoted carriers via builder.allocate_binding_id()
- Records original → promoted mapping in promoted_bindings
- Sets binding_id field on promoted CarrierVar
- Includes 3 comprehensive unit tests
3. ConditionEnv.register_carrier_binding() (new method):
- Registers carrier BindingId → ValueId mappings
- Enables type-safe lookup via binding_id_map
4. Logging cleanup:
- Gated 6 eprintln! statements with NYASH_JOINIR_DEBUG
- Unified logging tags to [binding_pilot/*]
Design Decisions:
- Promoters create CarrierInfo, lowering code assigns BindingIds
- CarrierBindingAssigner called from Pattern2/4 lowering (has builder access)
- Clear documentation prevents misuse (promoters lack builder access)
Files modified (18):
- carrier_info.rs: binding_id field added to CarrierVar
- carrier_binding_assigner.rs: New Box for BindingId allocation
- condition_env.rs: register_carrier_binding() method
- mod.rs: Module exports
- pattern2_with_break.rs, pattern4_with_continue.rs: Updated for binding_id
- loop_body_*_promoter.rs: Logging cleanup + binding_id in structs
- phase78-bindingid-promoted-carriers.md: Architecture documentation
Tests: 970/970 PASS (zero regressions)
Status: Infrastructure complete, integration deferred to Phase 79
Next Phase: Wire CarrierBindingAssigner in Pattern2/4 lowering + E2E tests
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-13 16:20:33 +09:00
0aad016be2
chore(joinir): quiet legacy promoted lookup warning
2025-12-13 06:12:21 +09:00
72173c1ac8
feat(joinir): Phase 77 - BindingId expansion implementation (dev-only)
...
Phase 77 implements promoted_bindings population in DigitPos/Trim promoters
and deprecates legacy name-based resolution paths.
Changes:
- DigitPosPromoter: Added binding_map field and record_promoted_binding() calls
- TrimLoopHelper: Added binding_map field for ch → is_ch_match tracking
- Pattern2/4: Wired binding_map from builder.binding_map to promoters
- Legacy deprecation: Added #[deprecated] to resolve_promoted_join_id()
- Dual-path design: BindingId priority + name fallback maintained
Files modified (8):
- pattern2_with_break.rs, pattern4_with_continue.rs: binding_map wiring
- trim_loop_lowering.rs: Trim promoter integration
- carrier_info.rs: Deprecation warnings
- scope_manager.rs: Deprecated fallback paths
- loop_body_carrier_promoter.rs: Trim binding_map support
- loop_body_cond_promoter.rs: Orchestrator updates
- loop_body_digitpos_promoter.rs: DigitPos binding_map support
Tests: 958/958 PASS (zero regressions)
Design: Type-safe BindingId mapping replaces string-based promoted variable resolution
Phase 78+ will delete deprecated code (~50 lines) and make binding_map required.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2025-12-13 05:58:57 +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
af6f95cd4b
Phase 33 NORM canon test: enforce normalized dev route for P1/P2/JP mini
2025-12-11 20:54:33 +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
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