docs(phase29an): add p2 planner staging instructions

This commit is contained in:
2025-12-29 17:45:47 +09:00
parent c7fbcf3c86
commit 8144836995
4 changed files with 100 additions and 3 deletions

View File

@ -2,11 +2,16 @@
## Current Focus: Phase 29anSkeleton/Feature Facts
Next: Phase 29an P1FeatureFacts SSOT
Next: Phase 29an P2Planner staging: Skeleton→Feature
運用ルール: integration filter で phase143_* は回さないJoinIR 回帰は phase29ae pack のみ)
運用ルール: phase286_pattern9_* は legacy pack (SKIP) を使う
移行道筋 SSOT: `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md`
**2025-12-29: Phase 29an P1 完了**
- 目的: FeatureFactsまず ExitUsageを Facts SSOT として追加(仕様不変・未接続)
- 変更: `src/mir/builder/control_flow/plan/facts/feature_facts.rs` / `src/mir/builder/control_flow/plan/facts/loop_facts.rs`
- 検証: `cargo build --release` / `./tools/smokes/v2/run.sh --profile quick` / `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh`
**2025-12-29: Phase 29an P0 完了**
- 目的: SkeletonFactsLoop/If/BranchN/StraightLineを Facts SSOT として追加(仕様不変・未接続)
- 変更: `src/mir/builder/control_flow/plan/facts/skeleton_facts.rs` / `src/mir/builder/control_flow/plan/facts/loop_facts.rs`

View File

@ -0,0 +1,83 @@
---
Status: Active
Scope: code仕様不変、planner内部の段階移行
Related:
- docs/development/current/main/phases/phase-29an/README.md
- docs/development/current/main/design/coreplan-skeleton-feature-model.md
- docs/development/current/main/design/planfrag-freeze-taxonomy.md
- docs/development/current/main/phases/phase-29ae/README.md
---
# Phase 29an P2: Planner を Skeleton→Feature の “段取り” に寄せる(仕様不変)
Date: 2025-12-29
Status: Ready for execution
Scope: planner の内部構造だけを Skeleton→Feature の段取りへ寄せる(出力/観測は不変)
## Objective
- `build_plan_from_facts_ctx()` を「complete pattern の羅列」から、**Skeleton inference → Feature inference → CandidateSet finalize** の段取りへ寄せる
- ただし P2 は “段取りの導入” が目的で、**挙動は不変**(候補の集合/順序/ログ/エラー文字列を変えない)
## Non-goals
- 新しい Freeze の追加gate を壊さない)
- 既存 candidate の増減や優先順序変更
- single_planner 側のルーティング変更
## Implementationコード
対象(中心):
- `src/mir/builder/control_flow/plan/planner/build.rs`
### Step 1: Planner 内に “段取り” 用ヘルパーを追加
`build.rs` 内でOK新ファイルは任意
提案:
- `fn infer_skeleton_kind(facts: &CanonicalLoopFacts) -> Option<SkeletonKind>`
- `facts.facts.skeleton.as_ref().map(|s| s.kind)`
- `None` の場合は “未知” 扱いP2では gate しない)
- `fn infer_exit_usage(facts: &CanonicalLoopFacts) -> Option<ExitUsageFacts>`
- `facts.facts.features.as_ref().map(|f| f.exit_usage.clone())`
- P2ではまだ候補の増減に使わない観測・将来の feature 合成の足場)
注意:
- skeleton/feature に矛盾があっても `debug_assert!` までFreeze は増やさない)
### Step 2: “候補 push” を分類関数に分割(順序は維持)
`build_plan_from_facts_ctx()` の本体を薄くして、push の順序を関数分割で固定する。
例(順序は今のまま):
- `push_scan_with_init(&mut candidates, facts)`
- `push_split_scan(&mut candidates, facts)`
- `push_pattern2_break(...)`
- `push_pattern3_ifphi(...)`
- `push_pattern4_continue(...)`
- `push_pattern5_infinite_early_exit(...)`
- `push_pattern8_bool_predicate_scan(...)`allow_pattern8 gate維持
- `push_pattern9_accum_const_loop(...)`
- `push_pattern1_simplewhile(...)`allow_pattern1 gate維持
受け入れ:
- ルール文字列(`rule: "loop/..."`)は完全一致のまま
- `allow_pattern1` / `allow_pattern8` の gate は今のまま
### Step 3: unit tests構造固定
追加/更新:
- 既存テストが壊れないこと(テストの LoopFacts 構築はそのまま)
- 新規で 1 本だけ追加(任意):
- skeleton/features を持つ LoopFacts を与えても、候補が変わらない(構造固定)
## Verificationrequired
- `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 "phase29an(p2): stage planner via skeleton/feature inference (no behavior change)"`

View File

@ -30,6 +30,15 @@ Status: ✅ COMPLETE実装コミット: `ea32d61a5`
- 重要: **既定挙動は不変**features だけで Ok(Some) にしない)
- Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh`
Status: ✅ COMPLETE実装コミット: `c7fbcf3c8`
## P2: Planner staging for Skeleton→Feature inference (structure only, behavior preserved)
- 指示書: `docs/development/current/main/phases/phase-29an/P2-PLANNER-SKELETON-FEATURE-STAGING-INSTRUCTIONS.md`
- ねらい: planner の内部構造を Skeleton→Feature→CandidateSet の段取りへ寄せる(候補/順序/挙動は不変)
- Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh`
## Nextplanned
- P2: Planner を Skeleton 一意化 → Feature 付与の形へ寄せるcomplete pattern 増殖を止める)
- P3: Skeleton 一意化0/1/2+ → None/Some/Freezeを “骨格推論” に限定して SSOT 化
- P4: Feature 合成ExitMap / ValueJoin / Cleanupを CorePlan 合成へ繋ぐ