Skip to main content

expand_policy

Function expand_policy 

Source
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.in is redirected to the target of the definition’s input.out edge (prefixed);
  • an instance exposes one output port per output boundary node — named via port_for_output_boundary — plus one port per error boundary node, named directly by its id. out is accepted as an alias for the output-id boundary’s success port. 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 each output boundary, 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 output boundary are redirected to the target of that boundary’s outer edge (always present, per the rule above);
  • inner edges into an error boundary follow that boundary’s outer inst.<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.