From cf2415cc6527cb92898694aae88fd84d54aac28c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 03:08:56 -0300 Subject: A failed builtin's err replaces its msg, and (xN) is a running total A builtin failing a ctl write logged its Verbose announcement, its words as a msg, and the write's err, so the same failure again never repeated the newest record and never collapsed. Its err alone is logged now (the msg is still shown and kept in +Messages). A repeat of a record a follower has read is a new line with the running total, (xN) being N in all. fs.md states both rules. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/ninep/ctl.zig') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 76f09084..d1bb5907 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1406,3 +1406,18 @@ test "Shell refuses a path that is no executable, and bare it goes back to the d var want: [300]u8 = undefined; try testing.expect(std.mem.indexOf(u8, rd(p, root_ctl, 0, 8192).bytes, try std.fmt.bufPrint(&want, "Shell {s}\n", .{config.defaultShell()})) != null); } + +test "a builtin that fails a ctl write logs only its err, so the same failure again is counted" { + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + p.update(.tick); // the pane's `new` is logged first + while (p.nextEffect()) |_| {} + const ctl_node = @intFromEnum(tree.TopFile.ctl); + for (0..3) |_| try testing.expectEqual(Status.err, wr(p, ctl_node, "Kill zzz\n").reply.status); + const log = @intFromEnum(tree.TopFile.log); + const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; + const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes; + try testing.expect(std.mem.endsWith(u8, text, "err - ctl: Kill: no running command has that first word \"Kill zzz\" (x3)\n")); + try testing.expect(std.mem.indexOf(u8, text, "msg - Kill") == null); + _ = call(p, .{ .tag = 3, .op = .release, .node = log, .handle = h }); +} -- cgit v1.3