docs(phase29an): add p1 feature facts instructions

This commit is contained in:
2025-12-29 17:35:25 +09:00
parent 94149db61d
commit 134a0d2f7d
4 changed files with 113 additions and 3 deletions

View File

@ -2,11 +2,16 @@
## Current Focus: Phase 29anSkeleton/Feature Facts
Next: Phase 29an P0SkeletonFacts SSOT
Next: Phase 29an P1FeatureFacts SSOT
運用ルール: 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 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`
- 検証: `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 29am P3 完了**
- 目的: Exit を “独立ノード増殖” にせず、Frag/ExitMap と整合する表現へ寄せる(仕様不変)
- 変更: `src/mir/builder/control_flow/plan/verifier.rs`[V11]

View File

@ -0,0 +1,97 @@
---
Status: Active
Scope: code仕様不変、未接続のSSOT足場
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/exitkind-cleanup-effect-contract-ssot.md
- docs/development/current/main/phases/phase-29ae/README.md
---
# Phase 29an P1: FeatureFacts SSOTExitMap/ValueJoin/Cleanup の材料)
Date: 2025-12-29
Status: Ready for execution
Scope: Facts に “Feature特徴” の材料を追加する(未接続、仕様不変)
## Objective
- “complete pattern 列挙” を増やさず、**Skeleton に直交する Feature** を Facts 側へ寄せる足場を作る
- まずは最小の **ExitUsagebreak/continue/return の存在)** を SSOT として定義し、将来の ExitMap 合成へ繋げる
## Non-goals
- ルーティング順序・観測・エラー文字列の変更
- 既存 planner-first/legacy extractor の削除
- 新 env var / 恒常ログ追加
- “対象っぽいのに不整合” を Ok(None) で隠すP1 は **Freeze を増やさない**
## Implementation構造優先
### Step 1: FeatureFacts 型を追加SSOT
Add:
- `src/mir/builder/control_flow/plan/facts/feature_facts.rs`
Suggested vocabulary最小・後拡張可能:
- `LoopFeatureFacts`
- `exit_usage: ExitUsageFacts`(実装する)
- `value_join: Option<ValueJoinFacts>`P1 は placeholder = `None`
- `cleanup: Option<CleanupFacts>`P1 は placeholder = `None`
- `ExitUsageFacts { has_break, has_continue, has_return }`
Extraction保守的:
- `break/continue/return` の **存在**だけ見る(位置/対応付けは P2+
- ネストした loop の exit は外側に数えない(外側の ExitMap を誤推論しない)
- `if` の then/else の中は再帰で見る(ただし “未知ノード” は無視)
方針:
- `ExitUsageFacts``Default` を持ち、使う側が簡単に埋められるようにする
- ここは **Facts層**なので、Plan/Frag/emit を import しない
### Step 2: facts/mod.rs に module 登録
Update:
- `src/mir/builder/control_flow/plan/facts/mod.rs`
Add:
- `pub(in crate::mir::builder) mod feature_facts;`
### Step 3: LoopFacts に optional で接続(既定挙動は不変)
Update:
- `src/mir/builder/control_flow/plan/facts/loop_facts.rs`
Add:
- `pub features: Option<LoopFeatureFacts>`
Rules:
- `Ok(None)` の gate“何も取れないなら None”**そのまま**
- 既存の pattern facts が 1 つでも取れた場合だけ `features: Some(...)` を埋める
- “features だけ取れた” で `Ok(Some)` にしない(既定挙動を変えない)
### Step 4: planner/build.rs の unit tests を調整
Update:
- `src/mir/builder/control_flow/plan/planner/build.rs`
If tests construct `LoopFacts` directly, add:
- `features: None`(または `Some(LoopFeatureFacts::default())` を許可するならそれでもよいが、P1 は `None` 推奨)
## Tests最低限
Add unit tests:
- `break/continue/return` が loop bodyif を含む)にあると `ExitUsageFacts` が立つ
- nested loop 内の break/continue は外側の `ExitUsageFacts` に影響しない
## 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(p1): add loop feature facts ssot (exit usage)"`

View File

@ -21,7 +21,15 @@ SSOT 道筋: `docs/development/current/main/design/coreplan-migration-roadmap-ss
- 重要: **既定挙動は不変**Ok(None) のまま、既存 planner-first/legacy ルーティングは触らない)
- Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh`
Status: ✅ COMPLETE実装コミット: `ea32d61a5`
## P1: Add FeatureFacts (ExitMap/ValueJoin/Cleanup materials) as SSOT (code, no wiring)
- 指示書: `docs/development/current/main/phases/phase-29an/P1-FEATUREFACTS-SSOT-INSTRUCTIONS.md`
- ねらい: Skeleton に直交する “特徴” を Facts に寄せ、complete pattern 増殖を止める(まずは ExitUsage から)
- 重要: **既定挙動は不変**features だけで Ok(Some) にしない)
- Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh`
## Nextplanned
- P1: FeatureFacts の足場ExitMap / ValueJoin / Cleanup の “材料” を Facts に寄せる、まだ合成しない)
- P2: Planner を Skeleton 一意化 → Feature 付与の形へ寄せるcomplete pattern 増殖を止める)