phase29ak(p4): remove pattern1 guard from single_planner
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user