✓
Passing This code compiles and runs correctly.
Code
// Test: `koruc explain` reports the store's facet verdict — the
// `facets_declared` row now names enforcement instead of reporting the
// gap. post.sh drives the text catalog: `insert enforces them` names the
// `?!violated` contract the generated events carry.
import std/proto
import std/refine
import std/store
import std/io
import std/explain
std/proto:i64(Port)
std/proto(Server) {
port: Port
weight: i64
}
std/refine(Server) {
port: Port & >1024 & <=65535
weight: i64
}
std/store:new(fleet, capacity: 8) { web: Server }
std/store:insert(fleet) { web.port: 8080, web.weight: 5 }
Flows
flow ~i64 click a branch to expand · @labels scroll to their anchor
i64 (expr: Port)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Server, source: port: Port
weight: i64)
flow ~std/refine click a branch to expand · @labels scroll to their anchor
std/refine (Server, source: port: Port & >1024 & <=65535
weight: i64)
flow ~new click a branch to expand · @labels scroll to their anchor
new (fleet, capacity: 8, source: web: Server)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (fleet, source: web.port: 8080, web.weight: 5)
Test Configuration
Post-validation Script:
#!/bin/bash
# `koruc explain` on a refined-member store: std/store's facet row names the
# enforcement verdict — `insert enforces them` — and the declared count is
# the same metFields fold the generated `?!violated` guards read.
set -e
echo "=== koruc explain (text) ==="
TEXT=$(koruc "$KORU_INPUT" explain 2>&1)
echo "$TEXT"
echo "$TEXT" | grep -q "📖 std/store" || { echo "FAIL: store report missing"; exit 1; }
echo "$TEXT" | grep -q "facets_declared = 1" || { echo "FAIL: facet count missing"; exit 1; }
echo "$TEXT" | grep -q "insert enforces them" || { echo "FAIL: enforcement verdict missing"; exit 1; }
if echo "$TEXT" | grep -q "does NOT enforce"; then
echo "FAIL: the does-not-enforce row is stale — insert enforces"; exit 1
fi
echo "=== koruc explain json (typed) ==="
JSON=$(koruc "$KORU_INPUT" explain json 2>&1)
echo "$JSON"
echo "$JSON" | grep -q '"facets_declared":1' || { echo "FAIL: facet count not typed"; exit 1; }
echo "=== PASS: explain reports insert enforcement ==="