✓
Passing This code compiles and runs correctly.
Code
// Test: the `*` marks a FALLBACK, and the catalog says what it is for. A
// default is not a term any boundary judges — push and insert enforce
// membership, and the fallback is what a boundary that SUPPLIES a value
// would pick — so the report carries it as a declared fact with its
// reader named, never as something already enforced.
//
// Expected: runs clean — `len=1`; post.sh asserts the catalog rows.
import std/proto
import std/refine
import std/list
import std/io
import std/explain
std/proto(Sample) {
mode: i64
}
std/refine(Sample) {
mode: i64 & *1 | 2 | 3
}
std/list:new(Sample)
| list xs |> std/list:push(xs, mode: 2)
| 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 (Sample, source: mode: i64)
flow ~std/refine click a branch to expand · @labels scroll to their anchor
std/refine (Sample, source: mode: i64 & *1 | 2 | 3)
flow ~new click a branch to expand · @labels scroll to their anchor
new (Sample)
Test Configuration
MUST_RUN
Post-validation Script:
#!/bin/bash
# `koruc explain` on a field whose disjunction marks a fallback: the set is
# spelled with its `*`, the effect is `refuse` (push judges membership), and
# the default is reported as DECLARED with the reader it waits for named.
# `facets_enforced` counts the guard, not the fallback.
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 "mode: i64 & \*1 | 2 | 3 — refuse" || { echo "FAIL: set not spelled with its default"; exit 1; }
echo "$TEXT" | grep -q "mode.effect = refuse" || { echo "FAIL: effect missing"; exit 1; }
echo "$TEXT" | grep -q "mode.default = 1" || { echo "FAIL: default row missing"; exit 1; }
echo "$TEXT" | grep -q "marks the fallback" || { echo "FAIL: fallback not explained"; exit 1; }
echo "$TEXT" | grep -q "facets_enforced = 1" || { echo "FAIL: guard not counted"; exit 1; }
echo "=== koruc explain json (typed) ==="
JSON=$(koruc "$KORU_INPUT" explain json 2>&1)
echo "$JSON"
echo "$JSON" | grep -q '"mode.default":1' || { echo "FAIL: default not typed"; exit 1; }
echo "$JSON" | grep -q '"mode.effect":"refuse"' || { echo "FAIL: effect not typed"; exit 1; }
echo "$JSON" | grep -q '"facets_enforced":1' || { echo "FAIL: count not typed"; exit 1; }
echo "=== PASS: the catalog reports the fallback as declared ==="