docs(phase29ab): closeout P1-P9

This commit is contained in:
2025-12-28 16:36:15 +09:00
parent c397016ac7
commit 209b04d808
12 changed files with 395 additions and 280 deletions

View File

@ -1,6 +1,6 @@
# Self Current Task — Now (main)
## Current Focus: Phase 29ab P8Pattern6/7 ok path PASS
## Current Focus: Phase 29ab COMPLETEcloseout
**2025-12-28: Phase 29ab P1 完了**
- 目的: Pattern2 の LoopBodyLocal promotion の最小ケースを fixture+integration smoke で固定
@ -53,6 +53,10 @@
- Pattern7 OK: `apps/tests/phase29ab_pattern7_splitscan_ok_min.hako`
- Smokes: `phase29ab_pattern6_scan_with_init_ok_min_vm`, `phase29ab_pattern7_splitscan_ok_min_vm`
**2025-12-28: Phase 29ab P9 完了**
- 目的: Phase 29ab closeout入口SSOTの集約
- 入口: `docs/development/current/main/phases/phase-29ab/README.md`
**2025-12-28: Phase 29aa P5 完了**
- 目的: Return block が複数 predecessor のとき、incoming state が完全一致する場合のみ ReturnCleanup を成立させる
- 入口: `docs/development/current/main/phases/phase-29aa/README.md`

View File

@ -8,16 +8,8 @@ Related:
## 直近JoinIR/selfhost
- **Phase 29abP4 ✅ done / P5 planned: JoinIR completion triage**
- P1: Pattern2 LoopBodyLocal minimal fixture+smoke fixed`phase29ab_pattern2_loopbodylocal_min_vm`
- P2: Pattern2 Trim seg minimal fixture+smoke fixed`phase29ab_pattern2_loopbodylocal_seg_min_vm`
- P3: PromoteDecision の “NotApplicable/Freeze” 境界を contract+smoke で固定JoinIR-only前提
- P4: Phase 263StageB 実ログ segを Derived slot 方針で通し、fixture+smoke で固定
- P5: Pattern7 SplitScan first-fail契約違反を freeze で固定して SSOT 化
- P6: Pattern6 ScanWithInit first-fail契約違反を freeze で固定して SSOT 化
- P7: Pattern6 reverse scan / MatchScan の near-miss を追加で freeze 固定(負債を先に顕在化)
- P8: Pattern6/7 “正常系” を Plan/Frag/compose へ寄せて PASS 固定freeze を減らす本丸)✅
- P9: Phase 29ab closeoutNow/Backlog/phase README を更新して完了宣言)
- **Phase 29ab✅ COMPLETE: JoinIR completion triage**
- 入口: `docs/development/current/main/phases/phase-29ab/README.md`
- **Phase 288✅ P0P3 + 288.1 complete: REPL mode**
- 入口: `docs/development/current/main/phases/phase-288/README.md`

View File

@ -361,6 +361,13 @@ MIR Terminator Instructions
- loop の EdgeCFG 化は、まず **BasicBlockId 層で持っている箇所Phase 268 の if_form のような場所)**から適用を進める。
- JoinIR 側の loop は Phase 270 で **fixture/smoke による SSOT 固定**を先に行い、壊れたら最小差分で直す。
## compose SSOT使い分けガイド
- `compose::if_`: then/else が **Normal exit** で step/merge に合流する形Pattern7 split scan の if/else
- `compose::cleanup`: main frag に cleanup fragReturn/Normalを合成して早期離脱を明示する形Pattern6 scan-with-init
- どちらも **Frag の validity を前提** にし、Normalizer が入口で妥当性を保証する
- Pattern6/7 contract SSOT: `docs/development/current/main/design/pattern6-7-contracts.md`
補足Phase 270:
- Pattern1simple_while_minimalは test-only stub のため、一般ループの “基準” には使えない。
- Phase 270 では “最小の固定形” を Pattern9AccumConstLoopとして追加し、後で Frag 合成側へ吸収される前提で橋渡しにする。

View File

