✓
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
~tor add-five { value: i32 } -> i32
~proc add-five|zig {
std.debug.print("add_five: {} + 5 = {}\n", .{value, value + 5});
return value + 5;
}
// Subflow that calls add-five
~tor double { value: i32 } -> i32
~double = add-five(value): r -> r
// Observer that should be called by the tap
~tor observer {}
~proc observer|zig {
std.debug.print("TAP FIRED: add_five -> result transition observed!\n", .{});
}
// Print final result
~tor print-final { value: i32 }
~proc print-final|zig {
std.debug.print("Final: {}\n", .{value});
}
// TAP: observe add-five's bare-return transition; `: v` binds the produced
// value (unused here — the observer just fires), mirroring 508/505.
~tap(add-five -> *): v |> observer()
// Execute the subflow - tap should fire
~double(value: 10): 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
Flows
subflow ~double click a branch to expand · @labels scroll to their anchor
add-five (value)
flow ~tap click a branch to expand · @labels scroll to their anchor
tap (add-five -> *)
flow ~double click a branch to expand · @labels scroll to their anchor
double (value: 10)
Test Configuration
MUST_RUN