phase29ak(p4): remove pattern1 guard from single_planner

This commit is contained in:
2025-12-29 15:10:08 +09:00
parent 655b968fb4
commit afe12ffa35
6 changed files with 88 additions and 15 deletions

View File

@ -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 フォールバックの共通形に統一(挙動不変)。

View File

@ -2,10 +2,15 @@
## Current Focus: Phase 29akPlanRuleOrder + PlannerContext
Next: Phase 29ak P4TBD
Next: Phase 29ak P5TBD
運用ルール: 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`

View File

@ -26,8 +26,8 @@ Related:
- **Phase 29akcandidate: PlanRuleOrder SSOT + PlannerContext plumbing**
- 入口: `docs/development/current/main/phases/phase-29ak/README.md`
- 状況: P0/P1/P2/P3 ✅ 完了
- Next: Phase 29ak P4TBD
- 状況: P0/P1/P2/P3/P4 ✅ 完了
- Next: Phase 29ak P5TBD
- **Phase 29aicandidate: Plan/Frag single-plannerFacts SSOT**
- 入口: `docs/development/current/main/phases/phase-29ai/README.md`

View File

@ -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"`

View File

@ -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`

View File

@ -32,22 +32,23 @@ pub(super) fn try_build_domain_plan(ctx: &LoopPatternContext) -> Result<Option<D
for rule_id in PLAN_RULE_ORDER {
let rule_id = *rule_id;
let name = rule_name(rule_id);
// Phase 286 P2.6: Pattern1 Plan guard (structural Fail-Fast)
// Phase 29ak P1: planner also suppresses Pattern1 facts; keep this guard as safety.
// Pattern1 should only match Pattern1SimpleWhile pattern_kind
// This prevents Pattern1 from incorrectly matching Pattern3 fixtures
if matches!(rule_id, PlanRuleId::Pattern1)
&& ctx.pattern_kind != LoopPatternKind::Pattern1SimpleWhile
{
continue;
}
let planner_hit = try_take_planner(&planner_opt, rule_id);
// Pattern1 gating is handled by planner/facts; fallback mirrors the same contract.
let allow_pattern1 = match ctx.pattern_kind {
LoopPatternKind::Pattern1SimpleWhile => 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<DomainPlan>, kind: PlanRuleId) -> Optio
fn fallback_extract(
ctx: &LoopPatternContext,
kind: PlanRuleId,
allow_pattern1: bool,
allow_pattern8: bool,
) -> Result<Option<DomainPlan>, 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)
}