From 8d4472ddd39ad0b6d201a2233c0af26083bed285 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Sat, 27 Dec 2025 13:20:16 +0900 Subject: [PATCH] docs(phase287): Mark P5 complete, add P6 instructions --- docs/development/current/main/10-Now.md | 14 ++-- docs/development/current/main/30-Backlog.md | 6 +- ...5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md | 4 +- .../P6-SCAN_PLAN-INTEGRATION-INSTRUCTIONS.md | 65 +++++++++++++++++++ .../current/main/phases/phase-287/README.md | 13 +++- 5 files changed, 90 insertions(+), 12 deletions(-) create mode 100644 docs/development/current/main/phases/phase-287/P6-SCAN_PLAN-INTEGRATION-INSTRUCTIONS.md diff --git a/docs/development/current/main/10-Now.md b/docs/development/current/main/10-Now.md index 66c23544..2adbdfa1 100644 --- a/docs/development/current/main/10-Now.md +++ b/docs/development/current/main/10-Now.md @@ -1,6 +1,6 @@ # Self Current Task — Now (main) -## Current Focus: Phase 287 P5(Stages visibility facade) +## Current Focus: Phase 287 P6(Scan plan integration decision) **2025-12-27: Phase 188.3 完了** ✅ - Pattern6(NestedLoopMinimal): `apps/tests/phase1883_nested_minimal.hako` が RC=9 @@ -38,7 +38,13 @@ - `rewriter/stages/plan.rs` を facade 化し、`rewriter/stages/plan/` 配下へ責務単位で分割(意味論不変) - 検証: Build 0 errors / quick 154 PASS / 恒常ログ増加なし - 入口: `docs/development/current/main/phases/phase-287/P4-PLAN_STAGE-MODULARIZATION-INSTRUCTIONS.md` -- 次の指示書(P5): `docs/development/current/main/phases/phase-287/P5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md` +- 次の指示書(P5): `docs/development/current/main/phases/phase-287/P5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md`(完了) + +**2025-12-27: Phase 287 P5 完了** ✅ +- `stages/mod.rs` を facade にして stage 関数を re-export(単一入口化) +- 検証: Build 0 errors / quick 154 PASS / 恒常ログ増加なし +- 入口: `docs/development/current/main/phases/phase-287/P5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md` +- 次の指示書(P6): `docs/development/current/main/phases/phase-287/P6-SCAN_PLAN-INTEGRATION-INSTRUCTIONS.md` **2025-12-27: Phase 188.2 完了** ✅ - StepTreeの `max_loop_depth` を SSOT に採用(Option A) @@ -131,8 +137,8 @@ - quick smoke 154/154 PASS 維持、Pattern1/4 PoC 両方 PASS **次のステップ**: -1. **Phase 287(P5)**: `rewriter/stages` の可視性引き締め(意味論不変) - - 指示書: `docs/development/current/main/phases/phase-287/P5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md` +1. **Phase 287(P6)**: Scan plan 統合(docs-first) + - 指示書: `docs/development/current/main/phases/phase-287/P6-SCAN_PLAN-INTEGRATION-INSTRUCTIONS.md` 2. (post self-host / docs-first)**Phase 29y**: MIR lifecycle vocab freeze(RC/weak/ABI) - 相談パケット: `docs/development/current/main/investigations/phase-29y-mir-lifecycle-vocab-consult.md` 3. (future design, separate phase)Plan 生成の正規化(相談パケット) diff --git a/docs/development/current/main/30-Backlog.md b/docs/development/current/main/30-Backlog.md index 1e9dbd51..bd96e742 100644 --- a/docs/development/current/main/30-Backlog.md +++ b/docs/development/current/main/30-Backlog.md @@ -14,10 +14,10 @@ Related: - 次: Phase 288.2+(任意): REPL UX improvements(history / multiline / load 等) - **Phase 287(active): Big Files Refactoring follow-ups(意味論不変)** - - 状況: P0/P1/P2/P3/P4 ✅ 完了(merge modularize / ast_feature_extractor facade / contract_checks facade / rewriter stages split / plan stage split) - - 次(P5): `rewriter/stages` の可視性引き締め(stages/mod.rs facade) + - 状況: P0/P1/P2/P3/P4/P5 ✅ 完了(merge modularize / ast_feature_extractor facade / contract_checks facade / rewriter stages split / plan stage split / stages facade) + - 次(P6): Scan plan の扱いを決めて統合 or 削除(docs-first) - 入口: `docs/development/current/main/phases/phase-287/README.md` - - 指示書: `docs/development/current/main/phases/phase-287/P5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md` + - 指示書: `docs/development/current/main/phases/phase-287/P6-SCAN_PLAN-INTEGRATION-INSTRUCTIONS.md` - **Phase 284(✅ COMPLETE): Return as ExitKind SSOT(patternに散らさない)** - 目的: `return` を “pattern最適化の個別実装” にせず、`ExitKind` と `compose::*` / `emit_frag()` に収束させる diff --git a/docs/development/current/main/phases/phase-287/P5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md b/docs/development/current/main/phases/phase-287/P5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md index d91622f7..78efacea 100644 --- a/docs/development/current/main/phases/phase-287/P5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md +++ b/docs/development/current/main/phases/phase-287/P5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md @@ -1,8 +1,8 @@ # Phase 287 P5: `rewriter/stages` 可視性引き締め指示書(意味論不変) **Date**: 2025-12-27 -**Status**: Ready(next) -**Scope**: `src/mir/builder/control_flow/joinir/merge/rewriter/stages/` の stage 関数(scan/plan/apply)を `stages/mod.rs` 経由の re-export に統一し、各 stage 実装ファイル側の可視性を `pub(super)` に縮退する。 +**Status**: Completed ✅ +**Scope**: `src/mir/builder/control_flow/joinir/merge/rewriter/stages/` の stage 関数(scan/plan/apply)を `stages/mod.rs` 経由の re-export に統一し、呼び出し側は `stages::{...}` のみを使用する(単一入口)。 **Non-goals**: 仕様変更、エラータグ/ヒント文の変更、ログ出力変更、pipeline の順序/条件変更、ファイル分割の追加(P5は “可視性と入口” のみ) --- diff --git a/docs/development/current/main/phases/phase-287/P6-SCAN_PLAN-INTEGRATION-INSTRUCTIONS.md b/docs/development/current/main/phases/phase-287/P6-SCAN_PLAN-INTEGRATION-INSTRUCTIONS.md new file mode 100644 index 00000000..6958a942 --- /dev/null +++ b/docs/development/current/main/phases/phase-287/P6-SCAN_PLAN-INTEGRATION-INSTRUCTIONS.md @@ -0,0 +1,65 @@ +# Phase 287 P6: Scan plan 統合(docs-first, 意味論不変の範囲で) + +**Date**: 2025-12-27 +**Status**: Ready(next) +**Scope**: `merge/instruction_rewriter.rs` の Stage 1(scan)で生成する `RewritePlan` を、Stage 2(plan)へ “同じ意味” で反映するか、または Stage 1 を削除して pipeline を単純化するための判断を docs で固定する。 +**Non-goals**: 挙動変更、ログ恒常増加、silent fallback 追加、テスト専用の暫定コード追加 + +--- + +## 背景(問題点) + +現状の pipeline は “Scan → Plan → Apply” という構造だが、`RewritePlan` が Stage 2 で実質未使用になっており、同じ検出(tail call / return など)を Stage 2 側で再走査している。 + +この状態は以下の問題を生む: +- “Scan の存在意義” が曖昧で、将来の保守時に二重修正が起きやすい +- Stage 境界の責務が不明瞭になりやすい(read-only のはずが drift しやすい) + +--- + +## 目的(SSOT) + +- Scan の役割を SSOT として固定する(使うなら “何に使うか”、捨てるなら “なぜ捨てるか”)。 +- 意味論不変を守ったまま、重複ロジックを解消するための “安全な最短ルート” を決める。 + +--- + +## 選択肢(決めること) + +### Option A: Scan plan を Stage 2 に反映(維持) + +- `RewritePlan` を Stage 2 の入力として使い、検出を 1 回に寄せる。 +- 受け入れ条件: + - Stage 2 で “scan と同等の検出” を再計算しない + - out-of-scope は `Ok(None)` ではなく、現状通りの Fail-Fast 契約を維持(fallback 禁止) + +### Option B: Stage 1 を削除(単純化) + +- Scan を消し、Stage 2 が唯一の “解析 + 変換” 入口になる。 +- 受け入れ条件: + - debug/log の恒常出力差を出さない(既存 `debug` フラグに従う) + - pipeline の見通し(責務)を docs と module 構造で補強する + +--- + +## 手順(docs-first) + +1. `RewritePlan` の intended contract を 10 行程度で記述(何を “決めた” と見なすか) +2. Option A/B を選び、採用理由と不採用理由を 1 段落ずつ書く +3. 実装は “移動 + 入口統一” に限定する(if 増殖や新条件を入れない) + +--- + +## 検証(受け入れ基準) + +```bash +cargo build --release +./tools/smokes/v2/run.sh --profile quick +./target/release/hakorune --backend vm apps/tests/phase1883_nested_minimal.hako # RC=9 +``` + +受け入れ: +- Build: 0 errors +- quick: 154/154 PASS +- Pattern6: RC=9 維持 +- 恒常ログ増加なし diff --git a/docs/development/current/main/phases/phase-287/README.md b/docs/development/current/main/phases/phase-287/README.md index 0fdd6171..b567a7d1 100644 --- a/docs/development/current/main/phases/phase-287/README.md +++ b/docs/development/current/main/phases/phase-287/README.md @@ -1,6 +1,6 @@ # Phase 287: Developer Hygiene(big files / smoke / normalizer) -**Status**: In progress (P0/P1/P2/P3/P4 complete, P5 next) +**Status**: In progress (P0/P1/P2/P3/P4/P5 complete, P6 next) **Date**: 2025-12-27 **Previous**: Phase 286 (Plan Line完全運用化) @@ -44,13 +44,20 @@ Phase 287 は「開発導線の整備(意味論不変)」を優先して、 --- -## Next (P5) +## 2025-12-27 Update: Stages facade(P5)✅ -- pipeline 関数(scan/plan/apply)の可視性を引き締め、`stages/mod.rs` を facade(re-export)にする(意味論不変)。 +- pipeline 関数(scan/plan/apply)を `stages/mod.rs` から re-export し、呼び出し側 import を単一入口へ統一した(意味論不変)。 - 指示書: `docs/development/current/main/phases/phase-287/P5-STAGES-VISIBILITY-FACADE-INSTRUCTIONS.md` --- +## Next (P6) + +- Stage-1/2/3 の “scan plan” が未使用なので、設計を固定してから統合する(または削除する)ための docs-first 指示書を作る。 + - 指示書: `docs/development/current/main/phases/phase-287/P6-SCAN_PLAN-INTEGRATION-INSTRUCTIONS.md` + +--- + ## Legacy / Historical (2025-12-26 plan) 以下は「Phase 287 を hygiene として計画していた時期のログ」。今後の候補として残すが、P0/P1(big files)とは別系統。