004 opaque protection

○ 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 { user_id: u32 }
| invalid { reason: []const u8 }

~proc auth.verify {
    if (std.mem.eql(u8, token, "secret")) {
        return .{ .valid = .{ .user_id = 42 } };
    }
    return .{ .invalid = .{ .reason = "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 _ |> _
input.kz

Test Configuration

Expected Behavior:

FRONTEND_COMPILE_ERROR