From fd7e3fee3505fa2e9b0cb64f733c6b51ae63446a Mon Sep 17 00:00:00 2001 From: tomoaki Date: Mon, 29 Dec 2025 16:31:29 +0900 Subject: [PATCH] docs(phase29am): coreplan step-a if/exit implementation instructions --- CURRENT_TASK.md | 3 + docs/development/current/main/10-Now.md | 4 +- docs/development/current/main/30-Backlog.md | 5 ++ ...0-COREPLAN-LOWERER-IF-EXIT-INSTRUCTIONS.md | 81 +++++++++++++++++++ .../current/main/phases/phase-29am/README.md | 22 +++++ 5 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 docs/development/current/main/phases/phase-29am/P0-COREPLAN-LOWERER-IF-EXIT-INSTRUCTIONS.md create mode 100644 docs/development/current/main/phases/phase-29am/README.md diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index faccc626..23076725 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -18,6 +18,9 @@ Scope: Repo root の旧リンク互換。現行の入口は `docs/development/cu **CorePlan migration 道筋 SSOT** `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md` が移行タスクの Done 判定の入口。 +**Next implementation (CorePlan Step-A)** +`docs/development/current/main/phases/phase-29am/P0-COREPLAN-LOWERER-IF-EXIT-INSTRUCTIONS.md` + **PlanRuleOrder SSOT** single_planner の順序/名前 SSOT は `src/mir/builder/control_flow/plan/single_planner/rule_order.rs` に固定。PlannerContext で Pattern1 facts の抑制を開始し、残りの guard/filter は段階移行。 diff --git a/docs/development/current/main/10-Now.md b/docs/development/current/main/10-Now.md index 16ee586d..cd958db1 100644 --- a/docs/development/current/main/10-Now.md +++ b/docs/development/current/main/10-Now.md @@ -1,8 +1,8 @@ # Self Current Task — Now (main) -## Current Focus: Phase 29al(CorePlan composition hardening / docs-first) +## Current Focus: Phase 29am(CorePlan Step-A implementation) -Next: Phase 29al P4(unwind を含む ExitKind 拡張: design only) +Next: Phase 29am P0(CorePlan::If/CorePlan::Exit lowerer/verifier) 運用ルール: integration filter で phase143_* は回さない(JoinIR 回帰は phase29ae pack のみ) 運用ルール: phase286_pattern9_* は legacy pack (SKIP) を使う 移行道筋 SSOT: `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md` diff --git a/docs/development/current/main/30-Backlog.md b/docs/development/current/main/30-Backlog.md index 06bfd0b0..296fcda0 100644 --- a/docs/development/current/main/30-Backlog.md +++ b/docs/development/current/main/30-Backlog.md @@ -35,6 +35,11 @@ Related: - Next: P4(unwind を含む ExitKind 拡張: design only) - 道筋 SSOT: `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md` +- **Phase 29am(candidate): CorePlan Step-A implementation (lowerer/verifier)** + - 入口: `docs/development/current/main/phases/phase-29am/README.md` + - Next: P0(CorePlan::If/CorePlan::Exit lowerer/verifier) + - Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` + - **Phase 29ai(candidate): Plan/Frag single-planner(Facts SSOT)** - 入口: `docs/development/current/main/phases/phase-29ai/README.md` - Next: Phase 29ai P16(TBD: promotion hint を JoinIR 側の orchestrator へ配線、挙動不変) diff --git a/docs/development/current/main/phases/phase-29am/P0-COREPLAN-LOWERER-IF-EXIT-INSTRUCTIONS.md b/docs/development/current/main/phases/phase-29am/P0-COREPLAN-LOWERER-IF-EXIT-INSTRUCTIONS.md new file mode 100644 index 00000000..0a2eaf7b --- /dev/null +++ b/docs/development/current/main/phases/phase-29am/P0-COREPLAN-LOWERER-IF-EXIT-INSTRUCTIONS.md @@ -0,0 +1,81 @@ +--- +Status: Active +Scope: code(仕様不変、ルーティング変更なし) +Related: +- docs/development/current/main/phases/phase-29am/README.md +- docs/development/current/main/design/coreplan-migration-roadmap-ssot.md +- docs/development/current/main/design/effect-classification-ssot.md +- docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md +- docs/development/current/main/phases/phase-29ae/README.md +--- + +# Phase 29am P0: CorePlan lowerer/verifier “穴埋め” (If/Exit) + +Date: 2025-12-29 +Status: Ready for execution +Scope: `CorePlan::If` / `CorePlan::Exit` の lowerer/verifier を最小実装(仕様不変) + +## Objective + +- `CorePlan` を “構造SSOT” として使っていくために、lowerer が `CorePlan::If` / `CorePlan::Exit` を処理できる状態にする +- 既存の JoinIR/PlanFrag のルーティング順序・観測・エラー文字列(実行経路)は変えない +- CorePlan 単体テストで仕様を固定し、将来の合成(Skeleton+Feature)に備える + +## Non-goals + +- Facts/Planner/Normalizer の挙動変更(どのプランを採用するかは変えない) +- 既存プログラムの意味論変更(quick / joinir regression gate は不変) +- 新 env var 追加 +- 大規模リファクタ(最小差分) + +## Implementation (critical order) + +### Step 1: lowerer の未対応分岐を削る(If/Exit) + +Target: +- `src/mir/builder/control_flow/plan/lowerer.rs` + +Work: +- `CorePlan::If(CoreIfPlan)` を lower できるようにする +- `CorePlan::Exit(CoreExitPlan)` を lower できるようにする + +Rules (SSOT): +- effect/再順序は `docs/development/current/main/design/effect-classification-ssot.md` に従う +- cleanup/exit 境界は `docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md` に従う +- 既存の emit/merge は再解析しない(CorePlan 入力だけで完結) + +Notes: +- まず “standalone” 実装でよい(Loop の内部に入る複合ケースは P1+ に回す) +- 可能なら `PlanVerifier` が落ちる条件(不変条件違反)を先に追加して fail-fast に寄せる + +### Step 2: verifier の不変条件を最小追加 + +Target: +- `src/mir/builder/control_flow/plan/verifier.rs` + +Work: +- `CoreIfPlan` の最小不変条件(then/else の空、Exit の位置、など)を追加 +- `CoreExitPlan` の最小不変条件(loop 外の Break/Continue 禁止、など)を追加 + +### Step 3: 単体テストで仕様固定 + +Target (例): +- `src/mir/builder/control_flow/plan/verifier.rs` の tests +- または `src/mir/builder/control_flow/plan/lowerer.rs` の tests(既存の流儀に合わせる) + +Tests (minimum): +- `CorePlan::Exit(Return)` が lower/verify できる +- `CorePlan::If` が lower/verify できる(then/else の片側だけ、両側、など) +- 不変条件違反は fail-fast(Err)になる + +## Verification (required) + +- `cargo build --release` +- `./tools/smokes/v2/run.sh --profile quick` +- `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` + +## Commit + +- `git add -A` +- `git commit -m "phase29am(p0): implement coreplan if/exit lowering"` + diff --git a/docs/development/current/main/phases/phase-29am/README.md b/docs/development/current/main/phases/phase-29am/README.md new file mode 100644 index 00000000..63bc7599 --- /dev/null +++ b/docs/development/current/main/phases/phase-29am/README.md @@ -0,0 +1,22 @@ +--- +Status: Active +Scope: CorePlan 実装準備(lowerer/verifier の穴埋め、仕様不変で段階導入) +Related: +- docs/development/current/main/design/coreplan-migration-roadmap-ssot.md +- docs/development/current/main/design/effect-classification-ssot.md +- docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md +- docs/development/current/main/phases/phase-29ae/README.md +--- + +# Phase 29am: CorePlan Step-A implementation (lowerer/verifier) + +Goal: CorePlan で“組み立てる”移行を進める前に、`CorePlan` の語彙が単独でも lower/verify できる状態へ近づける。 + +SSOT 道筋: `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md` + +## P0: Implement CorePlan::If / CorePlan::Exit lowering (minimal) + +- 指示書: `docs/development/current/main/phases/phase-29am/P0-COREPLAN-LOWERER-IF-EXIT-INSTRUCTIONS.md` +- ねらい: 既存のルーティング/観測を変えずに、CorePlan 側の “未対応エラー” を減らす(仕様不変) +- Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` +