diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-23 09:25:44 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-23 10:04:29 -0300 |
| commit | 37cc3104fe589ec7cd2a8a5dd398f0f89f412837 (patch) | |
| tree | 96926de0a57dceee96e940bf3435228d7a239724 | |
| parent | c8f0d65a69274dc8a072c35a6c13cb07a6770007 (diff) | |
| download | pardes-37cc3104fe589ec7cd2a8a5dd398f0f89f412837.tar.gz pardes-37cc3104fe589ec7cd2a8a5dd398f0f89f412837.zip | |
jump: the test of two jump entries the same but for the bytes past their place's length: both release soaks of the base parted a client at seed 0 and 30 ms ("client 5 parted on unit 0/1407", "client 3 parted on unit 0/1749" then "on unit 1/106"), the witness naming `views[3].jumps` and `views[0].jumps`; trackJump (core/Jump.zig:207) drops the second of two entries in a row that std.meta.eql calls the same, and std.meta.eql compares a Loc's `place` (a Kind.Buf(32)) byte for byte, past its length: a text pane's entry has `.place = .{}`, its bytes undefined, 0xAA on every Debug process and on a release build whatever that process's stack (or a client's load) left there: the session keeps two entries the client makes one (or the other way), and the client parts; the test puts two such entries round a gone one, their place bytes 0x11 and 0x22, and fails in Debug: "expected 3, found 4" (logs/t6-jump-test.log) (PARDES_REPLICA_TRACE's "digest 36 differs in next_serial" of the round before was the soak's own divergence put on its second client, test_diverge = 40, counted "rejoined", not this)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
| -rw-r--r-- | core/Jump.zig | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/core/Jump.zig b/core/Jump.zig index b68da32d..66d0ba51 100644 --- a/core/Jump.zig +++ b/core/Jump.zig @@ -367,6 +367,28 @@ test "the jump list never holds two entries in a row the same, when the one betw try std.testing.expectEqual(@as(u32, 150), p.view().jumps.list[1].line); } +test "two entries the same but for the bytes past their place's length are one entry, as the digest sees them, on every build" { + const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 40 }); + defer p.deinit(); + const pane = try p.setTestFile(std.mem.asBytes(&@as([200][2]u8, @splat("a\n".*)))); + // A text's entry has no place: `.place = .{}`, its bytes undefined, + // 0xAA on every Debug process and each release process's own (the + // stack's, a load's): one entry on every side or a client parts. + var a: Loc = .{ .pane = 0, .serial = pane.serial, .line = 1, .col = 1 }; + var b = a; + @memset(&a.place.bytes, 0x11); + @memset(&b.place.bytes, 0x22); + p.view().jumps.list[0] = a; + p.view().jumps.list[1] = .{ .pane = 5, .serial = 999, .line = 1, .col = 1 }; + p.view().jumps.list[2] = b; + p.view().jumps.list[3] = .{ .pane = 0, .serial = pane.serial, .line = 150, .col = 1 }; + p.view().jumps.n = 4; + p.view().jumps.cur = 3; + pane.body.cur_row = 80; + trackJump(p); + try std.testing.expectEqual(@as(usize, 3), p.view().jumps.n); +} + test "jump history skips an entry whose pane slot or serial is gone, leaving the selection" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 12 }); defer p.deinit(); |
