docs(phase29an): add p9 skeleton unification instructions

This commit is contained in:
2025-12-30 03:03:30 +09:00
parent 195b424ccc
commit 3b1cce5715
4 changed files with 91 additions and 7 deletions

View File

@ -2,11 +2,16 @@
## Current Focus: Phase 29anSkeleton/Feature Facts
Next: Phase 29an P8exit_usage invariants, debug-only
Next: Phase 29an P9Skeleton unification inference, unused
運用ルール: 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 P8 完了**
- 目的: exit_usage と DomainPlanPattern1/2/4/5の整合を debug-only で固定release は仕様不変)
- 変更: `src/mir/builder/control_flow/plan/planner/build.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 P7 完了**
- 目的: CanonicalLoopFacts に skeleton/exit_usage の projection を追加(挙動不変)
- 変更: `src/mir/builder/control_flow/plan/normalize/canonicalize.rs` / `src/mir/builder/control_flow/plan/planner/build.rs`

View File

@ -0,0 +1,72 @@
---
Status: Active
Scope: code仕様不変、Skeleton一意化の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/planfrag-freeze-taxonomy.md
- docs/development/current/main/phases/phase-29ae/README.md
---
# Phase 29an P9: Skeleton 一意化0/1/2+ → None/Some/Freezeを Facts 側で SSOT 化(未接続)
Date: 2025-12-29
Status: Ready for execution
Scope: skeleton inference の境界をコードで固定する(未接続、仕様不変)
## Objective
- Skeleton の “一意化” を **Facts 側**で SSOT として固定する
- 0 個 → `Ok(None)`StraightLine: plan対象外
- 1 個 → `Ok(Some(SkeletonFacts))`
- 2 個以上 → `Err(Freeze::unstructured(...))`(複合構造/定義域外)
- 将来の Region planningloop/if/match を入口分岐で増やさないに備え、Skeleton/Feature 合成の前提を固める
## Non-goals
- 既存の routing / planner-first / legacy fallback の変更
- 既存の `try_build_loop_facts*` の gate 変更
- 新 env var / 恒常ログ追加
- “骨格の完全推論” をやり切るP9は境界SSOTが目的。subsetでOK
## Implementation
### Step 1: Region skeleton inference API を追加Facts層SSOT
Update:
- `src/mir/builder/control_flow/plan/facts/skeleton_facts.rs`
Add:
- `pub(in crate::mir::builder) fn infer_region_skeleton_facts(stmts: &[ASTNode]) -> Result<Option<SkeletonFacts>, Freeze>`
Subset rules保守的:
- stmts を走査し、`try_extract_skeleton_facts_from_stmt(stmt)``Some` を返した数を数える
- `skeleton_count == 0``Ok(None)`
- `skeleton_count == 1` → その skeleton を返す(他が straight-line でもOK
- `skeleton_count >= 2``Err(Freeze::unstructured("multiple top-level skeleton statements"))`
Notes:
- “2個以上” を `ambiguous` ではなく `unstructured` にするのが自然複合骨格は単一skeletonではない
### Step 2: unit tests0/1/2+ 境界を固定)
Add tests in `skeleton_facts.rs`:
- empty slice → `Ok(None)`
- `[loop]``Ok(Some(Loop))`
- `[assign, if]``Ok(Some(If2))`
- `[loop, if]``Err(Freeze::unstructured(_))`
### Step 3: wiring はしない(仕様不変)
P9 では `infer_region_skeleton_facts()` を呼び出し側へ配線しない。
## 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(p9): add skeleton unification facts api"`

View File

@ -40,8 +40,6 @@ Status: ✅ COMPLETE実装コミット: `c7fbcf3c8`
Status: ✅ COMPLETE実装コミット: `f866badb3`
## Nextplanned
## P3: Add Freeze tag `unstructured` (taxonomy alignment)
- 指示書: `docs/development/current/main/phases/phase-29an/P3-FREEZE-UNSTRUCTURED-TAG-SSOT-INSTRUCTIONS.md`
@ -78,9 +76,18 @@ Status: ✅ COMPLETE実装コミット: `80c879fdb`
Status: ✅ COMPLETE実装コミット: `5ac2f3586`
## P8: exit_usage invariants (debug-only)
- 指示書: `docs/development/current/main/phases/phase-29an/P8-EXITUSAGE-INVARIANTS-INSTRUCTIONS.md`
- ねらい: exit_usage と DomainPlanPattern1/2/4/5の整合を debug-only で固定release は仕様不変)
Status: ✅ COMPLETE実装コミット: `195b424cc`
## P9: Skeleton unification (0/1/2+ boundary) in Facts (unused, SSOT groundwork)
- 指示書: `docs/development/current/main/phases/phase-29an/P9-SKELETON-UNIFICATION-INFERENCE-INSTRUCTIONS.md`
- ねらい: Skeleton 一意化の境界を Facts 側で SSOT 化(未接続、仕様不変)
## Nextplanned
- P8: exit_usage と DomainPlan の整合を debug-only で固定(再発防止、仕様不変)
- 指示書: `docs/development/current/main/phases/phase-29an/P8-EXITUSAGE-INVARIANTS-INSTRUCTIONS.md`
- P9: Skeleton 一意化0/1/2+ → None/Some/Freezeを “骨格推論” に限定して SSOT 化
- P10: Feature 合成ExitMap / ValueJoin / Cleanupを CorePlan 合成へ繋ぐ