@ -0,0 +1,39 @@
# Pattern6/7 Contracts (SSOT)
This document defines the **contract boundary** for Pattern6/7 extractors.
It is the SSOT for `NotApplicable` vs `Freeze` decisions.
## Common Rule
- **NotApplicable**: shape mismatch (another pattern may apply)
- **Freeze**: shape matches but contract is violated (fail-fast)
Tags:
- Pattern6: `[joinir/phase29ab/pattern6/contract]`
- Pattern7: `[joinir/phase29ab/pattern7/contract]`
## Pattern6 (ScanWithInit / MatchScan)
Accepted shape:
- `loop(i < s.length())` or `loop(i <= s.length() - needle.length())`
- `if s.substring(i, i + 1) == needle { return i }`
- step update exists and matches direction
Freeze conditions:
- step update missing
- forward scan with step != `i = i + 1`
- reverse scan with step != `i = i - 1`
Note:
- plan line is forward-only; reverse scans are currently treated as NotApplicable
## Pattern7 (SplitScan)
Accepted shape:
- `loop(i <= s.length() - separator.length())`
- `if s.substring(i, i + separator.length()) == separator`
- then: `result.push(...)`, `start = i + separator.length()`, `i = start`
- else: `i = i + 1`
Freeze conditions:
- then/else update contracts broken (start/i updates)
- separator literal length != 1 (P0 scope)

View File

@ -0,0 +1,54 @@
# Phase 29ab: JoinIR completion triage (P1P9)
Goal: Fix near-miss vs OK boundaries for Pattern2/6/7 and provide a single entry point for fixtures, smokes, and contracts.
## Contracts (SSOT)
- Pattern2 promotion: `src/mir/builder/control_flow/joinir/patterns/pattern2/api/README.md`
- Pattern6/7 contracts: `docs/development/current/main/design/pattern6-7-contracts.md`
- compose SSOT: `docs/development/current/main/design/edgecfg-fragments.md`
## Fixtures and Smokes
### Freeze-fixed (contract violations)
- Pattern2 seg freeze:
- `apps/tests/phase29ab_pattern2_seg_freeze_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern2_seg_freeze_min_vm.sh`
- Pattern7 SplitScan first-fail:
- `apps/tests/phase29ab_pattern7_firstfail_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern7_firstfail_min_vm.sh`
- Pattern6 ScanWithInit first-fail:
- `apps/tests/phase29ab_pattern6_firstfail_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_firstfail_min_vm.sh`
- Pattern6 reverse scan near-miss:
- `apps/tests/phase29ab_pattern6_reverse_firstfail_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_reverse_firstfail_min_vm.sh`
- Pattern6 matchscan near-miss:
- `apps/tests/phase29ab_pattern6_matchscan_firstfail_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_matchscan_firstfail_min_vm.sh`
### OK (PASS fixed)
- Pattern2 LoopBodyLocal min:
- `apps/tests/phase29ab_pattern2_loopbodylocal_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern2_loopbodylocal_min_vm.sh`
- Pattern2 LoopBodyLocal seg:
- `apps/tests/phase29ab_pattern2_loopbodylocal_seg_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern2_loopbodylocal_seg_min_vm.sh`
- Pattern2 seg notapplicable:
- `apps/tests/phase29ab_pattern2_seg_notapplicable_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern2_seg_notapplicable_min_vm.sh`
- Phase 263 realworld seg (Derived slot path):
- `apps/tests/phase263_pattern2_seg_realworld_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase263_pattern2_seg_realworld_min_vm.sh`
- Pattern6 ScanWithInit OK:
- `apps/tests/phase29ab_pattern6_scan_with_init_ok_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern6_scan_with_init_ok_min_vm.sh`
- Pattern7 SplitScan OK:
- `apps/tests/phase29ab_pattern7_splitscan_ok_min.hako`
- `tools/smokes/v2/profiles/integration/apps/phase29ab_pattern7_splitscan_ok_min_vm.sh`
## Commands
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern2_*"`
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern6_*"`
- `./tools/smokes/v2/run.sh --profile integration --filter "phase29ab_pattern7_*"`