✗
Failing This test is currently failing.
Failed: frontend
Failure Output
error[PARSE005]: redundant explicit label 'tx:' — the value 'tx' already puns to 'tx'
--> tests/regression/300_ADVANCED_FEATURES/335_OBLIGATION_STRESS/335_023_disconnect_before_rollback/input.kz:20:1
|
20 | | then |> app/db:disconnect(conn: c) |> app/db:rollback(tx: tx, conn: c)
| ^
hint: drop the label: write 'tx' instead of 'tx: tx' Code
// PIN: on the failure path, disconnect is called before rollback — same
// LIFO violation as 335_022 but on the error branch. The rule is symmetric:
// both commit AND rollback require the connection still live (conn: <connected>).
// Disconnecting first in the error path is as wrong as in the happy path.
//
// Legal order (330_027/input.kz:8): rollback(tx) |> disconnect(conn: c)
// This test inverts that order.
//
// Grounding:
// - error-branch rollback pattern: 330_027/input.kz:8 (| else |> rollback(tx) |> disconnect)
// - rollback requiring conn: ./db.kz:40 (conn: *Connection<connected>)
// - disconnect consuming conn: ./db.kz:46 (~pub event disconnect { conn: *Connection<!connected> })
~import app/db
~import std/control
const error_occurred = true;
~app/db:connect(url: "postgres://localhost/test")
| connected c |> app/db:query(conn: c)
| started tx |> std/control:if(error_occurred)
| then |> app/db:disconnect(conn: c) |> app/db:rollback(tx: tx, conn: c)
| else |> app/db:commit(tx: tx, conn: c) |> app/db:disconnect(conn: c)
Must contain:
Use-after-dischargeError Verification
Actual Compiler Output
error[PARSE005]: redundant explicit label 'tx:' — the value 'tx' already puns to 'tx'
--> tests/regression/300_ADVANCED_FEATURES/335_OBLIGATION_STRESS/335_023_disconnect_before_rollback/input.kz:20:1
|
20 | | then |> app/db:disconnect(conn: c) |> app/db:rollback(tx: tx, conn: c)
| ^
hint: drop the label: write 'tx' instead of 'tx: tx'Imported Files
// Library: DB with explicit rollback-needs-connection constraint.
// Same fixture as 335_022/db.kz — rollback mirrors commit (both need conn live).
//
// Grounding: same as 335_022/db.kz
const std = @import("std");
const Connection = struct {
id: i32,
};
const Transaction = struct {
id: i32,
};
~pub event connect { url: []const u8 }
| connected *Connection<connected!>
~proc connect|zig {
const c = std.heap.page_allocator.create(Connection) catch unreachable;
c.* = Connection{ .id = 1 };
return .{ .connected = c };
}
~pub event query { conn: *Connection<connected> }
| started *Transaction<transaction!>
~proc query|zig {
const t = std.heap.page_allocator.create(Transaction) catch unreachable;
t.* = Transaction{ .id = 1 };
return .{ .started = t };
}
~pub event commit { tx: *Transaction<!transaction>, conn: *Connection<connected> }
~proc commit|zig {
std.debug.print("Committing\n", .{});
}
~pub event rollback { tx: *Transaction<!transaction>, conn: *Connection<connected> }
~proc rollback|zig {
std.debug.print("Rolling back\n", .{});
}
~pub event disconnect { conn: *Connection<!connected> }
~proc disconnect|zig {
std.debug.print("Disconnecting\n", .{});
}
Test Configuration
MUST_FAIL