diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 09:35:48 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 11:40:11 -0300 |
| commit | 40c9f9ac0b6bf46ed8f1be162cf3c2b58d3e2513 (patch) | |
| tree | f0266ccf08c6033b880ef9dd19330b260c2d34d9 /test | |
| parent | 3f0261245d69e015d4caea0432aefa97747d02ad (diff) | |
| download | pardes-40c9f9ac0b6bf46ed8f1be162cf3c2b58d3e2513.tar.gz pardes-40c9f9ac0b6bf46ed8f1be162cf3c2b58d3e2513.zip | |
client: a client's yank, paste and link are its own frontend's, through the client loop (the reorganisation's runners, step 10b, its third part; the user's ruling: a client's yank fills the CLIENT's clipboard, always): since 12a the session's host no longer makes them for a view a client draws, and its view counts each request (View.yanks, pastes, links and the link), so until now a far client's yank, paste and link did nothing on either machine; after each settle the loop compares the view's three counts with those it has acted on (Link.yanks, pastes and links, from the joined dump's at each join, so a join does none again; only a count that moved forward, so a rollback that puts one back and makes it again is not a second) and its frontend acts on the machine it is shown on: copy (register `+`: the terminal's OSC 52 through vaxis, the window's SDL clipboard), paste (the terminal asks its clipboard and the answer comes back as a paste through the loop's input, the window sends the clipboard's text as a paste at once), open (look.openLink); three more frontend calls, the soak's frontend counting them (y/p/l in its stops line) and answering a paste with one; the soak types ClipYank and ClipPaste now and then; a test through the loop over a frontend that draws nothing (runtime/client.zig: a client's ClipYank, ClipPaste and Look of a URL each reach its frontend once, at once and not again when the session's unit confirms it, the link as typed, and the session's host is asked none of them). Gate: tui core-test 837/980 (143 skipped: the base's and the new test), shell-test 1015/1018, term-test 15/15, pane-test 183/184, kitty-test 45/45, behaviour-test 275/275 and --replay 275/275, process-test 2 of 144 failed (lspcomplete and lspcompletemoved, the base's; headersweep, winch and lsp-client failed once and passed again in the run); gui unit-test 1613/1617 with the base's BaselineHarnessMismatch; the soak (--clients 5) diverged 0, unequal 0, deltas wrong 0, quiet checks 526/0, 550/0, 811/0, unlisted 0, the clients' frontends did 3 yanks and 9 pastes (2/3, 0/3, 1/3), stopped 41/72/71 of 1846/1727/2015, mispredicted 29/40/39 at rtt 30/80/207 (its random inputs changed: ClipYank and ClipPaste among them); daemon.py plain, --far, --games, --window-clients, --upgrade from pardes-tree's pfx-base to this and back; the macOS library for Linux and aarch64-macos and the FreeBSD tui configure; rollback-bench runs; gate-w run3-3 against tree1 PASS: frames 77/77 byte-identical in Debug, unit-test 1613/1617 (no failure the base has not), the alternated windows' pictures identical in all 10 runs, corpus2x -0.105%, perfops 97 counts within 0.1% (largest image-frame on longline +0.026%)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test')
| -rw-r--r-- | test/replicas.zig | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/test/replicas.zig b/test/replicas.zig index 2d199c60..69207970 100644 --- a/test/replicas.zig +++ b/test/replicas.zig @@ -205,6 +205,8 @@ const Totals = struct { /// The wakes the clients' loops asked for, and the frames they drew. wakes: u64 = 0, draws: u64 = 0, + /// The clients' views' yanks, pastes and links their frontends did. + asked: [3]u64 = @splat(0), stops: [32]struct { name: []const u8 = "", n: u64 = 0 } = @splat(.{}), units: u64 = 0, fast: u64 = 0, @@ -285,7 +287,8 @@ const Totals = struct { /// page and at a search's hit (plain kinds a client runs as the session /// does, `looks` past the texts), the keys after going to its pane; a /// search (`/`, a pattern, Enter), a sweep of B1 over the PDF and its -/// wheel; now and then a client's Detach. +/// wheel; a yank to the system clipboard and a paste from it; now and +/// then a client's Detach. fn nextEvent(random: std.Random, buf: *[64]u8, aim: Aim, looks: []const []const u8, script: *Script) pardes.Event { const typed = "abcdefghijklmnopqrstuvwxyz0123456789 -_=+,:;()"; const normal = "hjklwbe0$xpuyoOiaAIdcv.nN%sC"; @@ -316,7 +319,7 @@ fn nextEvent(random: std.Random, buf: *[64]u8, aim: Aim, looks: []const []const for (buf[0..n]) |*c| c.* = typed[random.uintLessThan(usize, typed.len)]; return .{ .paste = buf[0..n] }; }, - 36 => return .{ .command = switch (random.uintLessThan(u8, 14)) { + 36 => return .{ .command = switch (random.uintLessThan(u8, 16)) { 0 => "Newcol", 1 => "Zerox", 2 => "Undo", @@ -332,6 +335,10 @@ fn nextEvent(random: std.Random, buf: *[64]u8, aim: Aim, looks: []const []const // Its link ended by the session (the session's own view's, // its terminal's: none here). 12 => if (random.uintLessThan(u8, 4) == 0) "Detach" else "Undo", + // The system clipboard, the client's own frontend's (client.zig + // `asks`): a yank of the selection to it, a paste from it. + 13 => "ClipYank", + 14 => "ClipPaste", else => return .{ .key = .{ .cp = if (random.boolean()) 'o' else 'i', .ctrl = true } }, } }, 37 => return .{ .resize = .{ .cols = @intCast(random.intRangeAtMost(u16, 60, 120)), .rows = @intCast(random.intRangeAtMost(u16, 16, 40)) } }, @@ -459,6 +466,8 @@ const Client = struct { /// real wait's timeout is; an earlier one replaces it), and how many. wake_at: u64 = 0, wakes: u64 = 0, + /// Its view's yanks, pastes and links its frontend did. + asked: [3]u64 = @splat(0), drew: bool = false, /// What it types in a row (a search, a sweep). script: Script = .{}, @@ -543,6 +552,19 @@ const Client = struct { defer cl.drew = false; return .{ .drew = cl.drew, .moving = false }; } + + /// What its view asked of its machine (client.zig `asks`), counted; + /// its clipboard's answer a paste, as a frontend's comes. + pub fn copy(cl: *Client, _: []const u8) void { + cl.asked[0] += 1; + } + pub fn paste(cl: *Client, l: *ClientLoop) void { + cl.asked[1] += 1; + l.input(.{ .paste = "from the client's clipboard" }); + } + pub fn open(cl: *Client, _: []const u8) void { + cl.asked[2] += 1; + } }; const ClientLoop = client_loop.Loop(Client); @@ -1253,6 +1275,7 @@ fn run(r: Run, dir: []const u8, totals: *Totals) !void { for (clients[0..r.clients], 1..) |*cl, id| { totals.resizes += cl.resizes; totals.wakes += cl.wakes; + for (&totals.asked, cl.asked) |*t, n| t.* += n; if (has_link[id - 1]) totals.draws += cl.loop.link.draws; // Its quiet checks: what the session's digest was against its own. if (readAll(cl.check)) |said| { @@ -2525,7 +2548,7 @@ pub fn main(init: std.process.Init) !void { t.screens_checked, t.screens_wrong, }); - try stop_lines.print(gpa, "{d:>4} {d:>8} {d:>6} {d:>6} ", .{ rtt, t.unlisted, t.wakes, t.draws }); + try stop_lines.print(gpa, "{d:>4} {d:>8} {d:>6} {d:>6} {d:>3}/{d}/{d} ", .{ rtt, t.unlisted, t.wakes, t.draws, t.asked[0], t.asked[1], t.asked[2] }); for (t.stops) |st| if (st.n > 0) try stop_lines.print(gpa, "{s}:{d} ", .{ st.name, st.n }); try stop_lines.append(gpa, '\n'); try join_lines.print(gpa, "{d:>4} {d:>5} {d:>7} {d:>8} {d:>8} {d:>6} {d:>5}/{d:<5} {d:>5}/{d:<6} {d:>7} {d:>5}/{d}/{d}\n", .{ rtt, t.joins, t.refused, t.rejoined, t.detached, t.detach_words, t.agree, t.differ, t.checks, t.units, t.resizes, t.kind_panes[0], t.kind_panes[1], t.kind_panes[2] }); @@ -2535,8 +2558,8 @@ pub fn main(init: std.process.Init) !void { std.debug.print(" rtt deltas/s delta B/s unit B/s encode p50/p99 apply p50/p99 fetched filled KB resets checked/wrong\n{s}", .{term_lines.items}); std.debug.print("clients: joins from a dump, refused (every view taken), joined again after a divergence put on them, left (of them by a Detach); quiet checks of the session's digest agreed/differed; the digests the clients compared (units and quiet), of the units they took; resizes the windows posted; the kinds' panes the session opened (image/life/pdf)\n", .{}); std.debug.print(" rtt joins refused rejoined detached detach agree/differ checks/units resizes kinds\n{s}", .{join_lines.items}); - std.debug.print("stops: what stopped the clients' inputs (a stop counted again as its input is applied again), by name; those at a name replica.may_wait does not list fail the run\n", .{}); - std.debug.print(" rtt unlisted wakes draws stops\n{s}", .{stop_lines.items}); + std.debug.print("stops: the wakes the clients' loops asked, the frames they drew, the yanks, pastes and links their frontends did (y/p/l), and what stopped their inputs (a stop counted again as its input is applied again), by name; those at a name replica.may_wait does not list fail the run\n", .{}); + std.debug.print(" rtt unlisted wakes draws y/p/l stops\n{s}", .{stop_lines.items}); if (failed) std.process.exit(1); } @@ -2637,6 +2660,9 @@ const Shows = struct { pub fn drawn(_: *Shows) client_loop.Drawn { return .{ .drew = true, .moving = false }; } + pub fn copy(_: *Shows, _: []const u8) void {} + pub fn paste(_: *Shows, _: *client_loop.Loop(Shows)) void {} + pub fn open(_: *Shows, _: []const u8) void {} }; /// The frame corpus's scenes (test/process/window.zig `corpus`, what a |
