summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 02:43:34 -0300
committerGabriel Schneider <[email protected]>2026-11-20 11:16:31 -0300
commitb58e9b3123aaa72dff67631e7f5c0b5a55b64075 (patch)
tree742e86d64590c9cc67ba9b0b5e4ebd5d30daeeb7 /test
parent4c5edb516c6c866fe6039037636804f4e868f4bb (diff)
downloadpardes-b58e9b3123aaa72dff67631e7f5c0b5a55b64075.tar.gz
pardes-b58e9b3123aaa72dff67631e7f5c0b5a55b64075.zip
term: wide characters in a pruned, reflowed scrollback snapshot and load exactly (a test, core/term/terminal.zig: the soak's wide line among 30,000 lines in a 1 MiB history, reflowed twice at odd widths: the loaded terminal's snapshot is the first's, its join hash the reload's, and both go on as one through the rest and two more reflows; it passes on the base: pardes's snapshot and ghostty's are not at fault), so the soak's `cat` gets its wide lines back (the ASCII filter deleted): the divergence seen with them (seed 0 at 80 ms, a join's reload hash) was the refused join's skipped reload of the change before; and the soak's far client never types Detach (it left once, seed 6 at 80 ms, and the run failed for a final screen it could not show; the random draw is made as before, so no other client's script moves), and a run whose far client never shows its final screen says so and why; the soak, bytes, `--clients 5 --bytes --seeds 8` at 30/80/207 ms with the `cat` whole (Debug, load 25-44): 2 of 4 whole runs clean (diverged 0, unequal 0, quiet checks agreed, unlisted 0, corpus 22 of 22, no leak); in the other two, seed 2 at 80 ms (two clients at one session unit) and seed 0 at 30 ms (one client): OPEN, not root-caused (reports/pardes-term-join.md), never under a probe; seed 0 at 30 ms, 19 of 20 clean, one run hung spinning (killed, no trace); on the base seed 0 at 30 ms diverged every time and 9 of 24 runs; tui core-test 859/1011 (152 skipped), shell-test 1047/1050
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test')
-rw-r--r--test/replicas.zig20
1 files changed, 8 insertions, 12 deletions
diff --git a/test/replicas.zig b/test/replicas.zig
index 5cddf6c8..e0e8b601 100644
--- a/test/replicas.zig
+++ b/test/replicas.zig
@@ -330,7 +330,7 @@ const Totals = struct {
/// search (`/`, a pattern, Enter), a sweep of B1 over the PDF and its
/// 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 {
+fn nextEvent(random: std.Random, buf: *[64]u8, aim: Aim, looks: []const []const u8, script: *Script, far: bool) pardes.Event {
const typed = "abcdefghijklmnopqrstuvwxyz0123456789 -_=+,:;()";
const normal = "hjklwbe0$xpuyoOiaAIdcv.nN%sC";
if (script.at < script.n) {
@@ -374,8 +374,9 @@ fn nextEvent(random: std.Random, buf: *[64]u8, aim: Aim, looks: []const []const
10 => "Tab 8",
11 => "Life",
// 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",
+ // its terminal's: none here). Not the far client's: the scene
+ // waits for its screen after the flood.
+ 12 => if (random.uintLessThan(u8, 4) == 0 and !far) "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",
@@ -1504,7 +1505,7 @@ const Soak = struct {
switch (m.kind) {
.input => {
var buf: [64]u8 = undefined;
- const ev = nextEvent(s.random, &buf, s.aim, s.looks, &cl.script);
+ const ev = nextEvent(s.random, &buf, s.aim, s.looks, &cl.script, net.throttled == @as(?usize, c));
cl.loop.input(ev);
cl.left -= 1;
if (cl.left > 0) try net.send(.{ .at = m.at + typistGap(s.random), .n = 0, .kind = .input, .who = m.who, .bytes = &.{} }) else {
@@ -1576,7 +1577,7 @@ const Soak = struct {
const core = s.l.core;
s.clock();
var buf: [64]u8 = undefined;
- const ev = nextEvent(s.random, &buf, s.aim, s.looks, &s.own_script);
+ const ev = nextEvent(s.random, &buf, s.aim, s.looks, &s.own_script, false);
core.toView(.at(0));
core.update(ev);
s.own_left -= 1;
@@ -1653,6 +1654,7 @@ const Soak = struct {
const want = pardes.tape.digestOf(core);
totals.cut += s.l.peers.cut;
if (bytes_kind) std.debug.print("seed {d} rtt {d} ms: a join's step at worst {d} us (the session's reloads and its dump), the last dump {d} KB ({d} KB of state)\n", .{ s.r.seed, s.r.rtt_ms, s.join_worst / 1000, s.l.peers.dump_bytes >> 10, s.l.peers.state_bytes >> 10 });
+ if (s.net.throttled) |c| if (!s.far_final) std.debug.print("seed {d} rtt {d} ms: the far client never showed the screen after the flood ({s})\n", .{ s.r.seed, s.r.rtt_ms, if (s.clients[c].r == null) "it left" else "it is joined" });
if (bytes_kind and s.kitty_answers != 1) {
totals.unequal += 1;
std.debug.print("seed {d} rtt {d} ms: the program's kitty query was answered {d} times on the session's pty\n", .{ s.r.seed, s.r.rtt_ms, s.kitty_answers });
@@ -1824,13 +1826,7 @@ fn catAfter(before: []const u8, n: usize) ![]u8 {
try out.appendSlice(gpa, before);
while (out.items.len < before.len + n) {
var lines = std.mem.splitScalar(u8, @embedFile("replicas.zig"), '\n');
- // Its lines of ASCII: one with a wide character, the scrollback
- // reloaded at joins between reflows, still parts a client from the
- // session (reports/pardes-term-lag.md), a fault of its own.
- next: while (lines.next()) |line| {
- for (line) |ch| if (ch >= 0x80) continue :next;
- try out.print(gpa, "{s}\r\n", .{line});
- }
+ while (lines.next()) |line| try out.print(gpa, "{s}\r\n", .{line});
}
out.shrinkRetainingCapacity(before.len + n);
return out.toOwnedSlice(gpa);