Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

test: lock the yolo boot receipts the line REPL draws

Cursor Agent41acef332631
diff --git a/TUI/render_tests.zig b/TUI/render_tests.zig
index 5e04c826..95585871 100644
--- a/TUI/render_tests.zig
+++ b/TUI/render_tests.zig
@@ -36,6 +36,15 @@ test "welcome frame has chrome, prompt, and no offline stub" {
try std.testing.expect(std.mem.indexOf(u8, frame, "offline") == null);
try std.testing.expect(std.mem.indexOf(u8, frame, "Fullscreen") == null);
try std.testing.expect(std.mem.indexOf(u8, frame, "click") == null);
+ // Boot receipts (plugins:/mcp:/companion:) print before alt-screen.
+ try std.testing.expect(std.mem.indexOf(u8, frame, "plugins:") == null);
+ try std.testing.expect(std.mem.indexOf(u8, frame, "companion:") == null);
+ if (std.c.getenv("GRAFF_DUMP_WELCOME")) |path_z| {
+ const vis = try dump_mod.visible(std.testing.allocator, frame);
+ defer std.testing.allocator.free(vis);
+ const io = std.Io.Threaded.global_single_threaded.io();
+ std.Io.Dir.cwd().writeFile(io, .{ .sub_path = std.mem.span(path_z), .data = vis }) catch {};
+ }
}
test "click on a painted fold header expands the tools" {
diff --git a/src/session_connect_tests.zig b/src/session_connect_tests.zig
index 29c4dc58..31a64a2f 100644
--- a/src/session_connect_tests.zig
+++ b/src/session_connect_tests.zig
@@ -44,6 +44,34 @@ test "connectCompanion on interactive yolo queues instead of addServer" {
try std.testing.expect(std.mem.indexOf(u8, src, "companion: {s} (background)") != null);
}
+test "connectCompanion yolo writes the companion receipt and does not addServer" {
+ const main_mod = @import("main.zig");
+ const io = std.testing.io;
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.symLink(io, "/bin/false", "codedb-pro", .{});
+ var path_buf: [std.fs.max_path_bytes]u8 = undefined;
+ const n = try tmp.dir.realPath(io, &path_buf);
+ const saved_path = main_mod.g_path_env;
+ defer main_mod.g_path_env = saved_path;
+ main_mod.g_path_env = path_buf[0..n];
+
+ var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
+ defer arena_state.deinit();
+ var env = std.process.Environ.Map.init(std.testing.allocator);
+ defer env.deinit();
+ var aw: Io.Writer.Allocating = .init(std.testing.allocator);
+ defer aw.deinit();
+ var registry = mcp.Registry.empty(std.testing.allocator, io);
+ defer registry.deinit();
+
+ try session_start.connectCompanion(io, arena_state.allocator(), &registry, .{ .yolo_flag = true }, &aw.writer, false, env);
+ const out = aw.writer.buffered();
+ try std.testing.expect(std.mem.indexOf(u8, out, "companion: codedb-pro (background)") != null);
+ try std.testing.expectEqual(@as(usize, 0), registry.servers.len);
+ try std.testing.expectEqual(@as(usize, 0), registry.tools.len);
+}
+
test "skipOptionalServer keeps deepwiki/mobbin out of the default catalog" {
var env = std.process.Environ.Map.init(std.testing.allocator);
defer env.deinit();
diff --git a/src/session_render.zig b/src/session_render.zig
index 0637ec7d..d47ec938 100644
--- a/src/session_render.zig
+++ b/src/session_render.zig
@@ -238,6 +238,30 @@ test "slice 2: a notice's tone colors the line, a badge colors only itself" {
);
}
+test "slice 2: yolo boot receipts match the plugins line (dim, then reset)" {
+ const saved = ansi.style;
+ ansi.style = ansi.Style.ansi;
+ defer ansi.style = saved;
+ var aw: Io.Writer.Allocating = .init(std.testing.allocator);
+ defer aw.deinit();
+
+ const plugins = "plugins: 16 plugin(s) in 1ms (7 dirs)";
+ const mcp = "mcp: 3 server(s) in background";
+ const companion = "companion: codedb-pro (background)";
+ try std.testing.expectEqualStrings(
+ "\x1b[2m" ++ plugins ++ "\x1b[0m\n",
+ renderTest(&aw, .{ .session_notice = .{ .text = plugins, .tone = .dim } }),
+ );
+ try std.testing.expectEqualStrings(
+ "\x1b[2m" ++ mcp ++ "\x1b[0m\n",
+ renderTest(&aw, .{ .session_notice = .{ .text = mcp, .tone = .dim } }),
+ );
+ try std.testing.expectEqualStrings(
+ "\x1b[2m" ++ companion ++ "\x1b[0m\n",
+ renderTest(&aw, .{ .session_notice = .{ .text = companion, .tone = .dim } }),
+ );
+}
+
test "slice 2: the failover notice, with a frontend and without one" {
const saved = ansi.style;
ansi.style = .{};