docs(phase29an): add p4 loop facts ssot tightening

This commit is contained in:
2025-12-29 18:18:27 +09:00
parent aa8c12bcf1
commit d114117a36
4 changed files with 97 additions and 6 deletions

View File

@ -2,11 +2,16 @@
## Current Focus: Phase 29anSkeleton/Feature Facts
Next: Phase 29an P3Freeze taxonomy: unstructured tag
Next: Phase 29an P4LoopFacts require skeleton/features
運用ルール: 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 P3 完了**
- 目的: Freeze taxonomy の `unstructured` タグをコード語彙へ追加(未使用のまま、仕様不変)
- 変更: `src/mir/builder/control_flow/plan/planner/freeze.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 P2 完了**
- 目的: planner を Skeleton→Feature→CandidateSet の段取りへ整理(候補/順序/挙動は不変)
- 変更: `src/mir/builder/control_flow/plan/planner/build.rs`

View File

@ -0,0 +1,73 @@
---
Status: Active
Scope: code仕様不変、Facts 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/phases/phase-29ae/README.md
---
# Phase 29an P4: LoopFacts で Skeleton/Feature を必須にするSSOT引き締め、仕様不変
Date: 2025-12-29
Status: Ready for execution
Scope: Facts の型を “使う側が迷わない” 形に寄せる(挙動不変)
## Objective
- `LoopFacts``Ok(Some(_))` になった時点で、**Skeleton と Feature は必ず揃っている** という SSOT をコードの型で固定する
- P5Skeleton 一意化 / Feature 合成)に向けて、`Option` 剥がしの散在を防ぐ
## Non-goals
- ルーティング順序・観測・エラー文字列の変更
- `Ok(None)` の gate を緩めるfeatures/skeleton だけで Some にしない)
- 新 env var / 恒常ログ追加
## Implementation
### Step 1: LoopFacts のフィールドを必須化
Update:
- `src/mir/builder/control_flow/plan/facts/loop_facts.rs`
Change:
- `pub skeleton: Option<SkeletonFacts>``pub skeleton: SkeletonFacts`
- `pub features: Option<LoopFeatureFacts>``pub features: LoopFeatureFacts`
Rules:
- `has_any == false` のときは従来どおり `Ok(None)`(ここは絶対に変えない)
- `has_any == true` のときは必ず skeleton/features を構築する
- `try_extract_loop_skeleton_facts(...)``None` を返したら `Freeze::bug(...)`(到達してはいけない)
### Step 2: skeleton/features の構築を “has_any の後” に固定
`try_build_loop_facts_inner()` 内で:
- pattern facts 抽出 → `has_any` 判定 → `skeleton` / `features` 抽出 → `Ok(Some(LoopFacts{...}))`
### Step 3: planner/build.rs の unit test を機械的に更新
Update:
- `src/mir/builder/control_flow/plan/planner/build.rs`
`LoopFacts { ... }` のテスト構築に:
- `skeleton: SkeletonFacts { kind: SkeletonKind::Loop }`
- `features: LoopFeatureFacts::default()`
を追加する(既存テストの意図は変えない)。
### Step 4: “SSOT不変条件” の最小テストを 1 本追加
Add in `src/mir/builder/control_flow/plan/facts/loop_facts.rs`:
- pattern facts が 1 つでも取れた場合、`LoopFacts.skeleton.kind == Loop` が成立する
- `LoopFacts.features.exit_usage` がデフォルトでも存在する(`Option` ではないことの固定)
## 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(p4): require skeleton/features in loop facts"`

View File

@ -42,7 +42,20 @@ Status: ✅ COMPLETE実装コミット: `f866badb3`
## Nextplanned
- P3: Freeze taxonomy`unstructured`)をコード語彙へ追加して SSOT 整合(まずは未使用の足場)
- 指示書: `docs/development/current/main/phases/phase-29an/P3-FREEZE-UNSTRUCTURED-TAG-SSOT-INSTRUCTIONS.md`
- P4: Skeleton 一意化0/1/2+ → None/Some/Freezeを “骨格推論” に限定して SSOT 化
- P5: Feature 合成ExitMap / ValueJoin / Cleanupを CorePlan 合成へ繋ぐ
## P3: Add Freeze tag `unstructured` (taxonomy alignment)
- 指示書: `docs/development/current/main/phases/phase-29an/P3-FREEZE-UNSTRUCTURED-TAG-SSOT-INSTRUCTIONS.md`
- ねらい: taxonomy SSOT とコード語彙を一致(まずは未使用の足場)
Status: ✅ COMPLETE実装コミット: `aa8c12bcf`
## P4: Require Skeleton/Feature in LoopFacts (type-level SSOT)
- 指示書: `docs/development/current/main/phases/phase-29an/P4-LOOPFACTS-REQUIRE-SKELETON-FEATURES-INSTRUCTIONS.md`
- ねらい: LoopFacts が Some のとき、Skeleton/Feature は必ず揃っているOption剥がしの散在を止める
- 重要: `Ok(None)` gate は不変
## Nextplanned
- P5: Skeleton 一意化0/1/2+ → None/Some/Freezeを “骨格推論” に限定して SSOT 化
- P6: Feature 合成ExitMap / ValueJoin / Cleanupを CorePlan 合成へ繋ぐ