pub fn compile_policy(
policy: &PolicyConfig,
resources: Arc<PluginResources>,
) -> Result<CompiledGraph, String>Expand description
Compiles a PolicyConfig into a ready-to-execute CompiledGraph.
Instantiates each node’s plugin via plugins::create_plugin, records
client nodes as terminals, and indexes edges per node by source port
(out normalizes to success). The entry node is the target of the
listener’s success/out edge. Fails if the policy has no listener node,
a plugin cannot be constructed, an edge names a port its node type does
not declare, two edges leave the same node.port (fan-out is not
supported), or a node’s success/outcome port (PortKind::Success or
PortKind::Outcome) has no outgoing edge — error ports are exempt
(fallback chain: per-node error edge -> policy catch-all -> default 500).
Edge endpoints use the node_id.port form:
edges:
- from: listener.out
to: rewrite.in
- from: rewrite.success
to: client.in
- from: rewrite.error
to: error-handler.in