From afe12ffa3549fe1d8ae0a1b2c4db53fde465718b Mon Sep 17 00:00:00 2001 From: tomoaki Date: Mon, 29 Dec 2025 15:10:08 +0900 Subject: [PATCH] phase29ak(p4): remove pattern1 guard from single_planner --- CURRENT_TASK.md | 3 ++ docs/development/current/main/10-Now.md | 7 ++- docs/development/current/main/30-Backlog.md | 4 +- ...GLE_PLANNER-PATTERN1-GUARD-INSTRUCTIONS.md | 51 +++++++++++++++++++ .../current/main/phases/phase-29ak/README.md | 7 +++ .../control_flow/plan/single_planner/rules.rs | 31 ++++++----- 6 files changed, 88 insertions(+), 15 deletions(-) create mode 100644 docs/development/current/main/phases/phase-29ak/P4-REMOVE-SINGLE_PLANNER-PATTERN1-GUARD-INSTRUCTIONS.md diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index 71cdebea..5be3df21 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -36,6 +36,9 @@ static box では Pattern8 facts 抽出を抑制。single_planner 側の filter **2025-12-29: Phase 29ak P3 COMPLETE (remove Pattern8 filter in single_planner)** Pattern8 static box filter を single_planner から撤去し、planner/facts 側 SSOT に一本化。 +**2025-12-29: Phase 29ak P4 COMPLETE (remove Pattern1 guard in single_planner)** +Pattern1 guard を single_planner から撤去し、planner/facts 側 SSOT と fallback 抑制に統一。 + **2025-12-29: Phase 29aj P10 COMPLETE (single_planner unified shape)** single_planner を全パターンで planner-first → extractor フォールバックの共通形に統一(挙動不変)。 diff --git a/docs/development/current/main/10-Now.md b/docs/development/current/main/10-Now.md index 03767cfa..6a7faf78 100644 --- a/docs/development/current/main/10-Now.md +++ b/docs/development/current/main/10-Now.md @@ -2,10 +2,15 @@ ## Current Focus: Phase 29ak(PlanRuleOrder + PlannerContext) -Next: Phase 29ak P4(TBD) +Next: Phase 29ak P5(TBD) 運用ルール: integration filter で phase143_* は回さない(JoinIR 回帰は phase29ae pack のみ) 運用ルール: phase286_pattern9_* は legacy pack (SKIP) を使う +**2025-12-29: Phase 29ak P4 完了** ✅ +- 目的: Pattern1 guard を single_planner から撤去(仕様不変) +- 実装: `src/mir/builder/control_flow/plan/single_planner/rules.rs` +- 検証: `cargo build --release` / `./tools/smokes/v2/run.sh --profile quick` / `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` PASS + **2025-12-29: Phase 29ak P3 完了** ✅ - 目的: Pattern8 static box filter を single_planner から撤去(仕様不変) - 実装: `src/mir/builder/control_flow/plan/single_planner/rules.rs` diff --git a/docs/development/current/main/30-Backlog.md b/docs/development/current/main/30-Backlog.md index 498c441c..7f2d4182 100644 --- a/docs/development/current/main/30-Backlog.md +++ b/docs/development/current/main/30-Backlog.md @@ -26,8 +26,8 @@ Related: - **Phase 29ak(candidate): PlanRuleOrder SSOT + PlannerContext plumbing** - 入口: `docs/development/current/main/phases/phase-29ak/README.md` - - 状況: P0/P1/P2/P3 ✅ 完了 - - Next: Phase 29ak P4(TBD) + - 状況: P0/P1/P2/P3/P4 ✅ 完了 + - Next: Phase 29ak P5(TBD) - **Phase 29ai(candidate): Plan/Frag single-planner(Facts SSOT)** - 入口: `docs/development/current/main/phases/phase-29ai/README.md` diff --git a/docs/development/current/main/phases/phase-29ak/P4-REMOVE-SINGLE_PLANNER-PATTERN1-GUARD-INSTRUCTIONS.md b/docs/development/current/main/phases/phase-29ak/P4-REMOVE-SINGLE_PLANNER-PATTERN1-GUARD-INSTRUCTIONS.md new file mode 100644 index 00000000..2e4159e2 --- /dev/null +++ b/docs/development/current/main/phases/phase-29ak/P4-REMOVE-SINGLE_PLANNER-PATTERN1-GUARD-INSTRUCTIONS.md @@ -0,0 +1,51 @@ +# Phase 29ak P4: Remove Pattern1 guard from single_planner + +Date: 2025-12-29 +Status: Ready for execution +Scope: single_planner の特例削除(仕様不変)+ docs 更新 +Goal: Pattern1 guard を planner/facts 側 SSOT に一本化する + +## Objective + +- single_planner の Pattern1 guard を削除 +- fallback 側で ctx による抑制を追加し、契約を二重化 +- 観測差分なし(ログ文字列は変えない) + +## Non-goals + +- rule順序SSOTの CandidateSet 移管 +- extractor fallback の削除 +- 新 env var / 新ログ追加 + +## Implementation Steps + +### Step 1: Pattern1 guard を削除 + +Update: +- `src/mir/builder/control_flow/plan/single_planner/rules.rs` + +### Step 2: fallback 側で Pattern1 抑制 + +Update: +- `src/mir/builder/control_flow/plan/single_planner/rules.rs` + +Notes: +- `ctx.pattern_kind != Pattern1SimpleWhile` のとき Pattern1 fallback を `Ok(None)` にする + +### Step 3: docs / CURRENT_TASK 更新 + +Update: +- `docs/development/current/main/phases/phase-29ak/README.md` +- `docs/development/current/main/10-Now.md` +- `docs/development/current/main/30-Backlog.md` +- `CURRENT_TASK.md` + +## Verification + +- `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 "phase29ak(p4): remove pattern1 guard from single_planner"` diff --git a/docs/development/current/main/phases/phase-29ak/README.md b/docs/development/current/main/phases/phase-29ak/README.md index 10ed7cac..3a257cae 100644 --- a/docs/development/current/main/phases/phase-29ak/README.md +++ b/docs/development/current/main/phases/phase-29ak/README.md @@ -29,3 +29,10 @@ Goal: single_planner の「順序・名前・ガード」の SSOT を 1 箇所 - ねらい: Pattern8 static box filter を planner/facts 側 SSOT に一本化 - 完了: single_planner の Pattern8 特例フィルタを削除(debugログは SSOT ではない) - 検証: `cargo build --release` / `./tools/smokes/v2/run.sh --profile quick` / `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` + +## P4: single_planner から Pattern1 guard を撤去 + +- 指示書: `docs/development/current/main/phases/phase-29ak/P4-REMOVE-SINGLE_PLANNER-PATTERN1-GUARD-INSTRUCTIONS.md` +- ねらい: Pattern1 guard を planner/facts 側 SSOT に一本化 +- 完了: single_planner の guard を削除し、fallback 側で同契約を維持 +- 検証: `cargo build --release` / `./tools/smokes/v2/run.sh --profile quick` / `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` diff --git a/src/mir/builder/control_flow/plan/single_planner/rules.rs b/src/mir/builder/control_flow/plan/single_planner/rules.rs index e61cffc8..fde26c03 100644 --- a/src/mir/builder/control_flow/plan/single_planner/rules.rs +++ b/src/mir/builder/control_flow/plan/single_planner/rules.rs @@ -32,22 +32,23 @@ pub(super) fn try_build_domain_plan(ctx: &LoopPatternContext) -> Result true, + _ => false, + }; let allow_pattern8 = !ctx.in_static_box; let (plan_opt, log_none) = if planner_hit.is_some() { (planner_hit, false) } else { - (fallback_extract(ctx, rule_id, allow_pattern8)?, true) + let plan_opt = fallback_extract(ctx, rule_id, allow_pattern1, allow_pattern8)?; + let log_none = if matches!(rule_id, PlanRuleId::Pattern1) { + allow_pattern1 + } else { + true + }; + (plan_opt, log_none) }; let promotion_tag = if matches!(rule_id, PlanRuleId::Pattern2) @@ -102,10 +103,16 @@ fn try_take_planner(planner_opt: &Option, kind: PlanRuleId) -> Optio fn fallback_extract( ctx: &LoopPatternContext, kind: PlanRuleId, + allow_pattern1: bool, allow_pattern8: bool, ) -> Result, String> { match kind { - PlanRuleId::Pattern1 => extractors::pattern1::extract_pattern1_plan(ctx.condition, ctx.body), + PlanRuleId::Pattern1 => { + if !allow_pattern1 { + return Ok(None); + } + extractors::pattern1::extract_pattern1_plan(ctx.condition, ctx.body) + } PlanRuleId::Pattern2 => { extractors::pattern2_break::extract_pattern2_plan(ctx.condition, ctx.body) }