From 4c2125ecf47588d33f9894c1fdf2833d0512f3b4 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 03:20:04 -0300 Subject: client #2, one frontend a session: the daemon answers `other ` for an attach to a session attached already (as it did for one of the other kind), so a second `pardes --attach` or `pardes-gui --attach` on this machine is a replica client through the replica socket, the path a remote one takes; a session tells the daemon its clients (SO_PEERCRED on each replica socket, at every join and leave) and `--ps` lists `client ` under it; the tty's per-terminal Screens (Screen.create/drop/destroy, primary, its stub and Killed slot), the Poster and its `from` input, the Gui's window-fields swap (window_fields, GuiWindow, copyWindow, freshWindow, follow, route, openAnotherWindow, closeView, windowsOpen, closeOtherWindows, resumeWindows), drawOthers and every harness's extra terminals (snapshot.zig's `start ... views=N` and `view `, e2e_harness's initView and drainOthers, PARDES_TEST_VIEWS in both frontends, the GUI feed's `view;`, the monkey's --views) go; the pump draws the one view this process shows (views.shown), through drawOne when a client's input was the last; an Upgrade from a build that kept a second terminal of its own lets it go (its stub told it is detached) and closes its view; deleted: views.snap, views-term.snap and views-pan.snap with their goldens (the in-process second terminal they drove is gone; views.zig's unit tests keep the per-view cursor, layout, register, sizing, closing and panning behaviour, test/replicas.zig and the soak the views of clients); the two views.zig tests that drew through drawOthers draw through drawOne; daemon.py's second terminal is a client listed by --ps, typed into in both terminals, detached from inside and closed; its second window a client listed by --ps and closed; the reference and next-daemon.md say so; no golden changes; gates: core-test 956/956 both, behaviour-test 248/248 both, unit-test 1487/1488 tui and 1530/1531 gui, pane-test 171/172 both, snap all 102 ok, process-test 0 of 37 failed on both, hxdiff 19 and hxparity 6 mismatches (the base's names), hxgolf 0, replicas, addon-test, gui-golden and monkey-gui 0 of 1 failed, daemon.py main, --window-clients and --gui ok, soak local pass (differ, mispred, view_bad, lost 0) Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/monkey.zig | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'test/monkey.zig') diff --git a/test/monkey.zig b/test/monkey.zig index 70a4b4e4..243f2fbe 100644 --- a/test/monkey.zig +++ b/test/monkey.zig @@ -1,6 +1,6 @@ // pardes-monkey: random snapshot scripts against the tty, hunting panics. // -// zig build monkey -Dplatform=tui -- [steps] [--from=N] [--out=DIR] [--keep] [--views=N] +// zig build monkey -Dplatform=tui -- [steps] [--from=N] [--out=DIR] [--keep] // // Each seed makes one script (a fixed seed makes the same script, so a hit // replays): keys and leader bursts, typing, mouse presses, drags and wheel, @@ -9,10 +9,7 @@ // /tmp/pardes-monkey), and a panic is a record in the app's crash file // (src/crash.zig, in the script's fake home: found even when the crash cut // the script short) or a `.zig:N:N: 0x` stack frame in the report or the -// grid it captured (a trace renders INTO the screen). --views=N gives the -// session N terminals, each a view of it (views.zig), and types into and -// sizes each in turn, a `view` switch among the steps. A hit -// keeps DIR/seed-N.snap, its captures and its report; the rest are deleted. +// grid it captured (a trace renders INTO the screen). A hit keeps DIR/seed-N.snap, its captures and its report; the rest are deleted. // A panic's trace can scroll off a small grid: replay the kept script, or // run the app in a larger pty. Every hit gets a fix and a pinned regression // script in test/snapshots/. @@ -28,9 +25,6 @@ const Script = struct { gpa: std.mem.Allocator, rows: u16 = 24, cols: u16 = 80, - /// Each terminal's size, and the one typed into (`--views`). - sizes: [4][2]u16 = @splat(.{ 24, 80 }), - view: usize = 0, fn line(s: *Script, comptime fmt: []const u8, args: anytype) !void { try s.out.print(s.gpa, fmt ++ "\n", args); @@ -43,24 +37,18 @@ const commands = [_][]const u8{ "Newcol", "Find", "Grep", "Joincol", "Help", "Du const leader_keys = "abcdefghijklmnopqrstuvwxyz0123456789$^"; const typed = "abcdefghijklmnopqrstuvwxyz0123456789 -_=+,:;()"; -fn generate(gpa: std.mem.Allocator, seed: u64, steps: usize, views: usize) ![]u8 { +fn generate(gpa: std.mem.Allocator, seed: u64, steps: usize) ![]u8 { var prng = std.Random.DefaultPrng.init(seed); const random = prng.random(); var s: Script = .{ .gpa = gpa }; - try s.line("# pardes-monkey seed {d}, {d} steps, {d} views", .{ seed, steps, views }); + try s.line("# pardes-monkey seed {d}, {d} steps", .{ seed, steps }); try s.line("file bad.txt hello \\xff\\xfe world\\nlatin-1 caf\\xe9 tail\\ntruncated \\xe6\\x97 here\\nend\\n", .{}); try s.line("file wide.txt {s}tail\\nsecond line\\n", .{std.mem.asBytes(&@as([8][37]u8, @splat("\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e ".*)))}); try s.line("lines long.txt 400 some words after the number, long enough to wrap in a narrow pane", .{}); - if (views > 1) try s.line("start 24 80 views={d} bad.txt", .{views}) else try s.line("start 24 80 bad.txt", .{}); + try s.line("start 24 80 bad.txt", .{}); try s.line("wait 8000 Newcol Joincol", .{}); try s.line("stable 300 5000", .{}); for (0..steps) |step| { - if (views > 1 and random.uintLessThan(u8, 4) == 0) { - s.sizes[s.view] = .{ s.rows, s.cols }; - s.view = random.uintLessThan(usize, views); - s.rows, s.cols = s.sizes[s.view]; - try s.line("view {d}", .{s.view + 1}); - } const wide = s.cols >= 70 and s.rows >= 6; switch (random.uintLessThan(u8, 12)) { // A workspace word, run with a middle click: new columns make @@ -177,7 +165,7 @@ pub fn main(init: std.process.Init) !void { const io = init.io; const args = try init.minimal.args.toSlice(init.arena.allocator()); if (args.len < 4) { - std.debug.print("usage: pardes-monkey [steps] [--from=N] [--out=DIR] [--keep] [--tape=DIR] [--views=N] [--dump]\n", .{}); + std.debug.print("usage: pardes-monkey [steps] [--from=N] [--out=DIR] [--keep] [--tape=DIR] [--dump]\n", .{}); std.process.exit(2); } const snap = args[1]; @@ -191,15 +179,12 @@ pub fn main(init: std.process.Init) !void { // --tape=DIR: each seed's sessions record their tapes there and the // seed is a hit if one does not replay (pardes-snap --tape). var tape: ?[]const u8 = null; - var views: usize = 1; // --dump (with --tape): each replay loads the session's dump at its end // too (pardes-snap --dump). var dump = false; var positional: usize = 0; for (args[3..]) |a| { - if (std.mem.startsWith(u8, a, "--views=")) { - views = std.math.clamp(try std.fmt.parseInt(usize, a["--views=".len..], 10), 1, 4); - } else if (std.mem.startsWith(u8, a, "--from=")) { + if (std.mem.startsWith(u8, a, "--from=")) { from = try std.fmt.parseInt(u64, a["--from=".len..], 10); } else if (std.mem.eql(u8, a, "--keep")) { keep = true; @@ -222,7 +207,7 @@ pub fn main(init: std.process.Init) !void { var hits: usize = 0; var seed = from; while (seed < from + seeds) : (seed += 1) { - const script = try generate(gpa, seed, steps, views); + const script = try generate(gpa, seed, steps); defer gpa.free(script); var path_buf: [4096]u8 = undefined; const path = try std.fmt.bufPrint(&path_buf, "{s}/seed-{d}.snap", .{ out, seed }); -- cgit v1.3