docs(phase29al): ssot skeleton/feature model; planfrag freeze tag

This commit is contained in:
2025-12-29 16:01:26 +09:00
parent 14013cbe1f
commit bf9a63c53f
8 changed files with 183 additions and 3 deletions

View File

@ -1,11 +1,15 @@
# Self Current Task — Now (main)
## Current Focus: Phase 29akPlanRuleOrder + PlannerContext
## Current Focus: Phase 29alCorePlan composition hardening / docs-first
Next: Phase 29ak P6TBD
Next: Phase 29al P1post-phi final form SSOT
運用ルール: integration filter で phase143_* は回さないJoinIR 回帰は phase29ae pack のみ)
運用ルール: phase286_pattern9_* は legacy pack (SKIP) を使う
**2025-12-29: Phase 29al P0 完了**
- 目的: Skeleton/Feature model を SSOT 化し、「通らない/危険」形を Freeze taxonomy に落とす(仕様不変)
- SSOT: `docs/development/current/main/design/coreplan-skeleton-feature-model.md`
**2025-12-29: Phase 29ak P5 完了**
- 目的: planner の candidate gate を SSOT 化し、single_planner の Pattern1 抑制を撤去(仕様不変)
- 実装: `src/mir/builder/control_flow/plan/planner/build.rs` / `src/mir/builder/control_flow/plan/planner/outcome.rs` / `src/mir/builder/control_flow/plan/single_planner/rules.rs`

View File

@ -27,7 +27,12 @@ Related:
- **Phase 29akcandidate: PlanRuleOrder SSOT + PlannerContext plumbing**
- 入口: `docs/development/current/main/phases/phase-29ak/README.md`
- 状況: P0/P1/P2/P3/P4/P5 ✅ 完了
- Next: Phase 29ak P6TBD
- Next: Nonephase-29al へ
- **Phase 29alcandidate: CorePlan composition hardening (docs-first)**
- 入口: `docs/development/current/main/phases/phase-29al/README.md`
- 状況: P0 ✅ 完了docs-only
- Next: P1post-phi final form SSOT/ P2effect classification SSOT
- **Phase 29aicandidate: Plan/Frag single-plannerFacts SSOT**
- 入口: `docs/development/current/main/phases/phase-29ai/README.md`

View File

