summaryrefslogtreecommitdiff
path: root/test/replicas.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 20:31:32 -0300
committerGabriel Schneider <[email protected]>2026-11-19 20:31:32 -0300
commit0db34fbf28e70c8c6a3c6025c0888fc5ec75201c (patch)
treef2e288668decded9276ebc45907f16d651b06f9e /test/replicas.zig
parent2ab05b536bc3b063666b5aaab497157adc2a9120 (diff)
parentbf351b62e8843a3d173cedeefa2dd0b8ef4b4392 (diff)
downloadpardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.tar.gz
pardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.zip
integration: a pane's and a view's slot as types, with the regular-expression fixes and the fixes the real loops asked for: pardes-ids (Pane.Id and View.Id through the entries, the events, the effects, the Host table and the device messages) and pardes-merge21, merged without a textual conflict; one call site written since on the old type follows (core/draw.zig: the twin test's file_changed event, .pane = .at(0)); tui core-test 848/991 (143 skipped), shell-test 1027/1030, the window builds; gates in the coordinator's ledger
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/replicas.zig')
-rw-r--r--test/replicas.zig28
1 files changed, 16 insertions, 12 deletions
diff --git a/test/replicas.zig b/test/replicas.zig
index f1c4ff60..910c6e57 100644
--- a/test/replicas.zig
+++ b/test/replicas.zig
@@ -102,7 +102,8 @@ const Host = struct {
return h.draws;
}
- fn ptyWrite(ctx: ?*anyopaque, pane: u8, bytes: []const u8) void {
+ fn ptyWrite(ctx: ?*anyopaque, id: pardes.Pane.Id, bytes: []const u8) void {
+ const pane = id.index();
const h: *Host = @ptrCast(@alignCast(ctx.?));
h.echo.append(gpa, .{ .pane = pane, .bytes = gpa.dupe(u8, bytes) catch return }) catch {};
}
@@ -123,7 +124,8 @@ const Host = struct {
/// it at once on the core's side, inside the perform that asked it,
/// where no tape records it: a client replays that perform without it).
/// At the setup, before any client, at once inside this call.
- fn job(ctx: ?*anyopaque, pane: u8, serial: u32, token: u32) void {
+ fn job(ctx: ?*anyopaque, id: pardes.Pane.Id, serial: u32, token: u32) void {
+ const pane = id.index();
const h: *Host = @ptrCast(@alignCast(ctx.?));
const j = pardes.host_io.KindJob.take(h.core.?, pane, serial, token) orelse return;
if (Draws.go(null, j)) return;
@@ -804,7 +806,8 @@ const Soak = struct {
return true;
}
- fn ptyWrite(ctx: ?*anyopaque, pane: u8, bytes: []const u8) void {
+ fn ptyWrite(ctx: ?*anyopaque, id: pardes.Pane.Id, bytes: []const u8) void {
+ const pane = id.index();
const s = of(ctx);
s.echo.append(gpa, .{ .pane = pane, .bytes = gpa.dupe(u8, bytes) catch return }) catch {};
}
@@ -824,7 +827,8 @@ const Soak = struct {
/// its loop's event (with no `job`, Effect.perform runs it at once on
/// the core's side, inside the perform that asked it, where no tape
/// records it: a client replays that perform without it).
- fn job(ctx: ?*anyopaque, pane: u8, serial: u32, token: u32) void {
+ fn job(ctx: ?*anyopaque, id: pardes.Pane.Id, serial: u32, token: u32) void {
+ const pane = id.index();
const core = of(ctx).l.core;
const j = pardes.host_io.KindJob.take(core, pane, serial, token) orelse return;
if (Draws.go(null, j)) return;
@@ -1011,7 +1015,7 @@ const Soak = struct {
cl.read_done = false;
cl.gen += 1;
cl.id = welcome.client;
- cl.view = welcome.view;
+ cl.view = welcome.view.index();
cl.digest = welcome.digest;
s.totals.joins += 1;
try net.toClient(c, now, .dump, cl.gen, try whole.toOwnedSlice(gpa));
@@ -1181,7 +1185,7 @@ const Soak = struct {
// program's output a frame a tick (tui.zig `waitInput`).
.echo => {
s.clock();
- core.update(.{ .output = .{ .pane = @intCast(m.who), .bytes = m.bytes } });
+ core.update(.{ .output = .{ .pane = .at(m.who), .bytes = m.bytes } });
return false;
},
.output => {
@@ -1201,7 +1205,7 @@ const Soak = struct {
if (s.program.at < s.program.bytes.len)
try net.send(.{ .at = m.at + if (m.who == 1) @as(u64, 450) else 3_000, .n = 0, .kind = .output, .who = m.who, .bytes = &.{} })
else if (m.who == 1) s.flood_end = m.at;
- core.update(.{ .output = .{ .pane = s.shell, .bytes = chunk } });
+ core.update(.{ .output = .{ .pane = .at(s.shell), .bytes = chunk } });
took_output = true;
},
.frame => {
@@ -1266,7 +1270,7 @@ const Soak = struct {
// A state job's answer: a step of the session's own.
if (j.draw == null) {
s.clock();
- core.update(.{ .job = .{ .pane = j.pane, .serial = j.serial, .token = j.token, .gen = j.gen, .bytes = j.out } });
+ core.update(.{ .job = .{ .pane = .at(j.pane), .serial = j.serial, .token = j.token, .gen = j.gen, .bytes = j.out } });
j.drop();
return false;
}
@@ -1388,7 +1392,7 @@ const Soak = struct {
s.clock();
var buf: [64]u8 = undefined;
const ev = nextEvent(s.random, &buf, s.aim, s.looks, &s.own_script);
- core.toView(0);
+ core.toView(.at(0));
core.update(ev);
s.own_left -= 1;
if (s.own_left > 0) try s.net.send(.{ .at = m.at + typistGap(s.random), .n = 0, .kind = .own, .who = 0, .bytes = &.{} }) else s.typing -= 1;
@@ -2134,7 +2138,7 @@ const EchoHost = struct {
return false;
}
- fn ptyWrite(ctx: ?*anyopaque, _: u8, bytes: []const u8) void {
+ fn ptyWrite(ctx: ?*anyopaque, _: pardes.Pane.Id, bytes: []const u8) void {
const h: *EchoHost = @ptrCast(@alignCast(ctx.?));
h.writes.append(gpa, .{ .seq = h.current, .bytes = gpa.dupe(u8, bytes) catch return }) catch {};
}
@@ -2282,7 +2286,7 @@ fn runEcho(seed: u64, rtt_ms: u64, on: bool, et: *EchoTotals) !void {
// The shell's first prompt.
sh.put(prompt_bytes);
- a.output(.{ .output = .{ .pane = shell, .bytes = sh.out.items } });
+ a.output(.{ .output = .{ .pane = .at(shell), .bytes = sh.out.items } });
sh.out.clearRetainingCapacity();
var next_step: usize = 0;
try push(&queue, &n, .{ .at = corpus.steps.items[0].gap, .n = 0, .kind = .input, .who = 1, .bytes = &.{} });
@@ -2346,7 +2350,7 @@ fn runEcho(seed: u64, rtt_ms: u64, on: bool, et: *EchoTotals) !void {
}
sh.key(m.bytes);
if (sh.out.items.len > 0) {
- a.output(.{ .output = .{ .pane = shell, .bytes = sh.out.items } });
+ a.output(.{ .output = .{ .pane = .at(shell), .bytes = sh.out.items } });
sh.out.clearRetainingCapacity();
if (ty) |k| k.echoed = true;
}