Skip to main content

plan_document

Function plan_document 

Source
pub fn plan_document(
    tree: &CypherValue,
    statement: Option<&str>,
    notifications: &[Notification],
) -> Value
Expand description

Project a plan wire tree (the engine’s PlanNode::to_value() form) into the agent-native document, as a serde_json::Value — the surface serializes it, exactly as it does the sibling wire documents (stats_to_wire_json, notifications_to_wire_json).

statement is the planned statement as echoed (None for a hand-built tree); notifications is the result’s remedy-bearing notification list (ADR-0363), joined into each node’s warnings by the operator id the engine stamps — so an agent reads the diagnosis and the action beside it. profiled is derived from the walked tree itself — any node carrying runtime metrics makes it a PROFILE tree — so the top-level flag can never contradict the per-node actual objects.

§Panics

Panics when the value is not a plan wire tree — the same contract plan_node_wire enforces (a wire break is an engine bug, never silently dropped) — and when an operator-scoped notification stamps an id no walked node carries, so a warning can never vanish from the document.