✗
Failing This test is currently failing.
Failed: wrong-error
Failure Output
error[KORU030]: Phantom state mismatch: argument 'tx' has no tracked phantom state, but event requires one of '<!started|!active>'.
--> phantom_semantic_check:10:0
❌ Compiler coordination error: Phantom semantic validation failed
error: CompilerCoordinationFailed
???:?:?: 0x1001679d3 in _backend.RuntimeEmitter.emit (???)
???:?:?: 0x100168b63 in _backend.main (???) Code
// Ground truth for korulang.org phantom explorer — commit but forget close
//
// With --auto-discharge=disable, active! connection must be closed explicitly.
//
// EXPECTED: Compiler error — active! not discharged
~import app/db
~app/db:open(connstr: "postgres://localhost/test")
| connected c |> app/db:tx.begin(conn: c)
| tx t |> app/db:tx.exec(tx: t, sql: "INSERT INTO users VALUES (1, 'alice')")
| ok r |> app/db:tx.commit(tx: r)
| committed _ |> _
| connection-failed |> _
Must contain:
not dischargedError Verification
Actual Compiler Output
error[KORU030]: Phantom state mismatch: argument 'tx' has no tracked phantom state, but event requires one of '<!started|!active>'.
--> phantom_semantic_check:10:0
❌ Compiler coordination error: Phantom semantic validation failed
error: CompilerCoordinationFailed
???:?:?: 0x1001679d3 in _backend.RuntimeEmitter.emit (???)
???:?:?: 0x100168b63 in _backend.main (???)Flows
flow ~open click a branch to expand · @labels scroll to their anchor
open (connstr: "postgres://localhost/test")
Imported Files
// open/tx lifecycle API — ground truth for korulang.org phantom explorer
const std = @import("std");
const Connection = struct { handle: i32 };
const Transaction = struct { conn_handle: i32 };
~pub event open { connstr: []const u8 }
| connected *Connection<connected!>
| connection-failed
~proc open|zig {
_ = connstr;
const c = std.heap.page_allocator.create(Connection) catch unreachable;
c.* = Connection{ .handle = 42 };
return .{ .connected = c };
}
~pub event tx.begin { conn: *Connection<!connected|!active> } -> *Transaction<started!>
~proc tx.begin|zig {
const t = std.heap.page_allocator.create(Transaction) catch unreachable;
t.* = Transaction{ .conn_handle = conn.handle };
return t;
}
~pub event tx.exec { tx: *Transaction<!started|!active>, sql: []const u8 } -> *Transaction<active!>
~proc tx.exec|zig {
std.debug.print("Executing: {s}\n", .{sql});
return tx;
}
~pub event tx.commit { tx: *Transaction<!active> } -> *Connection<active!>
~proc tx.commit|zig {
std.debug.print("COMMIT\n", .{});
const c = std.heap.page_allocator.create(Connection) catch unreachable;
c.* = Connection{ .handle = tx.conn_handle };
std.heap.page_allocator.destroy(tx);
return c;
}
~pub event tx.rollback { tx: *Transaction<!active> } -> *Connection<active!>
~proc tx.rollback|zig {
std.debug.print("ROLLBACK\n", .{});
const c = std.heap.page_allocator.create(Connection) catch unreachable;
c.* = Connection{ .handle = tx.conn_handle };
std.heap.page_allocator.destroy(tx);
return .{ .rolled_back = c };
}
~pub event close { conn: *Connection<!active> }
~proc close|zig {
std.debug.print("Connection closed\n", .{});
std.heap.page_allocator.destroy(conn);
}
Test Configuration
MUST_FAIL
Compiler Flags:
--auto-discharge=disable