✓
Passing This code compiles and runs correctly.
Code
// Layer 1 demonstration: subflows are ALWAYS locally pure
// because they are pure composition of dispatches. The body of
// a subflow has no execution that produces side effects.
//
// Whether the subflow is *transitively* pure depends on what
// it dispatches into — that is Layer 2 (covered by 410_007/010).
// Here we only assert: is_pure=true on the subflow itself.
const std = @import("std");
~[pure] event a {}
~[pure] event b {}
~proc a|zig {}
~proc b|zig {}
// Subflow composing two dispatches. Locally pure by structure.
~a() |> b()
Flows
flow ~a click a branch to expand · @labels scroll to their anchor
a
Test Configuration
MUST_RUN
Post-validation Script:
#!/bin/bash
# Verify: subflow is_pure = true ALWAYS (Layer 1 structural fact).
#
# Re-pointed 2026-07-03: the serialized-AST Zig literal (backend.zig /
# program_ast.zig) is RETIRED — the backend loads program.ast.json at
# runtime, so that JSON is the serialized AST and the artifact to assert
# against. The old grep-the-Zig-literal form passed on stale artifacts
# only (the harness never cleaned program_ast.zig).
if [ ! -f "program.ast.json" ]; then
echo "✗ program.ast.json not found"
exit 1
fi
python3 - <<'EOF'
import json, sys
d = json.load(open('program.ast.json'))
def find(kind, name):
for it in d['items']:
if kind in it:
v = it[kind]
segs = (v.get('path') or {}).get('segments') or []
if segs and segs[-1] == name:
return v
return None
def first_flow():
for it in d['items']:
if 'flow' in it:
return it['flow']
return None
def check(entity, label, field, want):
if entity is None:
print(f"✗ Could not find {label}")
sys.exit(1)
got = entity.get(field)
if got is not want:
print(f"✗ FAIL: {label} should have {field} = {str(want).lower()}, got {str(got).lower()}")
sys.exit(1)
f = first_flow()
check(f, 'subflow', 'is_pure', True)
print("✓ subflow: is_pure = true (Layer 1 structural fact — composition is always locally pure)")
print()
print("✓ Subflow correctly marked locally pure regardless of dispatch contents")
EOF
exit $?