summaryrefslogtreecommitdiff
path: root/core/jj.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 02:23:34 -0300
committerGabriel Schneider <[email protected]>2026-11-23 02:23:34 -0300
commit1ebae0db0a185455b2a03f22f5106113c6407a2f (patch)
treedb0e473c2c060e6bf7d4f4d169ffff11178056c3 /core/jj.zig
parent5393ce743d7848d26e60fd7d4d27a4119272df9f (diff)
parentde0e85daa8ad0bf9618734e16568823aa2b61a54 (diff)
downloadpardes-1ebae0db0a185455b2a03f22f5106113c6407a2f.tar.gz
pardes-1ebae0db0a185455b2a03f22f5106113c6407a2f.zip
integration (a base for the next rounds, not yet the gathered line): the one decision on the tree to install: pardes-merge60 (`krovvoum`: the viewport, a client's way back at an Upgrade, the pair's round 12, the lanes on the glide; in its whole gate) and pardes-one-decision (`ltvyvwru` on `wllwukuk` on `trmpwtso`, on pardes-viewport: one count of an emulator's writes in the core (`Pardes.outside`), copied, digested and dumped, which `Replica.confirm` reads once a unit where four spread checks stood; the rollback copy walks every type unless it declares `outside_copy`: the Changes layer's heap was not walked and was freed twice); no conflict; core-test 919/1083 (164 skipped), shell-test 1125/1128 (2026-11-23)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/jj.zig')
-rw-r--r--core/jj.zig30
1 files changed, 30 insertions, 0 deletions
diff --git a/core/jj.zig b/core/jj.zig
index e35da662..74870c00 100644
--- a/core/jj.zig
+++ b/core/jj.zig
@@ -2552,6 +2552,36 @@ test "the lanes ride with the text: a line typed in a nested block is nobody's,
try testing.expectEqual(pardes.tape.digestOf(a.core), pardes.tape.digestOf(r.core()));
}
+test "a client's own line opened over pinned changes, rolled back by the session's key first: the lanes it spliced under its copy are the copy's again, freed once; the client ends equal" {
+ var repo = try Stack.repo(null) orelse return error.SkipZigTest;
+ defer repo.deinit(testing.allocator);
+ const R = pardes.replica;
+ const a = try R.Authority.init(testing.allocator, .{ .cols = 80, .rows = 24 }, .{});
+ defer a.deinit();
+ const r = try R.Replica.init(testing.allocator, 1, try a.unit(0, 0));
+ defer r.deinit();
+ var line: [4200]u8 = undefined;
+ r.confirm(try a.local(.{ .command = try std.fmt.bufPrint(&line, "Look {s}", .{repo.file}) }));
+ r.confirm(try a.local(.{ .command = "Changes ::@" }));
+ r.confirm(try a.local(.{ .command = "Look a.zig:4" }));
+ r.settle();
+ const serial = a.core.panes[a.core.view().active].?.serial;
+ // The client opens a line below: an edit of the file, whose step splices
+ // the pinned lines' values (jj.edited) under the copy it takes.
+ const typed = try testing.allocator.dupe(u8, try r.input(.{ .key = .{ .cp = 'o', .text = "o" } }));
+ defer testing.allocator.free(typed);
+ try testing.expectEqual(@as(usize, 1), r.applied);
+ // The session's own key comes first: the copy put back, the `o` applied
+ // again over it, then confirmed.
+ r.confirm(try a.local(.{ .key = .{ .cp = 'k', .text = "k" } }));
+ r.settle();
+ r.confirm(try a.take(typed));
+ r.settle();
+ try testing.expect(r.diverged == null);
+ try testing.expectEqualSlices(Line, answered(a.core, serial).?.lines, answered(r.core(), serial).?.lines);
+ try testing.expectEqual(pardes.tape.digestOf(a.core), pardes.tape.digestOf(r.core()));
+}
+
/// Two functions four changes wrote: `fn` both, `f2` and `f3` rewrote
/// f's line, `g2` g's: f three changes, g two.
const Churned = struct {