--- id: CMP-1 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-1 specification: FlowDrop Workflow Specification 1.0-draft licence: CC BY 4.0 --- # CMP-1 — Compilation is one operation with one failure surface *RT-CMP (Part II) · level: core · profiles: runtime · added in 1.0* Compiling a stored workflow produces the executable plan in a fixed stage order. A caller that hands over an invalid workflow sees one kind of failure, whichever stage detected it. ## The rule > **Normative.** This is the rule. > > 1. Compiling a workflow produces a dependency graph over all of its edges, an execution graph of the nodes that will run, and, for each of those nodes, the mapping the runtime executes it through. > > 2. The stages run in this order: structure preconditions, dependency graph, cycle detection, tool wiring, execution graph, node mappings. > > 3. A failure in any stage is reported to the caller as a single compilation failure, whose message carries the detecting stage's message prefixed exactly once and whose underlying cause remains reachable. ## What it means Compilation runs six stages in a fixed order: structure preconditions, dependency graph, cycle detection, tool wiring, execution graph, node mappings. Wherever in that order something goes wrong, the caller sees one failure shape, not six, and its message names which stage caught it. The detail a fixed order does not make obvious on its own: the prefix is never doubled. A structure precondition (CMP-3) is itself already reported as a compilation failure — the cheapest stage runs first and reports in the same shape everything else does — so wrapping its message a second time could easily stack the prefix twice. It does not: compilation reports the outer message once, and the failure that was actually detected stays reachable underneath it rather than being discarded. ## Example A workflow whose only node has no declared type — a structure precondition, caught at the first stage: ```json title="A node with no declared type" verdict="given" { "id": "wrap_probe", "nodes": [{ "id": "node1" }] } ``` ```json title="What compilation reports" verdict="reported" "Workflow compilation failed: Node node1 must have a type" ``` The failure reachable underneath that message is `Node node1 must have a type` — the detecting stage's own message, present once, not twice. ## Related rules - Names: CMP-3, CMP-5, CMP-6, CMP-9, CMP-11 - Referenced by: CMP-3, CMP-5, CMP-11 --- 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.