010 optional branch catchall required

✓ Passing This code compiles and runs correctly.

Code

// Test: Optional branches require catch-all when not explicitly handled
//
// MUST_FAIL
//
// Optional branches (| ?name) don't need individual handling,
// but if ANY are unhandled, a catch-all (|? |> _) is REQUIRED.
// This prevents silent data loss.
//
// Expected: Compile error about missing catch-all for optional branches

const std = @import("std");

~event process { value: u32 }
| success { result: u32 }
| ?warning { msg: []const u8 }
| ?debug { details: []const u8 }

~proc process {
    if (value > 100) {
        return .{ .warning = .{ .msg = "Large value" } };
    }
    return .{ .success = .{ .result = value * 2 } };
}

// This should FAIL - optional branches exist but no catch-all
~process(value: 10)
| success |> _
// Missing: |? |> _
input.kz

Error Verification

Actual Compiler Output

[PHASE 2.4] Calling run_pass for transforms\n[PHASE 2.5] Executing comptime_main() - running comptime flows
[PHASE 2.5] Comptime flows complete (29 items)
[PHASE 2.6] Rescanning transformed AST (29 items)
[PHASE 2.6] Rescan complete: 25 comptime events found
  [0] std.compiler:requires
  [1] std.compiler:flag.declare
  [2] std.compiler:command.declare
  [3] std.compiler:coordinate
  [4] std.compiler:context_create
  [5] std.testing:test
  [6] std.testing:validate_mocks
  [7] std.testing:test.with_harness
  [8] std.testing:test.harness
  [9] std.testing:assert
  [10] std.testing:test.property.equivalent
  [11] std.deps:deps
  [12] std.deps:requires.system
  [13] std.deps:requires.zig
  [14] std.control:if
  [15] std.control:for
  [16] std.control:capture
  [17] std.control:const
  [18] std.build:requires
  [19] std.build:variants
  [20] std.build:config
  [21] std.build:command.sh
  [22] std.build:command.zig
  [23] std.build:step
  [24] std.template:define
error[KORU030]: branch 'success' has payload but no binding
  --> structural_check:27:0

❌ Compiler coordination error: Incomplete branch coverage
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/200_COMPILER_FEATURES/220_FLOW_CHECKER/220_010_optional_branch_catchall_required/backend.zig:9356:17: 0x104682433 in emit (backend)
                return error.CompilerCoordinationFailed;
                ^
/Users/larsde/src/koru/tests/regression/200_COMPILER_FEATURES/220_FLOW_CHECKER/220_010_optional_branch_catchall_required/backend.zig:9440:28: 0x1046831bf in main (backend)
    const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
                           ^

Test Configuration

MUST_FAIL