✓
Passing This code compiles and runs correctly.
Code
// Test: a store column that expands a refined proto field is judged at
// insert — `std/refine(Server) { port: Port & >1024 }` becomes a
// `?!violated` guard on the generated insert events (the same `metFields`
// fold the explainer reports). `web.port: 80` produces into the branch
// carrying the column spelling, and the caller HANDLES it
// (`| violated f |>`) instead of trapping.
//
// Expected: runs clean — `committed` for the valid row, `rejected web.port`
// for the breach, and the query reads back only the committed row
// (the refused insert never wrote).
import std/proto
import std/refine
import std/store
import std/io
std/proto:i64(Port)
std/proto(Server) {
port: Port
}
std/refine(Server) {
port: Port & >1024 & <=65535
}
std/store:new(fleet, capacity: 8) { web: Server }
std/store:insert(fleet) { web.port: 8080 }
| row r |> std/io:print.ln("committed {{ r:d }}")
std/store:insert(fleet) { web.port: 80 }
| violated f |> std/io:print.ln("rejected {{ f:s }}")
std/store:query(fleet)
! query e |> std/io:print.ln("web.port {{ e.web.port:d }}")
Actual
committed 16777216
rejected web.port
web.port 8080
Expected output
committed 16777216
rejected web.port
web.port 8080
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)
flow ~std/refine click a branch to expand · @labels scroll to their anchor
std/refine (Server, source: port: Port & >1024 & <=65535)
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)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (fleet, source: web.port: 80)
flow ~query click a branch to expand · @labels scroll to their anchor
query (fleet)
Test Configuration
MUST_RUN