summaryrefslogtreecommitdiff
path: root/src/replica.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 04:59:03 -0300
committerGabriel Schneider <[email protected]>2026-11-10 05:34:09 -0300
commitf30dfdb3d5546195a69f8046ded9acc669882b8d (patch)
treeb8f4ff5648683aeda6d8b820d68ca4b326933289 /src/replica.zig
parent60d4db7046f5cfe130eedbc9dabad680373e3e94 (diff)
downloadpardes-f30dfdb3d5546195a69f8046ded9acc669882b8d.tar.gz
pardes-f30dfdb3d5546195a69f8046ded9acc669882b8d.zip
kind: a view's facts (Kind.viewOf) count its bands as Messages.bands makes them from what a dump keeps (the pane's messages and prompt, the view's leader, rect and tag rows), never the derived copy a step or a park left in Pane.notices or Pane.pv, which a client joined from a dump has not: its kind was told other rows than the session's and the join diverged (`digest N differs in panes pane M.addon`); collectNotices makes the live view's from the same function
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/replica.zig')
-rw-r--r--src/replica.zig23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/replica.zig b/src/replica.zig
index 0b22f8b2..dd6f34bc 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -4383,3 +4383,26 @@ test "a replica's word that opens a kind's pane with no file waits for the autho
try agrees(a, r);
try std.testing.expect(r.core().panes[r.core().view().active].?.addon != null);
}
+
+test "a client joined from a dump tells a kind each view's facts as the session does, the live one's and another's" {
+ const gpa = std.testing.allocator;
+ const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml" }, TestHost.host(), false);
+ defer a.deinit();
+ var words: [64]pardes.Kind.LoadedWord = undefined;
+ const placed = pardes.Kind.loadedOf(&Placed.ops, "/x/placed.so", @splat(7), &words);
+ _ = try a.local(.{ .addon = .{ .op = .load, .pane = 0, .kind = &placed } });
+ _ = try a.local(.{ .command = "Placed" });
+ // A message in its pane: a band over its body, in each view.
+ _ = try a.local(.{ .command = "Placed x" });
+ // The second client's view laid out by an input of its own, then the
+ // first's resized: its kind told at the session's next step of its own.
+ _ = try a.openView(2);
+ var buf: [256]u8 = undefined;
+ _ = try a.take(try inputOf(&buf, 2, 1, .{ .resize = .{ .cols = 80, .rows = 24 } }));
+ _ = try a.take(try inputOf(&buf, 1, 1, .{ .resize = .{ .cols = 80, .rows = 20 } }));
+ const joiner = try joinedNow(a, 3, 1);
+ defer joiner.deinit();
+ try std.testing.expectEqual(digestOf(a), joiner.digest());
+ joiner.confirm(try a.local(.tick));
+ try agrees(a, joiner);
+}