✓
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 i32
~proc add-five|zig {
std.debug.print("add_five: {} + 5 = {}\n", .{value, value + 5});
return .{ .result = value + 5 };
}
// Subflow that calls add-five
~event double { value: i32 }
| result i32
~double = add-five(value)
| result r => result r
// Observer that should be called by the tap
~event observer {}
~proc observer|zig {
std.debug.print("TAP FIRED: add_five -> result transition observed!\n", .{});
}
// Print final result
~event print-final { value: i32 }
~proc print-final|zig {
std.debug.print("Final: {}\n", .{value});
}
// 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()
// Execute the subflow - tap should fire
~double(value: 10)
| result r |> print-final(value: r)
Actual
add_five: 10 + 5 = 15
TAP FIRED: add_five -> result transition observed!
Final: 15
Expected output
add_five: 10 + 5 = 15
TAP FIRED: add_five -> result transition observed!
Final: 15
Test Configuration
MUST_RUN