--- id: CMP-5 family: RT-CMP level: core profiles: [runtime] posture: normative-target added: "1.0" changed: "1.0" source: https://flowdrop.io/spec/rules/rt-cmp/cmp-5 specification: FlowDrop Workflow Specification 1.0 licence: CC BY 4.0 --- # CMP-5 — Only tool and loopback cycles are legal *RT-CMP (Part II) · level: core · profiles: runtime · added in 1.0* Rejecting every other cycle is what makes the forward graph acyclic. Loop membership is defined by reachability sweeps over that acyclic graph, so loosening this rule would make loop extent ill-defined rather than merely permissive. ## The rule > **Normative.** This is the rule. > > 1. Cycle detection MUST ignore tool and loopback edges. > > 2. A cycle formed only from those edge types MUST NOT refuse compilation. > > 3. Any other cycle MUST refuse compilation. > > 4. The graph that remains once the ignored edge types are removed is therefore acyclic, and rules that depend on that acyclicity can rely on it. ## What it means Cycle detection does not walk the graph as stored — it first removes every tool and loopback edge, then checks what is left for a cycle. A cycle is legal exactly when it disappears once those edge types are taken out, whatever mix of edge types formed it. The one case a mix does not save: a cycle built entirely from ordinary connections has nothing for the removal to take out, so it always refuses compilation. ## Example The same two-node shape, back and forth, once with both edges ordinary and once with the return edge a loopback: ```json title="Two edges back and forth, both ordinary connections" verdict="refused" [ { "source": "node_a", "target": "node_b" }, { "source": "node_b", "target": "node_a" } ] ``` ```json title="The same shape, the return edge a loopback" verdict="legal" [ { "source": "iterator_1", "target": "node_b", "sourceHandle": "iterator_1-output-item" }, { "source": "node_b", "target": "iterator_1", "targetHandle": "iterator_1-input-loop_back" } ] ``` The first refuses compilation with `Circular dependency detected in workflow`; the second compiles, because removing the loopback edge before checking leaves nothing but a single forward connection. ## Why Recorded under [OPEN-25](https://flowdrop.io/spec/rulings/open-25), [OPEN-32](https://flowdrop.io/spec/rulings/open-32). ## Related rules - Names: CMP-1, CMP-6 - Referenced by: CMP-1, CMP-6, ORC-7 --- Rule identifiers are permanent and are never renumbered. This specification carries no implementation status: each implementation publishes its own standing against these rules. Licensed CC BY 4.0.