summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 16:17:01 -0300
committerGabriel Schneider <[email protected]>2026-11-23 16:34:45 -0300
commitb58b6e6e8e67e256be7de879a212da1de699253e (patch)
tree3a27e3df2f971d6e47cd2d7121df652dae991e9f
parent0b612d26ed32ee765f450c643f77fe4a749a2847 (diff)
downloadpardes-b58b6e6e8e67e256be7de879a212da1de699253e.tar.gz
pardes-b58b6e6e8e67e256be7de879a212da1de699253e.zip
replica tests: `joinedNow` sends what the session recorded as a unit before it dumps, as a join does (`Peers.dumped`), and a test of the jump fault at the replica's surface: round 1's open test ("a client joined from a dump keeps the session's jump list through a step", the session's list written by hand, entries with place bytes 0x11 and 0x22 round a gone pane's) failed in Debug with the client's list [now] against the session's [F, now]: NOT a second jump fault but a state no step makes: a print in `trackJump` showed the client's first unit replayed on a core made afresh (n 0, another core's address): `joinedNow` dumped with the authority's records since its start still on the tape, so the joiner's first unit began with the session's `init` (core/tape.zig `apply`: `.init` makes `t.core` anew) and threw the dump it had loaded away; the real join sends them first (`ps.unit` before `dumpJoin`); with the helper doing the same, every replica.zig test passes (95/126, 31 skipped) and the jump test passes on `walk.eql` and FAILS in Debug with the dedupe's compare put back to `std.meta.eql` (the session keeps the 0x11 and 0x22 entries apart, the client's loaded bytes are one fill: the digests differ): fault 2 held at the replica's surface, deterministically, on every build
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
-rw-r--r--core/replica.zig32
1 files changed, 32 insertions, 0 deletions
diff --git a/core/replica.zig b/core/replica.zig
index 6c4f0b2c..cf628291 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -3715,6 +3715,11 @@ fn endJoin(j: *Joined, have: ?*Have) void {
/// as `Peers.join` sends it: its state, its blobs put back where they go.
fn joinedNow(a: *Authority, id: u16, view: u8) !*Replica {
const gpa = std.testing.allocator;
+ // What was recorded goes first, as a join sends it (Peers.dumped):
+ // left on the tape, the joiner's first unit replayed it over the dump
+ // it loaded (a session's `init` first: a core made afresh).
+ a.seq += 1;
+ _ = try a.unit(0, a.seq);
const was = Stepping.begin(&a.t, null);
var blobs: std.ArrayListUnmanaged(walk.Deferred) = .empty;
defer blobs.deinit(a.core.gpa);
@@ -3783,6 +3788,33 @@ fn shows(p: *Pardes, text: []const u8) !bool {
return false;
}
+test "a client joined from a dump keeps the session's jump list through a step: two entries the same but for their place's undefined bytes are one entry on both" {
+ // The release soak's parting (the witness: `views[3].jumps`): a text's
+ // entry has `.place = .{}`, bytes undefined: a session's are its
+ // stack's (here 0x11 and 0x22, the two a release build left), a
+ // client's what its load left; the step drops the gone entry between
+ // the two and makes them one where they compare the same.
+ const gpa = std.testing.allocator;
+ const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml" }, TestHost.host());
+ defer a.deinit();
+ const v = a.core.view();
+ const serial = a.core.panes[v.active].?.serial;
+ var at: pardes.Jump.Loc = .{ .pane = @intCast(v.active), .serial = serial, .line = 1, .col = 1 };
+ var again = at;
+ @memset(&at.place.bytes, 0x11);
+ @memset(&again.place.bytes, 0x22);
+ v.jumps.list[0] = at;
+ v.jumps.list[1] = .{ .pane = 5, .serial = 999, .line = 1, .col = 1 };
+ v.jumps.list[2] = again;
+ v.jumps.list[3] = .{ .pane = @intCast(v.active), .serial = serial, .line = 150, .col = 1 };
+ v.jumps.n, v.jumps.cur = .{ 4, 3 };
+ const r = try joinedNow(a, 1, 0);
+ defer r.deinit();
+ r.confirm(try a.local(.{ .key = .{ .cp = 'l', .text = "l" } }));
+ try agrees(a, r);
+ try std.testing.expectEqual(@as(usize, 2), r.core().view().jumps.n);
+}
+
test "a message past the wire's bound is named, never read as the link's end" {
var fds: [2]c_int = undefined;
try std.testing.expectEqual(0, libc.pipe(&fds));