summaryrefslogtreecommitdiff
path: root/core/tape.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 11:17:46 -0300
committerGabriel Schneider <[email protected]>2026-11-20 12:30:53 -0300
commit20f08450aee2487809feb6442ec44e21d2436e5d (patch)
treea6eda48cc7988b37019a98b914486cd04642e31a /core/tape.zig
parent35b2c0efc6c43ba44640f4432d98734000f8887a (diff)
parent23de206007ebae87007460afa993338781a03076 (diff)
downloadpardes-20f08450aee2487809feb6442ec44e21d2436e5d.tar.gz
pardes-20f08450aee2487809feb6442ec44e21d2436e5d.zip
integration (the terminals' line, NOT the main line yet): a client that falls behind lets go and joins again, a join's reloads never dropped and only of the terminals written, on the first client and the pair: pardes-term-join (with pardes-term-lag under it) and pardes-merge35; three conflicts, each two sides adding at one place: the tests at the end of core/replica.zig (both kept), the soak's fields and its end's checks in test/replicas.zig (the images' and the far client's both kept); one name follows: Peer.writeLoop's local for a cut link was named last, which the first client's Peer.last now is (cut_off); tui core-test 861/1018 (157 skipped), shell-test 1058/1061, term-test 18/18, the window builds; the soak, screen state: diverged 0, unequal 0, unlisted 0; BYTES: seed 0 at 30 ms two clients diverged (client 2 at digest 29, client 3 at digest 2): the divergence the join's report left open, here on the merged session: this line stays beside the main one until that soak is clean
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/tape.zig')
-rw-r--r--core/tape.zig16
1 files changed, 10 insertions, 6 deletions
diff --git a/core/tape.zig b/core/tape.zig
index 7f28621e..88a7047b 100644
--- a/core/tape.zig
+++ b/core/tape.zig
@@ -132,9 +132,9 @@ pub const Site = enum(u16) {
/// What a call into a kind did (Kind.Outcome), and a kind's pane's
/// tag prefix: the authority's, whose core alone runs the kind.
addon,
- /// The hash of a terminal's snapshot as the session reloaded it at a
- /// join (panes.reloadTerminals), which every replica's own reload
- /// compares.
+ /// Whether the session reloads a terminal at a join (written since its
+ /// last reload), then the hash of its snapshot as it did
+ /// (panes.reloadTerminals), which every replica's own reload compares.
reload,
/// A kitty image's medium as a terminal's emulator read it (a file, a
/// temporary file, shared memory: Term.media), its bytes or its failure.
@@ -1493,15 +1493,19 @@ pub fn endSpeculation(t: *Tape) bool {
/// a message may be (replica.zig `lag_max`'s neighbour, wire's bound).
pub const unit_max = 1 << 20;
-/// Whether a unit feeds a terminal its program's output (a pty's read; an
-/// input kept by hash is taken to): never taken as moving nothing (the
-/// replica engine's one rule, core/replica.zig `confirm`).
+/// Whether a unit writes a terminal's emulator: feeds one its program's
+/// output (a pty's read; an input kept by hash is taken to), or reloads
+/// every one at a join (`Site.reload`; a join refused too, which moves
+/// nothing a digest covers): never taken as moving nothing (the replica
+/// engine's one rule, core/replica.zig `confirm`).
pub fn feedsTerminal(bytes: []const u8) bool {
const Tag = std.meta.Tag(Input);
const EventTag = std.meta.Tag(pardes.Event);
+ const reload: u16 = @as(u16, host_fns.len) + @backingInt(Site.reload);
var r: walk.Reader = .{ .bytes = bytes };
while (nextRecord(&r)) |rec| switch (rec.kind) {
.blob => if (rec.payload.len > 0 and rec.payload[0] == @backingInt(Kind.input)) return true,
+ .host => if (rec.payload.len >= 2 and std.mem.bytesToValue(u16, rec.payload[0..2]) == reload) return true,
.input => {
if (rec.payload.len < @sizeOf(Tag) + @sizeOf(EventTag)) continue;
if (!std.mem.eql(u8, rec.payload[0..@sizeOf(Tag)], std.mem.asBytes(&@as(Tag, .update)))) continue;