diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 11:42:48 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 11:42:48 -0300 |
| commit | 71d8744b41dec56d835e30f531b96fede5d610a1 (patch) | |
| tree | 31e2a06fdcfd467d12454cde8be5a477765701b5 /core/rollback.zig | |
| parent | eae5736ad923731135dd35b3783c90a3358bd0fa (diff) | |
| parent | 4569aefd55d04f434f2e2ed5e6e4a511a414cdc7 (diff) | |
| download | pardes-71d8744b41dec56d835e30f531b96fede5d610a1.tar.gz pardes-71d8744b41dec56d835e30f531b96fede5d610a1.zip | |
integration: the one client loop that the soak runs, with the tape as the handle a step is given: pardes-runners-b (10b: runtime/client.zig run by the terminal's client, the window's and the soak; a client's clipboard and links its own frontend's; an input sent before it is applied) and pardes-handle-1 (the handle's steps 0 to 2: p.tape, the directory listing and the file system read through the tape they are handed), merged without a conflict; gates in the coordinator's ledger
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/rollback.zig')
| -rw-r--r-- | core/rollback.zig | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/core/rollback.zig b/core/rollback.zig index a6c6e5bd..53c7b210 100644 --- a/core/rollback.zig +++ b/core/rollback.zig @@ -523,11 +523,12 @@ fn annotatedStruct(comptime T: type) bool { /// own: on the host's heap (Pardes.recentGpa), which the epoch never puts a /// free off for, so their bytes put back would point at what is freed. A /// step reads what the authority holds of them off the tape -/// (tape.authority), never a replica's. +/// (tape.authority), never a replica's. And the core's tape (`Pardes.tape`, +/// `Options.tape`): the process's, which a rollback leaves where it is. fn unsaved(comptime name: []const u8) bool { return std.mem.eql(u8, name, "effects") or std.mem.eql(u8, name, "in_q") or std.mem.eql(u8, name, "frames") or std.mem.eql(u8, name, "own_frames") or std.mem.eql(u8, name, "shell_rows") or std.mem.eql(u8, name, "echo") or std.mem.eql(u8, name, "store") or - std.mem.eql(u8, name, "recent"); + std.mem.eql(u8, name, "recent") or std.mem.eql(u8, name, "tape"); } fn annotated(comptime T: type, comptime kind: []const u8, comptime name: []const u8) bool { @@ -801,3 +802,35 @@ test "a rollback leaves the store and Recent as a speculation left them: they li p.deinit(); try std.testing.expectEqual(@as(usize, 0), e.live.count()); } + +test "a core's tape is this process's own: no digest or dump holds it, and a rollback leaves it where it was set" { + var e: Epoch = .{ .child = std.testing.allocator }; + defer e.deinit(); + const gpa = e.allocator(); + const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml", .image_allocator = gpa, .tree_sitter_allocator = gpa, .frame_allocator = gpa }); + p.pump(.{}) catch {}; + // Given none, a core's tape is the one nobody records. + try std.testing.expect(p.tape == &pardes.tape.none); + var other = pardes.tape.memory(std.testing.allocator); + defer pardes.tape.release(&other); + const digest = walk.digest(Pardes, p); + const dumped = try pardes.dump.byteDump(p); + p.tape = &other; + try std.testing.expectEqual(digest, walk.digest(Pardes, p)); + const again = try pardes.dump.byteDump(p); + try std.testing.expectEqualSlices(u8, dumped, again); + gpa.free(again); + gpa.free(dumped); + p.tape = &pardes.tape.none; + // Handed another while a copy is held (a client joins: replica.zig's + // Peers), it keeps it when the copy is put back. + var c: Copy = .{}; + defer c.deinit(); + try c.take(&e, p); + p.tape = &other; + try std.testing.expect(c.restore()); + try std.testing.expect(p.tape == &other); + p.tape = &pardes.tape.none; + p.deinit(); + try std.testing.expectEqual(@as(usize, 0), e.live.count()); +} |
