Files
hakorune/CURRENT_TASK.md

64 lines
3.3 KiB
Markdown
Raw Normal View History

# CURRENT_TASK (moved)
feat(hako_check): Phase 153 - Dead code detection revival (JoinIR version) Implement comprehensive dead code detection for hako_check with JoinIR integration, following Phase 133/134/152 box-based modularity pattern. ## Key Achievements 1. **Comprehensive Inventory** (`phase153_hako_check_inventory.md`): - Documented current hako_check architecture (872 lines) - Analyzed existing HC011/HC012 rules - Confirmed JoinIR-only pipeline (Phase 124) - Identified Phase 153 opportunities 2. **DeadCodeAnalyzerBox** (`rule_dead_code.hako`): - Unified HC019 rule (570+ lines) - Method-level + box-level dead code detection - DFS reachability from entrypoints - Text-based analysis (no MIR JSON dependency for MVP) - Heuristic-based false positive reduction 3. **CLI Integration** (`cli.hako`): - Added `--dead-code` flag for comprehensive mode - Added `--rules dead_code` for selective execution - Compatible with --format (text/json-lsp/dot) 4. **Test Infrastructure**: - HC019_dead_code test directory (ng/ok/expected.json) - `hako_check_deadcode_smoke.sh` with 4 test cases ## Technical Details - **Input**: Analysis IR (MapBox with methods/calls/boxes/entrypoints) - **Output**: HC019 diagnostics - **Algorithm**: Graph-based DFS reachability - **Pattern**: Box-based modular architecture - **No ENV vars**: CLI flags only ## Files Modified - NEW: docs/development/current/main/phase153_hako_check_inventory.md - NEW: tools/hako_check/rules/rule_dead_code.hako - MOD: tools/hako_check/cli.hako - NEW: tools/hako_check/tests/HC019_dead_code/ - NEW: tools/hako_check_deadcode_smoke.sh - MOD: CURRENT_TASK.md ## Next Steps - Phase 154+: MIR CFG integration for block-level detection - Phase 160+: Integration with .hako JoinIR/MIR migration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:19:48 +09:00
Status: SSOT
Scope: Repo root の旧リンク互換。現行の入口は `docs/development/current/main/10-Now.md`
- Now: `docs/development/current/main/10-Now.md`
- Backlog: `docs/development/current/main/30-Backlog.md`
---
## Handoff (was blocking; now unblocked)
### 状況
- JoinIR/Phase 131 系Normalized shadow + DirectValue exitが進行中だが、**LLVM EXE smoke が Rust のビルド段階でブロック**していた。
- エラー: `Invalid cross-device link (os error 18)``cargo build``.rmeta/.rlib` を書き出すときに落ちる)
- 2025-12-18: `wsl --shutdown` による WSL 再起動後、`cargo build`/LLVM build/該当 smokes が復活(下のコマンドは PASS
### 症状(再現コマンド)
- `cargo build -p nyash-rust`
- `cargo build --release -p nyash-rust --features llvm`
- LLVM EXE smokes内部で release build するので同様に失敗)
- `bash tools/smokes/v2/profiles/integration/apps/phase131_loop_true_break_once_llvm_exe.sh`
- `bash tools/smokes/v2/profiles/integration/apps/phase97_next_non_ws_llvm_exe.sh`
### 影響しない(通るもの)
- `cargo test --lib` は PASS
- VM smokes は PASS
- `bash tools/smokes/v2/profiles/integration/apps/phase131_loop_true_break_once_vm.sh`
- `bash tools/smokes/v2/profiles/integration/apps/phase130_if_only_post_if_add_vm.sh`
### 根本原因メモ(環境)
- WSL2 上で、`O_TMPFILE` で作った一時ファイルを `/proc/self/fd/<n>` 経由で `link` すると **EXDEV が返る**挙動を確認。
- Rustc/cargo が内部で類似の「tmpfile → persistlink/rename」を使っている可能性が高い。
- さらに、この環境では `~/.rustup/tmp``~/.cargo` が書き込み不可に見えるimmutable/perm issue の疑い)。
- DNS も一時的に死んでおり、`rustup toolchain install` 等の回避策が取れない状態だった(`Temporary failure in name resolution`)。
### 対処(ユーザー側での復旧手順)
1. WSL を完全再起動:
- Windows 側で `wsl --shutdown` → その後 WSL を起動し直す
2. 再起動後にビルドが復活しているか確認:
- `cargo build -p nyash-rust`
- `cargo build --release -p nyash-rust --features llvm`
3. 復活したら、VM+LLVM EXE の最終確認integration:
- `bash tools/smokes/v2/profiles/integration/apps/phase131_loop_true_break_once_vm.sh`
- `bash tools/smokes/v2/profiles/integration/apps/phase131_loop_true_break_once_llvm_exe.sh`
- `bash tools/smokes/v2/profiles/integration/apps/phase97_next_non_ws_llvm_exe.sh`
### 補足(再発時のワークアラウンド)
- `tools/build_llvm.sh` は EXDEV を避けるため、`TMPDIR``target/...` 配下へ寄せる(同一 FS 内での artifact finalize を狙う)。
### 注意(作業ツリー)
- 現在 `git status` は clean ではないPhase 131 関連の変更が多数 + 未tracked docs/ファイルあり)。
- 未tracked: `docs/development/current/main/phases/phase-131/p1.5-implementation-guide.md`
- 未tracked: `docs/development/current/main/phases/phase-131/p1.5-option-b-analysis.md`
- 未tracked: `docs/development/current/main/phases/phase-131/p1.5-root-cause-summary.md`
- 未tracked: `src/mir/control_tree/normalized_shadow/exit_reconnector.rs`