✓
Passing This code compiles and runs correctly.
Code
// codemod:skip — runtime-eval blocks use internal (snake) names; flow_parser does not normalize.
// Test: std/runtime:run auto-discharges on budget exhaustion
~import std/runtime
~import std/io
const std = @import("std");
~pub event open-handle {}
| opened []const u8<opened!>
~proc open-handle|zig {
std.debug.print("OPEN\n", .{});
return .{ .opened = "h1" };
}
~pub event close-handle { handle: []const u8<!opened> }
~proc close-handle|zig {
std.debug.print("CLOSE\n", .{});
}
~pub event step {}
~proc step|zig {
std.debug.print("STEP\n", .{});
}
~std/runtime:register(scope: "api") {
open-handle(1)
close-handle(1)
step(1)
}
const TEST_SOURCE = "~open-handle()\n| opened _ |> step()";
~std/runtime:run(source: TEST_SOURCE, scope: "api", budget: 1)
| result _ |> std/io:print.ln("OK")
| exhausted _ |> std/io:print.ln("EXHAUSTED")
| parse-error _ |> std/io:print.ln("PARSE ERROR")
| validation-error _ |> std/io:print.ln("VALIDATION ERROR")
| shape-error _ |> std/io:print.ln("SHAPE ERROR")
| event-denied _ |> std/io:print.ln("EVENT DENIED")
| dispatch-error _ |> std/io:print.ln("DISPATCH ERROR")
| scope-not-found _ |> std/io:print.ln("SCOPE NOT FOUND")
Actual
OPEN
CLOSE
[AUTO-DISCHARGE] Invoked 'close-handle' for handle 'h1' [main:opened]
EXHAUSTED
Expected output
OPEN
CLOSE
[AUTO-DISCHARGE] Invoked 'close-handle' for handle 'h1' [main:opened]
EXHAUSTED
Test Configuration
MUST_RUN