phase29ai(p8): try planner before legacy pattern6
This commit is contained in:
@ -7,6 +7,7 @@ use crate::mir::builder::control_flow::joinir::patterns::router::LoopPatternCont
|
||||
use crate::mir::loop_pattern_detection::LoopPatternKind;
|
||||
|
||||
use super::legacy_rules;
|
||||
use crate::mir::builder::control_flow::plan::planner;
|
||||
use crate::mir::builder::control_flow::plan::DomainPlan;
|
||||
|
||||
pub(super) fn try_build_domain_plan(ctx: &LoopPatternContext) -> Result<Option<DomainPlan>, String> {
|
||||
@ -62,11 +63,18 @@ pub(super) fn try_build_domain_plan(ctx: &LoopPatternContext) -> Result<Option<D
|
||||
continue;
|
||||
}
|
||||
|
||||
let plan_opt = match entry.kind {
|
||||
RuleKind::Simple(extract) => extract(ctx),
|
||||
RuleKind::Pattern6 => legacy_rules::pattern6::extract(ctx),
|
||||
RuleKind::Pattern7 => legacy_rules::pattern7::extract(ctx),
|
||||
}?;
|
||||
let (plan_opt, log_none) = match entry.kind {
|
||||
RuleKind::Simple(extract) => (extract(ctx)?, true),
|
||||
RuleKind::Pattern6 => {
|
||||
let from_planner = planner::build_plan(ctx.condition, ctx.body)
|
||||
.map_err(|freeze| freeze.to_string())?;
|
||||
match from_planner {
|
||||
Some(plan) => (Some(plan), false),
|
||||
None => (legacy_rules::pattern6::extract(ctx)?, true),
|
||||
}
|
||||
}
|
||||
RuleKind::Pattern7 => (legacy_rules::pattern7::extract(ctx)?, true),
|
||||
};
|
||||
|
||||
if let Some(domain_plan) = plan_opt {
|
||||
// Phase 286 P3: Pattern8 static box filtering
|
||||
@ -87,7 +95,7 @@ pub(super) fn try_build_domain_plan(ctx: &LoopPatternContext) -> Result<Option<D
|
||||
let log_msg = format!("route=plan strategy=extract pattern={}", entry.name);
|
||||
trace::trace().pattern("route", &log_msg, true);
|
||||
return Ok(Some(domain_plan));
|
||||
} else if ctx.debug {
|
||||
} else if log_none && ctx.debug {
|
||||
let debug_msg =
|
||||
format!("{} extraction returned None, trying next pattern", entry.name);
|
||||
trace::trace().debug("route", &debug_msg);
|
||||
|
||||
Reference in New Issue
Block a user