refactor(joinir): Phase 86 - Carrier init builder, debug migration, error tags

P1: Carrier Initialization Builder (HIGH) 
- New module: carrier_init_builder.rs (197 lines, 8 tests)
- Refactored loop_header_phi_builder.rs (-34 lines)
- Centralized CarrierInit value generation (SSOT)
- Eliminates scattered match patterns across header PHI, exit line
- Consistent debug output: [carrier_init_builder] format
- Net: -34 lines of duplicated logic

P2: Remaining DebugOutputBox Migration (QUICK) 
- Migrated carrier_info.rs::record_promoted_binding()
- Uses DebugOutputBox for JOINIR_DEBUG checks
- Maintains JOINIR_TEST_DEBUG override for test diagnostics
- Consistent log formatting: [context/category] message
- Net: +3 lines (SSOT migration)

P3: Error Message Centralization (LOW) 
- New module: error_tags.rs (136 lines, 5 tests)
- Migrated 3 error sites:
  * ownership/relay:runtime_unsupported (plan_validator.rs)
  * joinir/freeze (control_flow/mod.rs)
  * (ExitLine errors were debug messages, not returns)
- Centralized error tag generation (freeze, exit_line_contract, ownership_relay_unsupported, etc.)
- Net: +133 lines (SSOT module + tests)

Total changes:
- New files: carrier_init_builder.rs (197), error_tags.rs (136)
- Modified: 6 files
- Production code: +162 lines (SSOT investment)
- Tests: 987/987 PASS (982→987, +5 new tests)
- Phase 81 ExitLine: 2/2 PASS
- Zero compilation errors/warnings

Benefits:
 Single Responsibility: Each helper has one concern
 Testability: 13 new unit tests (8 carrier init, 5 error tags)
 Consistency: Uniform debug/error formatting
 SSOT: Centralized CarrierInit and error tag generation
 Discoverability: Easy to find all error types

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-13 21:48:02 +09:00
parent 624245b63c
commit 33f03d9775
8 changed files with 359 additions and 42 deletions

View File

@ -26,6 +26,7 @@ pub(crate) mod carrier_update_emitter; // Phase 179: Carrier update instruction
pub(crate) mod common; // Internal lowering utilities
pub mod complex_addend_normalizer; // Phase 192: Complex addend normalization (AST preprocessing)
pub mod debug_output_box; // Phase 85: Centralized debug output management
pub mod error_tags; // Phase 86: Centralized error message formatting
pub mod condition_env; // Phase 171-fix: Condition expression environment
pub(crate) mod condition_lowerer; // Phase 171-fix: Core condition lowering logic
pub mod condition_lowering_box; // Phase 244: Unified condition lowering interface (trait-based)