Commit Graph

2 Commits

Author SHA1 Message Date
2da730de35 refactor(cleanup): Phase 285A1 Post-Implementation Cleanup
Code quality improvements after Phase 285A1 implementation:

**Task 1: Dead Code Cleanup**
- Removed unnecessary #[allow(dead_code)] from emit_weak_load()
- Function is actively used in weak_to_strong() method handler

**Task 2: Unused Import Removal (cargo fix)**
- edgecfg/api/mod.rs: Removed seq, if_, loop_, cleanup, verify_frag_invariants
- pattern3.rs: Removed BinaryOperator
- pattern2/api/mod.rs: Removed PromoteStepResult
- jump.rs: Removed EffectMask, Span
- Result: 6 unused imports eliminated

**Task 3: Deprecated Pattern Removal**
- Fixed 4 PlanKind::LoopWithPost deprecated warnings
- Updated to Phase 142 P0 architecture (statement-level normalization)
- Files: normalized_shadow_suffix_router_box.rs, routing.rs,
  execute_box.rs, plan.rs
- Removed 2 deprecated tests: test_loop_with_post_*

**Task 4: WeakFieldValidatorBox Boxification**
- Extracted weak field validation logic into dedicated Box
- New file: src/mir/builder/weak_field_validator.rs (147 lines)
- fields.rs: 277 → 237 lines (-40 lines, -14.4%)
- Added 5 unit tests for validation logic
- Follows Phase 33 boxification principles (single responsibility,
  testability, reusability)

**Metrics**:
- Code reduction: -40 lines in fields.rs
- Test coverage: +5 unit tests
- Warnings fixed: 4 deprecated warnings
- Imports cleaned: 6 unused imports

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 03:44:56 +09:00
e17902a443 refactor(pattern2): move promotion decision into pattern2/api SSOT
Phase 263 P0.2: pattern2/api/ フォルダ化 - 入口SSOTの物理固定

目的: PromoteDecision/try_promote の参照点を1箇所に閉じ込めて、迷子防止

Changes:
1. 新規フォルダ構造:
   - pattern2/api/mod.rs - 入口SSOT(try_promote と PromoteDecision を再export)
   - pattern2/api/promote_decision.rs - PromoteDecision/PromoteStepResult 型定義
   - pattern2/api/promote_runner.rs - try_promote(...) 実装(SSOT entry point)
   - pattern2/mod.rs - api モジュールを公開

2. 移動/抽出:
   - PromoteDecision enum を promote_step_box.rs → pattern2/api/promote_decision.rs へ
   - promote_and_prepare_carriers を try_promote として pattern2/api/promote_runner.rs へ抽出

3. promote_step_box.rs を薄いラッパに縮退(35行, -177行):
   - pattern2::api::try_promote を呼び出すだけの互換用ラッパ
   - 将来的に削除予定(deprecated)

4. orchestrator を新API に書き換え:
   - use super::pattern2::api::{try_promote, PromoteDecision};
   - try_promote(...) を直接呼び出し

5. 参照確認:
   - rg で確認: すべての参照が pattern2::api 経由に収束 

検証:
- cargo test --lib: 1368/1368 PASS 
- quick smoke: 45/46 PASS (悪化なし)
- 参照点が pattern2/api に一本化され、迷子防止を物理的に保証
2025-12-21 11:07:36 +09:00