pub fn expand_policy(
policy: &PolicyConfig,
supernodes: &[SupernodeConfig],
) -> Result<PolicyConfig, String>Expand description
Inlines every type: supernode node of policy using supernodes.
Splicing rules (spec §2):
- outer
X.p -> inst.inis redirected to the target of the definition’sinput.outedge (prefixed); - an instance exposes one output port per
outputboundary node — named viaport_for_output_boundary— plus one port pererrorboundary node, named directly by its id.outis accepted as an alias for theoutput-id boundary’ssuccessport. Any other port name on an outer edge leaving the instance is rejected, listing the exposed ports (output ports, then error ports); so is a second edge from the same port; - every output-derived port is mandatory-wired: an outer edge from
inst.<port>must exist for eachoutputboundary, or expansion fails naming the instance and port — the instance node is gone before post-expansion port validation runs, so this is the only place that can catch it; - inner edges into an
outputboundary are redirected to the target of that boundary’s outer edge (always present, per the rule above); - inner edges into an
errorboundary follow that boundary’s outerinst.<port>edge, or are dropped when it is unwired (the policy catch-all, or the generic 500, takes over — error-kind ports are genuinely optional); - every inner node with no error edge of its own gets an implicit error
edge to the outer target of the DEFAULT
error-id boundary, when one is wired (black-box guarantee) — other named error boundaries carry no such default.
Consumed by [compile_policy] at graph-compilation time.