From 0d870b0f8f2cbbfbc4827dce39b60f367fc97363 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 18 Nov 2026 18:58:08 -0300 Subject: replicas: the soak's session runs a kind's job as a real session's host does, on a worker whose answer is the session's own step later (Host.job, the draws' queue, Authority.output), not at once inside the perform of the effect that asked it, where Effect.perform lands it with no host `job`: there it is a step no tape records and a client's replay of that perform skips, so every client of the soak's session showing a PDF diverged at the first page turn a terminal client's glyph view made ask for the page's text (seed 0 rtt 30: three clients 'addon pdf: its state after key is not the session's', then, joined again without the kind, 'the core called wake where the tape has a host' and 'the tape's answer to addon is short' at the next job); with the PDF in the soak (the next change) and this backed out the soak fails so; no real session takes that path (tui.zig and gui.zig give their host a `job`) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- test/replicas.zig | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/replicas.zig b/test/replicas.zig index fa7c84e8..8ae46a31 100644 --- a/test/replicas.zig +++ b/test/replicas.zig @@ -111,8 +111,22 @@ const Host = struct { h.detach_view = h.core.?.live; } - const vtable: pardes.Host.VTable = .{ .watched = watched, .pty_write = ptyWrite, .set_clipboard = ignore }; - const clocked_vtable: pardes.Host.VTable = .{ .watched = watched, .pty_write = ptyWrite, .set_clipboard = ignore, .now = now, .detach = detach }; + /// A kind's job on a worker, as tui.zig's `job` runs one: its answer + /// the session's own step `draw_us` later (`.draw`, `Authority.output`), + /// as a worker's is 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). + /// At the setup, before any client, at once inside this call. + fn job(ctx: ?*anyopaque, pane: u8, serial: u32, token: u32) void { + 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; + j.run(); + j.land(h.core.?); + } + + const vtable: pardes.Host.VTable = .{ .watched = watched, .pty_write = ptyWrite, .set_clipboard = ignore, .job = job }; + const clocked_vtable: pardes.Host.VTable = .{ .watched = watched, .pty_write = ptyWrite, .set_clipboard = ignore, .now = now, .detach = detach, .job = job }; fn host(h: *Host) pardes.Host { return .{ .ctx = h, .vtable = if (h.clocked) &clocked_vtable else &vtable }; @@ -1070,6 +1084,14 @@ fn run(r: Run, dir: []const u8, totals: *Totals) !void { // a frame owed; one of a core gone since is let go. const j = Draws.jobs.orderedRemove(0); j.run(); + // A state job's answer: a step of the session's own. + if (j.draw == null) { + session.enter(); + host.now_ns = std.time.ns_per_s + m.at * 1000; + a.output(.{ .job = .{ .pane = j.pane, .serial = j.serial, .token = j.token, .gen = j.gen, .bytes = j.out } }); + j.drop(); + continue; + } if (j.draw == @as(?*const pardes.Pardes, a.core)) { session.enter(); pardes.Kind.landDraw(a.core, j); -- cgit v1.3