✓
Passing This code compiles and runs correctly.
Code
// Test: `koruc explain` reports an equality atom like any other term —
// the met facet spells `==8080`, the field's effect is `refuse` (the
// boundary rejects what the equality excludes), and std/list reports the
// same field as enforced. post.sh drives the text rows and the typed json.
import std/proto
import std/refine
import std/list
import std/io
import std/explain
std/proto(Server) {
port: i64
host: string
}
std/refine(Server) {
port: i64 & ==8080
host: string
}
std/list:new(Server)
| list xs |> std/list:push(xs, port: 8080, host: "web-01")
| ok |> std/list:len(xs): n |> std/io:print.ln("len={{ n:d }}") |> std/list:free(xs)
| violated f |> std/io:print.ln("refused")
| err e |> std/io:print.ln("ERR")
Actual
len=1
Expected output
len=1
Flows
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Server, source: port: i64
host: string)
flow ~std/refine click a branch to expand · @labels scroll to their anchor
std/refine (Server, source: port: i64 & ==8080
host: string)
flow ~new click a branch to expand · @labels scroll to their anchor
new (Server)
Test Configuration
MUST_RUN
Post-validation Script:
#!/bin/bash
# `koruc explain` on an equality-refined field: std/refine spells the `==N`
# atom and reports its effect, std/list reports the same field as enforced.
# The catalog cannot call a field declared-only while push guards it.
set -e
echo "=== koruc explain (text) ==="
TEXT=$(koruc "$KORU_INPUT" explain 2>&1)
echo "$TEXT"
echo "$TEXT" | grep -q "📖 std/refine" || { echo "FAIL: refine report missing"; exit 1; }
echo "$TEXT" | grep -q "input:Server" || { echo "FAIL: section heading missing"; exit 1; }
echo "$TEXT" | grep -q "port: i64 & ==8080 — refuse" || { echo "FAIL: eq atom not spelled"; exit 1; }
echo "$TEXT" | grep -q "port.effect = refuse" || { echo "FAIL: eq effect missing"; exit 1; }
echo "$TEXT" | grep -q "host.effect = declared only" || { echo "FAIL: plain field effect missing"; exit 1; }
echo "$TEXT" | grep -q "📖 std/list" || { echo "FAIL: list report missing"; exit 1; }
echo "$TEXT" | grep -q "port.enforced = refuse" || { echo "FAIL: enforcement row missing"; exit 1; }
echo "$TEXT" | grep -q "facets_enforced = 1" || { echo "FAIL: enforcement count missing"; exit 1; }
echo "=== koruc explain json (typed) ==="
JSON=$(koruc "$KORU_INPUT" explain json 2>&1)
echo "$JSON"
echo "$JSON" | grep -q '"port.effect":"refuse"' || { echo "FAIL: eq effect not typed"; exit 1; }
echo "$JSON" | grep -q '"port.enforced":"refuse"' || { echo "FAIL: enforcement not typed"; exit 1; }
echo "$JSON" | grep -q '"facets_enforced":1' || { echo "FAIL: count not typed"; exit 1; }
echo "=== PASS: explain reports the equality atom ==="