@ -0,0 +1,100 @@
---
Status: SSOT
Scope: Facts→Planner→(DomainPlan→CorePlan) の「非重複」設計JoinIR/Plan/Frag
Related:
- docs/development/current/main/design/planfrag-ssot-registry.md
- docs/development/current/main/design/planfrag-freeze-taxonomy.md
- docs/development/current/main/design/joinir-plan-frag-ssot.md
- docs/development/current/main/design/join-explicit-cfg-construction.md
---
# CorePlan Skeleton/Feature Model (SSOT)
目的: “pattern 列挙の重なり” を増やさずに、Facts→Planner→CorePlan を **一意・合成可能**な形に収束させる。
結論:
- **CorePlan は構造SSOT**emit/merge は CorePlan/Frag 以外を再解析しない)
- **DomainPlan は意図recipe**長期的に縮む。SSOTは CorePlan 側に寄せる)
- “Pattern” は入口の分岐名ではなく、**(Skeleton, FeatureSet)** の合成へ落とす
## 1. Skeleton骨格= まず一意に決める
Skeleton は “構造カテゴリ” のみ。ここが一意に決まらない場合は `Freeze` の対象。
推奨の最小集合:
- `LoopSkeleton`(自然ループ: header/latch/exit が確定できる)
- `If2Skeleton`2分岐 + join
- `BranchNSkeleton`match/switch 相当: N分岐 + join
- `StraightLine`plan 対象外 → `Ok(None)`
## 2. Features直交特徴= 骨格の上に足す
Features は “別パターン” を増やさずに足す(重なりの根治)。
例(代表):
- `ExitMap`Return/Break/Continue の出口集合。Pattern2/4/5 を “別pattern” にしない)
- `ValueJoin`join 値が必要 = post-phi 表現)
- `ContinueEdges`continue が複数箇所から飛ぶ等。latch 一意に拘らない表現)
- `Cleanup`return/break/continue で走る cleanup。将来 `Unwind` も同語彙へ)
- `CondShape` / `StepShape`normalize 済みの “形”)
- `AlgorithmIntent`scan/split/predicate 等のアルゴリズム意図: DomainPlan に残して良い)
## 3. FreezeFail-Fastにすべき “要注意パターン”
“通らない” または “通るが設計が壊れやすい” を SSOT として明示する。
### A. Unstructured CFGIrreducible / multi-entry loop
症状:
- Skeleton が一意に決まらない(複数入口ループ / irreducible
扱い:
- `Freeze(unstructured)`strict/dev は即Fail
- 既定挙動を変えない場合は `Ok(None)` に落とすのも可だが、strict/dev では **タグ付きで理由を観測**する
### B. Unwind / 例外 / finally“別系統の出口エッジ”
症状:
- Return/Break/Continue 以外の出口unwindで cleanup が必要になる
扱い:
- 設計として `ExitKind::Unwind` を想定し、`ExitMap + Cleanup` で吸収できることを前提にする
- 未実装の段階では `Freeze(unsupported:unwind)`“対象っぽいのにNone” にしない)
### C. Coroutine / async generatoryield
症状:
- 関数内で制御が閉じないskeleton だけでは表現できない)
扱い:
- `Freeze(unsupported:coroutine)`(将来は別 Skeleton/別パイプライン)
### D. 多分岐matchを If2 で潰そうとする
症状:
- planner が肥大化し、normalize が崩れるpattern 爆発の起点)
扱い:
- `BranchNSkeleton` を設計語彙として追加し、normalize で分岐順序を安定化する
### E. “plan が JoinIR 専用パターンを飲み込む” 事故
実例:
- nested loopphase1883が plan 側の Pattern1 に誤マッチして JoinIR の `Pattern6NestedLoopMinimal` が選ばれない
扱い:
- “より一般的な pattern” は **上位形nested loop 等)を `Ok(None)` へ倒す**pattern 側の責務)
- 入口での by-name 分岐ではなく、Facts/Extractor の **構造条件**で遮断する
## 4. SSOT 運用ルール(設計側の約束)
- Planner は “骨格推論→特徴推論” を意識して実装し、complete pattern 追加を最小化する
- Emit は CorePlan 以外を見ない(再解析禁止)
- `Ok(None)` / `Freeze` の境界は `docs/.../planfrag-freeze-taxonomy.md` を SSOT として従う
## 5. Next (docs-first)
次に SSOT として固める候補(レバレッジ順):
1. post-phijoin 入力の最終表現)不変条件(局所 verify
2. effect 分類pure/control/rc/obsと “許される変形” の法典

View File

@ -29,6 +29,8 @@ Scope: Facts → Plan仕様不変
- 形が契約を破っている(例: 必須 step が欠落、join 入力の整合が崩れている)
- `plan/freeze:ambiguous`
- 複数候補が成立し、一意化できない(将来のルール追加で解消される可能性がある)
- `plan/freeze:unstructured`
- Skeleton が確定できないirreducible CFG / multi-entry loop など、構造化CFGの定義域外
- `plan/freeze:unsupported`
- 一意に判定できるが、未実装で扱えない(“未対応” を誤って None にしない)
- `plan/freeze:bug`
@ -47,3 +49,4 @@ Scope: Facts → Plan仕様不変
- Entry: `docs/development/current/main/phases/phase-29ai/README.md`
- Plan/Frag overview: `docs/development/current/main/design/edgecfg-fragments.md`
- Pattern6/7 contracts: `docs/development/current/main/design/pattern6-7-contracts.md`
- CorePlan Skeleton/Feature model: `docs/development/current/main/design/coreplan-skeleton-feature-model.md`

View File

@ -26,3 +26,4 @@ Scope: JoinIR plan/frag 導線(仕様不変)
- Entry: `docs/development/current/main/phases/phase-29ai/README.md`
- Plan/Frag overview: `docs/development/current/main/design/edgecfg-fragments.md`
- Pattern6/7 contracts: `docs/development/current/main/design/pattern6-7-contracts.md`
- CorePlan Skeleton/Feature model: `docs/development/current/main/design/coreplan-skeleton-feature-model.md`

View File

@ -0,0 +1,34 @@
---
Status: Active
Scope: docs-only仕様不変
Related:
- docs/development/current/main/phases/phase-29al/README.md
- docs/development/current/main/design/coreplan-skeleton-feature-model.md
- docs/development/current/main/design/planfrag-ssot-registry.md
- docs/development/current/main/design/planfrag-freeze-taxonomy.md
---
# Phase 29al P0: Skeleton/Feature SSOTdocs-only
Date: 2025-12-29
Status: Completedocs-only
Scope: 設計SSOTの追加・導線固定コード変更なし
## Objective
- “pattern が重なる” 問題を、実装テクではなく **設計の約束SSOT**で根治する
- Facts→Planner→(DomainPlan→CorePlan) を **骨格→特徴→合成**として説明できる状態にする
- “通らない/危険な形” を Freeze taxonomy に落とし、`Ok(None)` との境界を揺らさない
## Deliverables
- `docs/development/current/main/design/coreplan-skeleton-feature-model.md`SSOT
- `docs/development/current/main/design/planfrag-ssot-registry.md` に参照追加
- `docs/development/current/main/design/planfrag-freeze-taxonomy.md``plan/freeze:unstructured` を追加
## Non-goals
- コード変更
- 新しい env var / 新しい恒常ログ
- 新規パターン追加や互換性変更

View File

@ -0,0 +1,30 @@
---
Status: Active
Scope: JoinIR / PlanFrag “仕上げ”の設計SSOT仕様不変
Related:
- docs/development/current/main/design/coreplan-skeleton-feature-model.md
- docs/development/current/main/design/planfrag-ssot-registry.md
- docs/development/current/main/design/planfrag-freeze-taxonomy.md
- docs/development/current/main/design/joinir-plan-frag-ssot.md
---
# Phase 29al: CorePlan composition hardening (docs-first)
Goal: “pattern が重なる/増殖する” を設計で根治し、JoinIR/PlanFrag を **美しく閉じる**ための SSOT を揃える。
## P0: Skeleton/Feature model SSOTdocs-only
- 指示書: `docs/development/current/main/phases/phase-29al/P0-SKELETON-FEATURE-SSOT-INSTRUCTIONS.md`
- ねらい: “骨格→特徴→合成” を SSOT として固定し、通らない/危険なパターンも Freeze taxonomy に落とす
- 成果: `docs/development/current/main/design/coreplan-skeleton-feature-model.md`
## Next (planned)
### P1: post-phijoin 入力の最終表現SSOT
- ねらい: join 値の “最終表現” と “局所 verify” の不変条件を SSOT 化するemit/merge の再解析禁止を強化)
### P2: effect classification SSOT
- ねらい: pure/control/rc/observability などの効果分類と、許される変形(最適化/RC挿入/DCEを法典化する