✓
Passing This code compiles and runs correctly.
Code
// ============================================================================
// Test: Taps on Subflows
// Feature: Taps should fire when subflows transition through branches
// Verifies: inline tap emission works for subflow continuations
// ============================================================================
~import "$std/taps"
const std = @import("std");
// Base event: adds 5 to a number
~event add_five { value: i32 }
| result { sum: i32 }
~proc add_five {
std.debug.print("add_five: {} + 5 = {}\n", .{value, value + 5});
return .{ .result = .{ .sum = value + 5 } };
}
// Subflow that calls add_five
~event double { value: i32 }
| result { doubled: i32 }
~double = add_five(value: value)
| result r |> result { doubled: r.sum }
// Observer that should be called by the tap
~event observer {}
| done {}
~proc observer {
std.debug.print("TAP FIRED: add_five -> result transition observed!\n", .{});
return .{ .done = .{} };
}
// Print final result
~event print_final { value: i32 }
| done {}
~proc print_final {
std.debug.print("Final: {}\n", .{value});
return .{ .done = .{} };
}
// TAP: Observe add_five -> result transitions
// This tap should fire when the subflow transitions through add_five's result branch
~tap(add_five -> *)
| result |> observer()
| done |> _
// Execute the subflow - tap should fire
~double(value: 10)
| result r |> print_final(value: r.doubled)
| done |> _
Expected Output
add_five: 10 + 5 = 15
TAP FIRED: add_five -> result transition observed!
Final: 15
Test Configuration
MUST_RUN