○
Planned This feature is planned but not yet implemented.
DESIGN: Interceptor feature not yet implemented. Should error when intercepting [opaque] events.
Code
// Test 365_004: Opaque Events Cannot Be Intercepted
//
// Tests that events marked [opaque] are protected from interception.
// This provides a way to opt-out of the interceptor system for
// security-sensitive or performance-critical events.
const std = @import("std");
~import std/interceptors
// Opaque event - cannot be intercepted
~[opaque] event auth.verify { token: []const u8 }
| valid u32
| invalid []const u8
~proc auth.verify|zig {
if (std.mem.eql(u8, token, "secret")) {
return .{ .valid = 42 };
}
return .{ .invalid = "bad token" };
}
// Attempt to intercept opaque event - COMPILE ERROR
~intercept(* -> auth.verify)
| payload p |> payload { token: p.token ++ "_hacked" }
~auth.verify(token: "secret")
| valid v |> _
| invalid _ |> _
Must fail at frontend compile:
Parsing or type-checking must reject the program.
Expected compiler error
error[KORU002]: module not found: '$std/interceptors'
--> tests/regression/300_ADVANCED_FEATURES/365_INTERCEPTORS/365_004_opaque_protection/input.kz:8:1
|
8 | ~import "std/interceptors"
| ^
hint: check the import path, koru.json paths, and KORU_STDLIB/KORU_PATH environment variables