✓
Passing This code compiles and runs correctly.
Code
// `koruc explain` on a supervised site — std/supervisor's explainer folds
// the site and reports what the declaration hides: the producing call the
// transform retargets, the child's declared vocabulary verbatim (both
// branches void — nothing rides them), the generated step tor + `#`/`@`
// fold the site becomes, the policy it read, and which names the re-entry
// expression resolves in the generated step's scope. The `elaborated`
// section runs the real transform on a clone and prints the generated
// items through the canonical AST printer — the explain view cannot drift
// from what the transform writes because it ran it.
// post.sh drives the text rows and the witness-hash resolution.
import std/io
import std/explain
import std/supervisor
pub tor dial { port: i64 }
| ok
| refused
dial = std/io:print.ln("dial {{ port:d }}...")
|> if (port < 8083)
| then => refused
| else => ok
pub tor connect { port: i64 }
| ok
| refused
connect = dial(port)
| ok => ok
| refused |> std/supervisor:supervised
| retry t when t < 5 |> dial(port: port + 1)
connect(port: 8080)
| ok |> std/io:print.ln("connected")
| refused |> std/io:print.ln("no service in range")
Actual
dial 8080...
dial 8081...
dial 8082...
dial 8083...
connected
Expected output
dial 8080...
dial 8081...
dial 8082...
dial 8083...
connected
Flows
subflow ~dial click a branch to expand · @labels scroll to their anchor
print.ln (expr: "dial {{ port:d }}...")
subflow ~connect click a branch to expand · @labels scroll to their anchor
dial (port)
flow ~connect click a branch to expand · @labels scroll to their anchor
connect (port: 8080)
Test Configuration
MUST_RUN
Post-validation Script:
#!/bin/bash
# `koruc explain` gathers [explainer] reports: std/supervisor reports the
# supervised site — producer, declared vocabulary, generated step/fold,
# policy rows, the re-entry scope lift — then the `elaborated` section
# prints the transform's own output (the pass ran on a clone).
set -e
echo "=== koruc explain (text) ==="
TEXT=$(koruc "$KORU_INPUT" explain 2>&1)
echo "$TEXT"
echo "$TEXT" | grep -q "📖 std/supervisor" || { echo "FAIL: supervisor report missing"; exit 1; }
echo "$TEXT" | grep -q "connect → dial" || { echo "FAIL: site section missing"; exit 1; }
echo "$TEXT" | grep -q "produces = dial(port)" || { echo "FAIL: producer missing"; exit 1; }
echo "$TEXT" | grep -q "declares = | ok | refused" || { echo "FAIL: vocabulary missing"; exit 1; }
echo "$TEXT" | grep -q "all void; nothing rides them" || { echo "FAIL: void honesty missing"; exit 1; }
echo "$TEXT" | grep -q "becomes = __sup_step_L" || { echo "FAIL: step name missing"; exit 1; }
echo "$TEXT" | grep -q "port (the attempt's input)" || { echo "FAIL: scope lift missing"; exit 1; }
echo "$TEXT" | grep -q "the retries-spent counter" || { echo "FAIL: counter row missing"; exit 1; }
echo "=== elaborated section prints the transform's output ==="
echo "$TEXT" | grep -q "elaborated — the transform's output" || { echo "FAIL: elaborated section missing"; exit 1; }
echo "$TEXT" | grep -q "__sup_step_L" || { echo "FAIL: step decl not printed"; exit 1; }
echo "$TEXT" | grep -q "| __more s |> @__sup_L" || { echo "FAIL: fold arm not printed"; exit 1; }
echo "$TEXT" | grep -q "when t < 5 => __more" || { echo "FAIL: retry guard not printed"; exit 1; }
echo "$TEXT" | grep -q "#__sup_L" || { echo "FAIL: label fold not printed"; exit 1; }
echo "=== witness hash resolves via koruc at ==="
echo "$TEXT" | grep -qE "site = \| refused \|> supervised \[[0-9a-z]+\]" || { echo "FAIL: site witness missing"; exit 1; }
HASH=$(echo "$TEXT" | grep -oE "supervised \[[0-9a-z]+\]" | grep -oE "\[[0-9a-z]+\]" | tr -d '[]')
AT=$(koruc "$KORU_INPUT" at "$HASH" 2>&1)
echo "$AT"
echo "$AT" | grep -q "input.k" || { echo "FAIL: at lost the file"; exit 1; }
echo "=== koruc explain json (typed catalog) ==="
JSON=$(koruc "$KORU_INPUT" explain json 2>&1)
echo "$JSON"
echo "$JSON" | grep -q '"std/supervisor"' || { echo "FAIL: report not in catalog"; exit 1; }
echo "$JSON" | grep -q '"becomes"' || { echo "FAIL: step row not in catalog"; exit 1; }
echo "=== PASS: explain reports the supervised elaboration ==="