From 6a2a0061ecf21550b42de0792df971199c45f263 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Tue, 30 Dec 2025 09:20:24 +0900 Subject: [PATCH] docs(phase29ao): add coreloop exitmap composition ssot (p20) --- CURRENT_TASK.md | 9 +- docs/development/current/main/10-Now.md | 8 +- docs/development/current/main/30-Backlog.md | 4 +- .../coreloop-exitmap-composition-ssot.md | 83 +++++++++++++++++++ .../main/design/planfrag-ssot-registry.md | 1 + .../current/main/phases/phase-29ao/README.md | 8 +- 6 files changed, 104 insertions(+), 9 deletions(-) create mode 100644 docs/development/current/main/design/coreloop-exitmap-composition-ssot.md diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index 84f3020f..999b66ce 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -18,9 +18,12 @@ Scope: Repo root の旧リンク互換。現行の入口は `docs/development/cu **CorePlan migration 道筋 SSOT** `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md` が移行タスクの Done 判定の入口。 -**Next implementation (Phase 29ao P20)** -- 目的: Skeleton+Feature→CoreLoop へ寄せるための ExitMap 合成規約を docs-first で固める -- 指示書: `docs/development/current/main/phases/phase-29ao/P20-CORELOOP-EXITMAP-COMPOSITION-SSOT-INSTRUCTIONS.md` +**Next implementation (Phase 29ao P21)** +- 目的: TBD +- 指示書: TBD + +**2025-12-30: Phase 29ao P20 COMPLETE (CoreLoop ExitMap composition SSOT)** +CoreLoop の ExitMap/Cleanup/ValueJoin 合成規約を SSOT 化し、合成境界と Fail-Fast ルールを固定した(docs-only)。 **2025-12-29: Phase 29am P0 COMPLETE (CorePlan If/Exit lowerer/verifier)** CorePlan の If/Exit を lowerer/verifier で扱えるようにして、CorePlan 移行の土台を作った。 diff --git a/docs/development/current/main/10-Now.md b/docs/development/current/main/10-Now.md index 3185c240..b3ed49f8 100644 --- a/docs/development/current/main/10-Now.md +++ b/docs/development/current/main/10-Now.md @@ -2,12 +2,16 @@ ## Current Focus: Phase 29ao(CorePlan composition) -Next: Phase 29ao P20(CoreLoop ExitMap composition docs-first) -指示書: `docs/development/current/main/phases/phase-29ao/P20-CORELOOP-EXITMAP-COMPOSITION-SSOT-INSTRUCTIONS.md` +Next: Phase 29ao P21(TBD) +指示書: TBD 運用ルール: integration filter で phase143_* は回さない(JoinIR 回帰は phase29ae pack のみ) 運用ルール: phase286_pattern9_* は legacy pack (SKIP) を使う 移行道筋 SSOT: `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md` +**2025-12-30: Phase 29ao P20 完了** ✅ +- 目的: CoreLoop の ExitMap/Cleanup/ValueJoin 合成規約を SSOT 化(docs-only) +- 変更: `docs/development/current/main/design/coreloop-exitmap-composition-ssot.md` / `docs/development/current/main/design/planfrag-ssot-registry.md` / `docs/development/current/main/phases/phase-29ao/README.md` / `docs/development/current/main/10-Now.md` / `docs/development/current/main/30-Backlog.md` / `CURRENT_TASK.md` + **2025-12-30: Phase 29ao P19 完了** ✅ - 目的: regression gate に Pattern1 strict/dev shadow adopt を含め、回帰で必ず踏む(SSOT化) - 変更: `tools/smokes/v2/profiles/integration/joinir/phase29ao_pattern1_strict_shadow_vm.sh` / `tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` / `docs/development/current/main/phases/phase-29ae/README.md` diff --git a/docs/development/current/main/30-Backlog.md b/docs/development/current/main/30-Backlog.md index 7fa99699..236e8c6d 100644 --- a/docs/development/current/main/30-Backlog.md +++ b/docs/development/current/main/30-Backlog.md @@ -15,8 +15,8 @@ Related: - **Phase 29ao(active): CorePlan composition from Skeleton/Feature** - 入口: `docs/development/current/main/phases/phase-29ao/README.md` - - 状況: P0–P19 ✅ 完了 / Next: P20(CoreLoop ExitMap composition docs-first) - - Next 指示書: `docs/development/current/main/phases/phase-29ao/P20-CORELOOP-EXITMAP-COMPOSITION-SSOT-INSTRUCTIONS.md` + - 状況: P0–P20 ✅ 完了 / Next: P21(TBD) + - Next 指示書: TBD - **Phase 29af(✅ COMPLETE): Boundary hygiene / regression entrypoint / carrier layout SSOT** - 入口: `docs/development/current/main/phases/phase-29af/README.md` diff --git a/docs/development/current/main/design/coreloop-exitmap-composition-ssot.md b/docs/development/current/main/design/coreloop-exitmap-composition-ssot.md new file mode 100644 index 00000000..bf159cad --- /dev/null +++ b/docs/development/current/main/design/coreloop-exitmap-composition-ssot.md @@ -0,0 +1,83 @@ +--- +Status: SSOT +Scope: CoreLoop(Loop skeleton)に対する ExitMap/Cleanup/ValueJoin の合成規約 +Related: +- 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/design/post-phi-final-form-ssot.md +- docs/development/current/main/design/edgecfg-fragments.md +- docs/development/current/main/design/planfrag-freeze-taxonomy.md +- docs/development/current/main/design/coreplan-migration-roadmap-ssot.md +--- + +# CoreLoop ExitMap Composition (SSOT) + +目的: Loop skeleton に ExitMap/Cleanup/ValueJoin を合成する規約を 1 枚に固定し、Normalizer/Composer/Emit の責務境界を揺らさない。 + +## 1. Vocabulary(語彙) + +- **ExitKind**: `Return` / `Break(loop_id)` / `Continue(loop_id)`(将来 `Unwind`) +- **ExitMap presence**: +- `exit_kinds_present` は “存在集合” の SSOT(Facts/Canonical の投影) + - `Frag.exits` は “出口エッジ” の SSOT(presence と実エッジを同じ語彙で扱う) +- **Cleanup presence**: + - `cleanup_kinds_present` は ExitKind 語彙として扱う + - cleanup の意味論は `exitkind-cleanup-effect-contract-ssot.md` に従う +- **ValueJoin**: + - join 値は `Frag.block_params` と `EdgeArgs(values)` で表現する + - `EdgeArgs.layout` は `post-phi-final-form-ssot.md` の SSOT に従う + +## 2. Composition Rules(合成規約) + +### 2.1 ExitMap presence の投影 + +- `exit_kinds_present` を `Frag.exits` に投影する(presence を SSOT 化) +- presence は “実エッジの有無” を保証しない(後段で edge を作る責務は Normalizer/Composer) +- emit/merge が CFG/AST を再解析して exit を推測するのは禁止 + +### 2.2 Exit edges(実エッジ)の責務 + +- `Continue(loop_id)` は header へ、`Break(loop_id)` は after へ配線する +- `Return`/`Unwind` は外側へ伝搬する(Loop 内で勝手に消費しない) +- ループ内で “exit edge を増やす” ことはせず、`Frag.exits` を入口 SSOT として扱う + +### 2.3 Cleanup + +- cleanup は ExitKind の語彙に属する(pattern 固有の挿入は禁止) +- 合成は `compose::cleanup` を唯一の入口にする +- cleanup の前後関係は `exitkind-cleanup-effect-contract-ssot.md` に従う + +### 2.4 ValueJoin + +- join 値が必要な場合、`Frag.block_params` を必ず使う(PHI の暗黙推論は禁止) +- `EdgeArgs.layout` は join 入力の順序SSOTで固定する +- `emit_frag()` が PHI 挿入の唯一の接続点(他の層で PHI を作らない) + +### 2.5 責務境界(Fail-Fast を前提にする) + +- Facts: presence まで(edge/PHI を作らない) +- Normalizer/Composer: `Frag` と `block_params` を作る +- Emit: `Frag` の情報をそのまま PHI/terminator に落とす(再推論禁止) + +## 3. Fail-Fast / Verify(SSOT) + +- **Ok(None)**: + - Skeleton が Loop でない / 対象外(StraightLine 等) +- **Freeze(unstructured)**: + - Loop skeleton が一意に決まらない(irreducible / multi-entry) +- **Freeze(unsupported)**: + - `Unwind` 等、ExitKind 語彙はあるが現実装が扱えない +- **Freeze(contract)**: + - `exit_kinds_present` と `Frag.exits` が矛盾する + - `Frag.block_params` と `EdgeArgs.layout/values` が整合しない + +検証の入口: +- `planfrag-freeze-taxonomy.md` のタグを使用(strict/dev で Fail-Fast) +- `edgecfg-fragments.md` の `verify_*` を通す(release は挙動不変) + +## 4. References(入口) + +- CorePlan Skeleton/Feature model: `docs/development/current/main/design/coreplan-skeleton-feature-model.md` +- ExitKind/Cleanup contract: `docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md` +- Post-PHI final form: `docs/development/current/main/design/post-phi-final-form-ssot.md` +- EdgeCFG/Frag SSOT: `docs/development/current/main/design/edgecfg-fragments.md` diff --git a/docs/development/current/main/design/planfrag-ssot-registry.md b/docs/development/current/main/design/planfrag-ssot-registry.md index c9a91ff9..5a751d49 100644 --- a/docs/development/current/main/design/planfrag-ssot-registry.md +++ b/docs/development/current/main/design/planfrag-ssot-registry.md @@ -30,3 +30,4 @@ Scope: JoinIR plan/frag 導線(仕様不変) - Post-PHI final form SSOT: `docs/development/current/main/design/post-phi-final-form-ssot.md` - Effect classification SSOT: `docs/development/current/main/design/effect-classification-ssot.md` - ExitKind/Cleanup/Effect contract SSOT: `docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md` +- CoreLoop ExitMap composition SSOT: `docs/development/current/main/design/coreloop-exitmap-composition-ssot.md` diff --git a/docs/development/current/main/phases/phase-29ao/README.md b/docs/development/current/main/phases/phase-29ao/README.md index fc8ae866..647ccf53 100644 --- a/docs/development/current/main/phases/phase-29ao/README.md +++ b/docs/development/current/main/phases/phase-29ao/README.md @@ -122,7 +122,11 @@ Gate(SSOT): - `docs/development/current/main/phases/phase-29ae/README.md` の回帰セットに追記 - ねらい: P17/P18 の strict/dev shadow adopt が回帰ゲートで必ず踏まれる状態を SSOT 化 +## P20: CoreLoop ExitMap composition(docs-first)✅ + +- 指示書: `docs/development/current/main/phases/phase-29ao/P20-CORELOOP-EXITMAP-COMPOSITION-SSOT-INSTRUCTIONS.md` +- ねらい: Loop skeleton に対する ExitMap/Cleanup/ValueJoin の合成規約を SSOT として固定 + ## Next(planned) -- P20: CoreLoop ExitMap composition(docs-first) - - 指示書: `docs/development/current/main/phases/phase-29ao/P20-CORELOOP-EXITMAP-COMPOSITION-SSOT-INSTRUCTIONS.md` +- P21: TBD