✓
Passing This code compiles and runs correctly.
Code
// Test: `koruc explain` on a pump — std/pump's explainer folds the
// create/join/run sites in document order and reports the composition:
// participants in join order, the verbs each answers, drain policy
// (every `live` answered → the pump retires), the idle policy (no `!
// idle` arm + a `wait` verb → the union wait), and the `| drained` arm.
// The fold reuses the transforms' own checks — PH.calleeDecl and the
// verb contract — so the report cannot drift from what run emits.
// post.sh drives both the text rows and the typed json catalog; the
// program itself drains in 3 steps (MUST_RUN proves the report true).
import std/io
import std/pump
import std/explain
std/pump:create(main)
| drained |> std/io:print.ln("pump drained")
std/pump(main)
! step |> step()
! live |> live()
! wait i |> wait(i)
std/pump:run(main)
Actual
pump drained
Expected output
pump drained
Test Configuration
MUST_RUN
Post-validation Script:
#!/bin/bash
# `koruc explain` gathers [explainer] reports: std/pump reports the folded
# composition — participants in join order, verbs per join, drain and idle
# policy. Asserted in text rows and the typed json catalog.
set -e
echo "=== koruc explain (text) ==="
TEXT=$(koruc "$KORU_INPUT" explain 2>&1)
echo "$TEXT"
echo "$TEXT" | grep -q "📖 std/pump" || { echo "FAIL: pump report missing"; exit 1; }
echo "$TEXT" | grep -q "participants = 1" || { echo "FAIL: participant count missing"; exit 1; }
echo "$TEXT" | grep -q "drained_arm = true" || { echo "FAIL: drained arm missing"; exit 1; }
echo "$TEXT" | grep -q "run = true" || { echo "FAIL: run state missing"; exit 1; }
echo "$TEXT" | grep -q "drains = true" || { echo "FAIL: drain policy missing"; exit 1; }
echo "$TEXT" | grep -q "idle = union wait over 1 interest" || { echo "FAIL: idle policy missing"; exit 1; }
echo "$TEXT" | grep -q "j0.step = input:step" || { echo "FAIL: step callee missing"; exit 1; }
echo "$TEXT" | grep -q "j0.live = input:live" || { echo "FAIL: live callee missing"; exit 1; }
echo "$TEXT" | grep -q "j0.wait = input:wait" || { echo "FAIL: wait callee missing"; exit 1; }
echo "$TEXT" | grep -q "join #0: step + live + wait(i)" || { echo "FAIL: join summary missing"; exit 1; }
echo "=== koruc explain json (typed) ==="
JSON=$(koruc "$KORU_INPUT" explain json 2>&1)
echo "$JSON"
echo "$JSON" | grep -q '"participants":1' || { echo "FAIL: count not typed"; exit 1; }
echo "$JSON" | grep -q '"drained_arm":true' || { echo "FAIL: drained not typed"; exit 1; }
echo "$JSON" | grep -q '"drains":true' || { echo "FAIL: drain policy not typed"; exit 1; }
echo "$JSON" | grep -q '"j0.step":"input:step"' || { echo "FAIL: callee spelling missing"; exit 1; }
echo "=== PASS: explain reports the pump composition ==="