phase29af(p0): pattern2 boundary hygiene ssot

This commit is contained in:
2025-12-29 05:12:15 +09:00
parent 62bd42b87f
commit 19f2c6b7f6
14 changed files with 244 additions and 98 deletions

View File

@ -1,6 +1,12 @@
# Self Current Task — Now (main)
## Current Focus: Phase 29ae (JoinIR Regression Pack)
## Current Focus: Phase 29af (Pattern2 Boundary Hygiene)
**2025-12-29: Phase 29af P0 完了**
- 目的: Pattern2 の boundary 情報の歪みを SSOT 化し、exit/header/latch の責務境界を固定(仕様不変)
- 入口: `docs/development/current/main/phases/phase-29af/README.md`
- 変更: exit_bindings は LoopState のみConditionOnly/LoopLocalZero は carrier_info→header PHI
- 検証: `cargo build --release` / `./tools/smokes/v2/run.sh --profile quick` / `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern2_"` / `./tools/smokes/v2/run.sh --profile integration --filter "phase1883_"` PASS
**2025-12-28: Phase 29ae P1 完了**
- 目的: Merge/Phi Contract SSOT + 回帰パック完全固定

View File

@ -8,6 +8,9 @@ Related:
## 直近JoinIR/selfhost
- **Phase 29af P0in progress: Pattern2 Boundary HygieneSSOT固定**
- 入口: `docs/development/current/main/phases/phase-29af/README.md`
- **Phase 29ae P1✅ COMPLETE: JoinIR Regression Pack (SSOT固定)**
- 入口: `docs/development/current/main/phases/phase-29ae/README.md`

View File

@ -0,0 +1,66 @@
# Phase 29af P1: Boundary Hygiene Contract Checks — Instructions
Status: Ready for execution
Scope: JoinIR merge の contract_checks に boundary hygiene を集約(仕様不変)
## Goal
Phase 29af P0 で確定した boundary hygienePattern2を、merge の `contract_checks` 側でも検証できる形に収束する。
- upstreamPattern2 lowerer 側)だけに Fail-Fast が散らばらないようにする
- future pattern / future refactor で boundary 構築の歪みが再発したときに、merge 入口で検知できるようにする
## Non-goals
- 挙動変更release ビルド既定挙動の変更)
- env var の追加
- fixture/smoke の増加(必要性が明確になった場合のみ)
## Contract (SSOT)
SSOT: `docs/development/current/main/phases/phase-29af/README.md`
- Exit reconnection (`boundary.exit_bindings`) は LoopState のみ
- Header PHI の対象は `boundary.carrier_info` の carriersLoopState + ConditionOnly + LoopLocalZero
- `CarrierInit::FromHost``host_id=0` は契約違反Fail-Fast
- `exit_bindings.carrier_name` の重複は禁止Fail-Fast
## Implementation Steps
1) **contract_checks に boundary hygiene チェックを追加**
- 追加ファイル案: `src/mir/builder/control_flow/joinir/merge/contract_checks/boundary_hygiene.rs`
- 関数案:
- `verify_boundary_hygiene(boundary: &JoinInlineBoundary) -> Result<(), String>`
- 検証項目:
- `exit_bindings``role` が全て LoopState であること
- `exit_bindings``carrier_name` が重複しないこと
- `carrier_info` がある場合:
- `CarrierInit::FromHost` の carrier は `host_id != ValueId(0)` であること
- `exit_bindings` の carrier が `carrier_info` と整合すること(最低限: 同名が存在すること)
2) **merge 入口のチェックに配線**
- `src/mir/builder/control_flow/joinir/merge/contract_checks/boundary_creation.rs`
- boundary の概要ログの直後Fail-Fast 位置)で `verify_boundary_hygiene()` を呼ぶ
- `src/mir/builder/control_flow/joinir/merge/contract_checks/mod.rs`
- module 宣言と re-export を追加
3) **docs を更新(入口と責務の明文化)**
- `docs/development/current/main/phases/phase-29af/README.md`
- P1: contract_checks に集約した旨を追記
- `docs/development/current/main/10-Now.md`
- Phase 29af P1 の進捗Started/Completeに反映
- `docs/development/current/main/30-Backlog.md`
- Phase 29af のステータスを更新
## Verification
- `cargo build --release`
- `./tools/smokes/v2/run.sh --profile quick`
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern2_"`
- `./tools/smokes/v2/run.sh --profile integration --filter "phase1883_"`
## Acceptance Criteria
- 既存 smokesquick / phase29ab_pattern2_ / phase1883_が PASS のまま
- release ビルドでの挙動は不変Fail-Fast は debug/strict のみ)
- boundary hygiene の契約が “merge 入口の SSOTcontract_checks” でも検証される

View File

@ -0,0 +1,35 @@
# Phase 29af P0: Pattern2 Boundary Hygiene (SSOT)
Goal: Pattern2 の boundary 情報の歪みを SSOT で整理し、将来の回帰を防ぐ(仕様不変)。
## Boundary Contract (SSOT)
- Header PHI 対象:
- `carrier_info` の carriersLoopState + ConditionOnly + LoopLocalZero
- Exit reconnection 対象:
- LoopState のみConditionOnly は exit_bindings に入れない)
- Host binding 対象:
- `CarrierInit::FromHost` のみBoolConst / LoopLocalZero は host slot 不要)
## Fail-Fast Rules
- exit_bindings の `carrier_name` 重複は禁止debug_assert
- `CarrierInit::FromHost``host_id=0` は Fail-Fast
## Entry Points
- boundary 構築: `src/mir/builder/control_flow/joinir/patterns/pattern2_steps/emit_joinir_step_box.rs`
- header PHI 事前構築: `src/mir/builder/control_flow/joinir/merge/header_phi_prebuild.rs`
- exit_bindings 収集: `src/mir/builder/control_flow/joinir/merge/exit_line/meta_collector.rs`
- latch 記録: `src/mir/builder/control_flow/joinir/merge/rewriter/{tail_call_policy,latch_incoming_recorder}.rs`
## Verification
- `cargo build --release`
- `./tools/smokes/v2/run.sh --profile quick`
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern2_"`
- `./tools/smokes/v2/run.sh --profile integration --filter "phase1883_"`
## Notes
- Merge 側の Header PHI Entry/Latch contract は Phase 29ae で SSOT 化済み: `docs/development/current/main/phases/phase-29ae/README.md`