Expand description
Compile-time expansion of supernode instances into flat policies.
A policy node of type: supernode (config { name: <supernode> }) is
replaced by the referenced definition’s inner nodes, ids namespaced
<instance-id>/<inner-id>. Boundary pseudo-nodes (input/output/
error) are spliced onto the instance’s outer edges. Runs after
validate_policy and before
compile_policy; the engine never sees
a supernode node type.
A definition may declare one or more output boundary nodes and one or
more error boundary nodes; each boundary node’s id names an instance
port. For output boundaries this goes through
port_for_output_boundary — the special id output keeps the
historical success mapping, any other id IS the port name. For error
boundaries the id IS the port name directly, with no such special-case
mapping — except that the id error is also the one the black-box rule
targets by default. So an instance’s exit map is per-boundary: each
output/error boundary has its own exit_to target (the to of the
matching outer inst.<port> edge). Every output-derived port is
mandatory-wired — an unwired one is a hard compile error naming the
instance and port, because the instance node is gone before
post-expansion port validation runs and nothing downstream could catch
it otherwise. Error-kind boundaries stay optional: an unwired one just
drops the corresponding edges (the policy catch-all, or the generic 500,
takes over). The black-box guarantee — every inner node with no error
edge of its own gets an implicit error edge — follows ONLY the
error-id boundary; other named error boundaries carry no such default.
Constants§
- BOUNDARY_
TYPES 🔒 - Reserved boundary pseudo-node types (and required ids) in a definition.
Consumed by
expand_policyand downstream tasks.
Functions§
- expand_
policy - Inlines every
type: supernodenode ofpolicyusingsupernodes. - port_
for_ 🔒output_ boundary - Instance port name exposed by an output boundary node: the special id
outputkeeps the historicalsuccessmapping; any other id is the port name itself. Consumed by expansion and its tests; the UI mirrors this mapping in ui/src/policyGraph.ts::supernodePortSpec. - split_
endpoint 🔒 - Splits
node_id.porton the last dot, defaulting the port toout. Mirror ofengine::parse_edge_endpoint— the two must agree. Consumed byexpand_policyand downstream tasks.