pub fn validate_supernode(sn: &SupernodeConfig) -> Result<(), Vec<String>>Expand description
Validates a supernode definition’s structure, collecting all violations.
Enforced rules (spec §3):
- exactly one boundary node of type
input, idinput; one or moreoutputboundaries (id = port name,output= thesuccessport); one or moreerrorboundaries (id = error-kind port name,error= the default the black-box rule targets); - output/error ids must not be in RESERVED_OUTPUT_IDS/RESERVED_ERROR_IDS
(collide with fixed instance port names like
success,input, etc.); - no two nodes share an id (duplicate ids would create ambiguous output ports);
- inner nodes must not be
listener/client/supernode, must not use reserved ids, and must not contain/; - exactly one edge leaves
input; no edges intoinputor out ofoutput/errorboundaries; - every edge endpoint references an existing node;
- no orphan inner nodes (unconnected
output/errorboundaries are fine — not every subgraph uses both exits); - every inner edge leaves a port its source node’s type actually declares
(
outnormalizes tosuccess; boundary pseudo-nodes are exempt — they have no plugin type and therefore noPortSpec); - every
success/outcome port of every inner node is wired inside the definition, to another inner node or to a boundary. Definitions are compiled as part of each policy that instantiates them, so an unwired outcome port would otherwise surface as a confusing compile error on an unrelated policy rather than at save time on the definition itself.errorports stay exempt: the black-box rule inexpand_policywires every unhandled inner error port to the instance’s error exit.