phase29af(p0): pattern2 boundary hygiene ssot
This commit is contained in:
@ -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 hygiene(Pattern2)を、merge の `contract_checks` 側でも検証できる形に収束する。
|
||||
|
||||
- upstream(Pattern2 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` の carriers(LoopState + 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
|
||||
|
||||
- 既存 smokes(quick / phase29ab_pattern2_ / phase1883_)が PASS のまま
|
||||
- release ビルドでの挙動は不変(Fail-Fast は debug/strict のみ)
|
||||
- boundary hygiene の契約が “merge 入口の SSOT(contract_checks)” でも検証される
|
||||
35
docs/development/current/main/phases/phase-29af/README.md
Normal file
35
docs/development/current/main/phases/phase-29af/README.md
Normal file
@ -0,0 +1,35 @@
|
||||
# Phase 29af P0: Pattern2 Boundary Hygiene (SSOT)
|
||||
|
||||
Goal: Pattern2 の boundary 情報の歪みを SSOT で整理し、将来の回帰を防ぐ(仕様不変)。
|
||||
|
||||
## Boundary Contract (SSOT)
|
||||
|
||||
- Header PHI 対象:
|
||||
- `carrier_info` の carriers(LoopState + 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`
|
||||
Reference in New Issue
Block a user