Skip to main content

evaluate_structured_condition

Function evaluate_structured_condition 

Source
pub fn evaluate_structured_condition(
    condition: &Condition,
    ctx: &ExecutionContext,
    result: Option<&Value>,
) -> Result<bool>
Expand description

Evaluate a structured condition against ctx + optional tool result.

Behaviour matches the worker’s pre-PR-2b CaseEvaluator::evaluate_condition:

  • condition.left resolution order:
    1. "result" → the supplied tool result (or Null if None).
    2. "result.<path>" → JSON path navigation of the result.
    3. Variable lookup via ctx.get_variable(&left).
    4. Template rendering via TemplateEngine::render.
    5. Literal string.
  • condition.right is template-rendered against ctx before use.
  • Operator semantics match the worker’s inline implementation.

This function is pure and synchronous — no I/O, no async.