✓
Passing This code compiles and runs correctly.
Code
// Pins profiler + std/store:query — tap transform can run before the query
// sweep transform; store.kz peels tap-wrapped effect bodies to the author's
// invocation (KORU161 "sweep body must start with an invocation").
//
// Store sweeps lower to direct handler calls — the pin also runs a runtime flow
// so the trace proves profiling stayed live.
[profile]import std/profiler
import std/store
import std/io
std/store:new(items, capacity: 4) { v: i64 }
std/store:insert(items) { v: 10 }
| row _ |> _
std/store:insert(items) { v: 20 }
| row _ |> _
std/store:query(items)
! query e |> std/io:print.ln("v={{ e.v:d }}")
tor ping {}
proc ping|zig {
const std = @import("std");
std.debug.print("query profile ok\n", .{});
}
ping() |> std/io:print.ln("profiled query run complete")
Actual
v=10
v=20
query profile ok
profiled query run complete
Expected output
v=10
v=20
query profile ok
profiled query run complete
Flows
flow ~new click a branch to expand · @labels scroll to their anchor
new (items, capacity: 4, source: v: i64)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (items, source: v: 10)
flow ~insert click a branch to expand · @labels scroll to their anchor
insert (items, source: v: 20)
flow ~query click a branch to expand · @labels scroll to their anchor
query (items)
flow ~ping click a branch to expand · @labels scroll to their anchor
ping
Test Configuration
MUST_RUN
Compiler Flags:
--profilePost-validation Script:
#!/bin/bash
if [ -f "koru_profile.snapshot.json" ]; then
PROFILE_FILE="koru_profile.snapshot.json"
else
PROFILE_FILE="/tmp/koru_profile.json"
fi
if [ ! -f "$PROFILE_FILE" ]; then
echo "ERROR: no trace at $PROFILE_FILE"
exit 1
fi
if ! grep -q '"traceEvents"' "$PROFILE_FILE"; then
echo "ERROR: missing traceEvents"
cat "$PROFILE_FILE"
exit 1
fi
if ! grep -q '"input:ping"' "$PROFILE_FILE"; then
echo "ERROR: input:ping transition missing"
cat "$PROFILE_FILE"
exit 1
fi
if ! grep -q '"std.io:print.ln"' "$PROFILE_FILE"; then
echo "ERROR: std.io:print.ln transition missing"
cat "$PROFILE_FILE"
exit 1
fi
if ! grep -q '^]}$' "$PROFILE_FILE"; then
echo "ERROR: JSON not closed"
cat "$PROFILE_FILE"
exit 1
fi
if grep -qE 'write-event|write-header|write-footer' "$PROFILE_FILE"; then
echo "ERROR: profiler observed itself"
cat "$PROFILE_FILE"
exit 1
fi
echo "✓ trace valid"
exit 0