✗
Failing This test is currently failing.
Failed: backend-exec
Failure Output
Showing last 10 of 14 lines
--> tests/regression/300_ADVANCED_FEATURES/360_TAPS_OBSERVERS/504_tap_when_clause_filtering/input.kz:62:0
❌ Compiler coordination error: Incomplete branch coverage
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/360_TAPS_OBSERVERS/504_tap_when_clause_filtering/backend.zig:94:13: 0x1049bdfdf in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/360_TAPS_OBSERVERS/504_tap_when_clause_filtering/backend.zig:190:28: 0x1049beccb in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^ Code
// ============================================================================
// VERIFIED REGRESSION TEST - DO NOT MODIFY WITHOUT DISCUSSION
// ============================================================================
// Test 504: Tap when clause filtering
// Tests that tap `when` clauses generate conditional code
//
// The `when` clause in tap definitions filters which events trigger the tap:
// - `~tap(foo -> *) | branch b when b.flag |> handler(...)` generates:
// if (b.flag) { handler(...); }
//
// This test verifies:
// - Only entities with has_damage=true trigger handle-damage
// - Entities 1 and 3 (has_damage=false) are filtered out
// - Entities 2 and 4 (has_damage=true) trigger the tap handler
~import std/io
~import std/control
~import std/taps
const std = @import("std");
const Entity = struct {
id: u32,
health: i32,
has_damage: bool,
};
// Producer event - broadcasts entities
~pub event process-entity { e: Entity }
| entity Entity
~proc process-entity|zig {
return .{ .entity = e };
}
// TAP: Only fires when entity has damage
~tap(process-entity -> *)
| entity ent when ent.has_damage |> handle-damage(e: ent)
~event handle-damage { e: Entity }
~proc handle-damage|zig {
std.debug.print("DAMAGE on Entity {d}!\n", .{ e.id });
}
// Test entities - 2 with damage, 2 without
const entities = [_]Entity{
.{ .id = 1, .health = 100, .has_damage = false }, // Should NOT trigger
.{ .id = 2, .health = 80, .has_damage = true }, // Should trigger
.{ .id = 3, .health = 50, .has_damage = false }, // Should NOT trigger
.{ .id = 4, .health = 30, .has_damage = true }, // Should trigger
};
~event noop {}
~proc noop|zig {}
~event print-done {}
~proc print-done|zig {
std.debug.print("Done!\n", .{});
}
~for(&entities)
| each e |> process-entity(e)
| entity _ |> noop()
| done |> print-done()
Expected output
DAMAGE on Entity 2!
DAMAGE on Entity 4!
Done!
Test Configuration
MUST_RUN