From fceae90f634a9d6a815472338ba294bd05b311d5 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Mon, 29 Dec 2025 17:20:41 +0900 Subject: [PATCH] docs(phase29an): start skeleton/feature facts phase --- CURRENT_TASK.md | 7 +- docs/development/current/main/10-Now.md | 9 ++- docs/development/current/main/30-Backlog.md | 11 ++- .../design/coreplan-migration-roadmap-ssot.md | 7 +- .../current/main/phases/phase-29am/README.md | 8 ++- .../P0-SKELETONFACTS-SSOT-INSTRUCTIONS.md | 71 +++++++++++++++++++ .../current/main/phases/phase-29an/README.md | 27 +++++++ 7 files changed, 130 insertions(+), 10 deletions(-) create mode 100644 docs/development/current/main/phases/phase-29an/P0-SKELETONFACTS-SSOT-INSTRUCTIONS.md create mode 100644 docs/development/current/main/phases/phase-29an/README.md diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index 6e6be0c9..bdc06f97 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -18,8 +18,8 @@ Scope: Repo root の旧リンク互換。現行の入口は `docs/development/cu **CorePlan migration 道筋 SSOT** `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md` が移行タスクの Done 判定の入口。 -**Next implementation (CorePlan Step-A)** -`docs/development/current/main/phases/phase-29am/P0-COREPLAN-LOWERER-IF-EXIT-INSTRUCTIONS.md` +**Next implementation (CorePlan Step-B / Facts SSOT)** +`docs/development/current/main/phases/phase-29an/P0-SKELETONFACTS-SSOT-INSTRUCTIONS.md` **2025-12-29: Phase 29am P0 COMPLETE (CorePlan If/Exit lowerer/verifier)** CorePlan の If/Exit を lowerer/verifier で扱えるようにして、CorePlan 移行の土台を作った。 @@ -30,6 +30,9 @@ CoreLoopPlan.body の `Seq([Effect...])` を再帰で flatten して emit でき **2025-12-29: Phase 29am P2 COMPLETE (Verifier: Loop.body Effect-only)** Loop.body に If/Exit/Loop が混入したら PlanVerifier で fail-fast([V12])。Seq-of-effects は許可。 +**2025-12-29: Phase 29am P3 COMPLETE (Exit alignment: “Exit is last” rule)** +CorePlan 内の Exit の乱用を抑制し、Frag/ExitMap と整合する表現へ寄せた([V11])。 + **PlanRuleOrder SSOT** single_planner の順序/名前 SSOT は `src/mir/builder/control_flow/plan/single_planner/rule_order.rs` に固定。PlannerContext で Pattern1 facts の抑制を開始し、残りの guard/filter は段階移行。 diff --git a/docs/development/current/main/10-Now.md b/docs/development/current/main/10-Now.md index 66aad1af..9bd3916a 100644 --- a/docs/development/current/main/10-Now.md +++ b/docs/development/current/main/10-Now.md @@ -1,12 +1,17 @@ # Self Current Task — Now (main) -## Current Focus: Phase 29am(CorePlan Step-A implementation) +## Current Focus: Phase 29an(Skeleton/Feature Facts) -Next: Phase 29am P3(ExitMap/CoreExitPlan alignment) +Next: Phase 29an P0(SkeletonFacts 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 29am P3 完了** ✅ +- 目的: Exit を “独立ノード増殖” にせず、Frag/ExitMap と整合する表現へ寄せる(仕様不変) +- 変更: `src/mir/builder/control_flow/plan/verifier.rs`([V11]) +- 検証: `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 P2 完了** ✅ - 目的: Loop.body の語彙制約(Effect-only + Seq許可)を verifier に前倒しして fail-fast を局所化 - 変更: `src/mir/builder/control_flow/plan/verifier.rs`([V12]) diff --git a/docs/development/current/main/30-Backlog.md b/docs/development/current/main/30-Backlog.md index da5beb7b..c0381caf 100644 --- a/docs/development/current/main/30-Backlog.md +++ b/docs/development/current/main/30-Backlog.md @@ -8,6 +8,11 @@ Related: ## 直近(JoinIR/selfhost) +- **Phase 29an(active): Skeleton/Feature Facts(SSOT)** + - 入口: `docs/development/current/main/phases/phase-29an/README.md` + - 状況: P0(Ready) + - Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` + - **Phase 29af(✅ COMPLETE): Boundary hygiene / regression entrypoint / carrier layout SSOT** - 入口: `docs/development/current/main/phases/phase-29af/README.md` @@ -35,10 +40,10 @@ Related: - Next: P4(unwind を含む ExitKind 拡張: design only) - 道筋 SSOT: `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md` -- **Phase 29am(candidate): CorePlan Step-A implementation (lowerer/verifier)** +- **Phase 29am(✅ COMPLETE): CorePlan Step-A implementation (lowerer/verifier)** - 入口: `docs/development/current/main/phases/phase-29am/README.md` - - 状況: P0/P1/P2 ✅ 完了 - - Next: P3(ExitMap/CoreExitPlan alignment) + - 状況: P0/P1/P2/P3 ✅ 完了 + - Next: Phase 29an - Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` - **Phase 29ai(candidate): Plan/Frag single-planner(Facts SSOT)** diff --git a/docs/development/current/main/design/coreplan-migration-roadmap-ssot.md b/docs/development/current/main/design/coreplan-migration-roadmap-ssot.md index 21067bae..8fc21c54 100644 --- a/docs/development/current/main/design/coreplan-migration-roadmap-ssot.md +++ b/docs/development/current/main/design/coreplan-migration-roadmap-ssot.md @@ -49,6 +49,9 @@ Related: - `CorePlan::If` / `CorePlan::Exit` の lowerer 対応 - verifier の不変条件を “局所検証” で完結させる +現状: +- ✅ Phase 29am(P0–P3)で “最低限 lower/verify できる語彙” を前倒しで固定済み + ### Step B: Facts を Skeleton+Feature の SSOTへ寄せる 狙い: @@ -58,6 +61,9 @@ Related: やらない: - Facts から emit/merge を助けるための再解析を前提にした “不足した Facts” を作る +直近の入口(SSOT): +- Phase 29an: `docs/development/current/main/phases/phase-29an/README.md` + ### Step C: Planner を「骨格の一意化→特徴付与→Freeze」へ 狙い: @@ -89,4 +95,3 @@ Related: - Facts が complete pattern を増やさず Skeleton+Feature に寄っている - DomainPlan は scan/split/predicate 等の “意図” 以外は CorePlan 合成へ吸収されている - Freeze taxonomy が運用でぶれず、strict/dev の診断が安定タグで追える - diff --git a/docs/development/current/main/phases/phase-29am/README.md b/docs/development/current/main/phases/phase-29am/README.md index df8a37b4..b983752a 100644 --- a/docs/development/current/main/phases/phase-29am/README.md +++ b/docs/development/current/main/phases/phase-29am/README.md @@ -1,6 +1,6 @@ --- -Status: Active -Scope: CorePlan 実装準備(lowerer/verifier の穴埋め、仕様不変で段階導入) +Status: Complete +Scope: CorePlan Step-A(lowerer/verifier の穴埋め、仕様不変で段階導入) Related: - docs/development/current/main/design/coreplan-migration-roadmap-ssot.md - docs/development/current/main/design/effect-classification-ssot.md @@ -35,3 +35,7 @@ SSOT 道筋: `docs/development/current/main/design/coreplan-migration-roadmap-ss - 指示書: `docs/development/current/main/phases/phase-29am/P3-EXITMAP-COREEXIT-ALIGNMENT-INSTRUCTIONS.md` - ねらい: CorePlan 内で `Exit` を “独立ノード” として増やさず、Frag/ExitMap と整合する表現へ寄せる(仕様不変) + +## Next + +- Phase 29an(Skeleton/Feature Facts)へ進む: `docs/development/current/main/phases/phase-29an/README.md` diff --git a/docs/development/current/main/phases/phase-29an/P0-SKELETONFACTS-SSOT-INSTRUCTIONS.md b/docs/development/current/main/phases/phase-29an/P0-SKELETONFACTS-SSOT-INSTRUCTIONS.md new file mode 100644 index 00000000..f4d777ec --- /dev/null +++ b/docs/development/current/main/phases/phase-29an/P0-SKELETONFACTS-SSOT-INSTRUCTIONS.md @@ -0,0 +1,71 @@ +--- +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/planfrag-freeze-taxonomy.md +- docs/development/current/main/phases/phase-29ae/README.md +--- + +# Phase 29an P0: SkeletonFacts SSOT(Loop/If/BranchN/StraightLine) + +Date: 2025-12-29 +Status: Ready for execution +Scope: Facts に Skeleton(骨格)を追加する(未接続、仕様不変) + +## Objective + +- “pattern名で入口分岐” ではなく、**Skeleton → Feature → CorePlan 合成**へ寄せるための Facts SSOT を作る +- planner が “再解析で穴埋め” しないで済むように、骨格の観測/導出を Facts に集約する + +## Non-goals + +- ルーティング順序・観測・エラー文字列の変更 +- 既存の planner/legacy extractor の削除 +- 新 env var / 恒常ログ追加 +- Freeze を増やして gate を壊す(P0 は Ok(None) へ倒す) + +## Implementation + +### Step 1: SkeletonFacts 型を追加(SSOT) + +Add: +- `src/mir/builder/control_flow/plan/facts/skeleton_facts.rs` + +Suggested vocabulary: +- `SkeletonFacts { kind: SkeletonKind, ... }` +- `SkeletonKind::{Loop, If2, BranchN, StraightLine}` + +Notes: +- “BranchN” は match/switch 相当の将来枠(P0 は未使用でもOK) +- いまは **観測の器**が目的。derive は最小でよい + +### Step 2: LoopFacts に “optional skeleton” を接続(未使用) + +Update: +- `src/mir/builder/control_flow/plan/facts/loop_facts.rs` + +Rules: +- 既存の pattern facts 抽出は維持 +- skeleton は `Ok(Some(_))` のときだけ `LoopFacts` に埋め、既定挙動は変えない + +### Step 3: unit tests(最低限) + +Add tests: +- “単純な loop(cond) { ... }” で `SkeletonKind::Loop` が取れる +- “直列だけ” は `Ok(None)` または `SkeletonKind::StraightLine`(どちらかに統一してSSOT化) + +P0 の方針(推奨): +- 既存の導線を壊さないため、`StraightLine` は **Ok(None)** に倒す(plan対象外) + +## Verification (required) + +- `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(p0): add skeleton facts ssot (no wiring)"` + diff --git a/docs/development/current/main/phases/phase-29an/README.md b/docs/development/current/main/phases/phase-29an/README.md new file mode 100644 index 00000000..bd74db7a --- /dev/null +++ b/docs/development/current/main/phases/phase-29an/README.md @@ -0,0 +1,27 @@ +--- +Status: Active +Scope: CorePlan Step-B(Facts を Skeleton+Feature SSOT に寄せる、仕様不変) +Related: +- docs/development/current/main/design/coreplan-migration-roadmap-ssot.md +- docs/development/current/main/design/coreplan-skeleton-feature-model.md +- docs/development/current/main/design/planfrag-ssot-registry.md +- docs/development/current/main/phases/phase-29ae/README.md +--- + +# Phase 29an: Skeleton/Feature Facts (SSOT) + +Goal: Facts を “complete pattern 列挙” ではなく **Skeleton + Feature** として表現できる状態へ寄せ、CorePlan 合成に向けた SSOT の足場を作る(仕様不変)。 + +SSOT 道筋: `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md` + +## P0: Add SkeletonFacts (Loop/If/BranchN/StraightLine) as SSOT (code, no wiring) + +- 指示書: `docs/development/current/main/phases/phase-29an/P0-SKELETONFACTS-SSOT-INSTRUCTIONS.md` +- ねらい: planner/emit が CFG を覗き直さなくても良いよう、骨格(Skeleton)の観測/導出を Facts に集約する +- 重要: **既定挙動は不変**(Ok(None) のまま、既存 planner-first/legacy ルーティングは触らない) +- Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` + +## Next(planned) + +- P1: FeatureFacts の足場(ExitMap / ValueJoin / Cleanup の “材料” を Facts に寄せる、まだ合成しない) +- P2: Planner を Skeleton 一意化 → Feature 付与の形へ寄せる(complete pattern 増殖を止める)