summaryrefslogtreecommitdiff
path: root/src/tape.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 16:38:10 -0300
committerGabriel Schneider <[email protected]>2026-11-18 17:13:49 -0300
commitf7fc58ee8ae9a88b09ee1c235b9986df8b1ef844 (patch)
tree0dde3920324473b0e827ae61d87c44c4ba77030b /src/tape.zig
parent558051ca5525a4dade47ab6ef7794eefd848f7b2 (diff)
downloadpardes-f7fc58ee8ae9a88b09ee1c235b9986df8b1ef844.tar.gz
pardes-f7fc58ee8ae9a88b09ee1c235b9986df8b1ef844.zip
replica: a client compares its core's digest with the session's only where one is due, not at every confirmed input and every unit replayed (the edit row's +40%, a full walk of the core each time): once in check_every (32) confirmed units, on a unit that carries one with nothing applied on top (the fast path's catch-up, a replay, a rollback's), and once quiet 300 ms after a change (Link.quietCheck, now always, not only for PARDES_REPLICA_CHECK: another digest is a divergence, and it joins again; PARDES_TEST_DIVERGE is found so); a unit replayed by a rollback (since) compares none; a unit with no digest leaves the last one unknown (after a unit with a set record it was kept, stale, for the moved-nothing comparison); the authority in process records its digest at a unit's end as the session does; the session still records one a unit (a session's unit with none where its clock moved exposed a structural divergence after a kind is distrusted: daemon.py --games, a second rejoin, 'the tape's answer to addon is short'; not root-caused); the soak's mix without the PDF (round 5's open fault); replicas five clients diverged 0, unequal 0, the put-off client caught by a quiet check or a due one
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/tape.zig')
-rw-r--r--src/tape.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tape.zig b/src/tape.zig
index 2875b156..9337ff9f 100644
--- a/src/tape.zig
+++ b/src/tape.zig
@@ -286,6 +286,9 @@ pub const Tape = struct {
/// A digest only when asked (`recordDigest`): the replica stream's,
/// one a unit, not one after each of its inputs.
unit_digests: bool = false,
+ /// A digest record replayed is compared with the core's own; a replica
+ /// client's compares one now and then (src/replica.zig `check_every`).
+ checks: bool = true,
/// A replica client's guess of the session's clocks for a speculation
/// (src/replica.zig): its clock reads (a message's stamp, a file's
/// mtime) answer this instead of the clocks here.
@@ -570,6 +573,7 @@ pub const Tape = struct {
/// A digest record's payload (a unit's last) against the core's own: a
/// difference is `diverged`, its fields named when the record has them.
pub fn check(t: *Tape, payload: []const u8) void {
+ if (!t.checks) return;
var r: walk.Reader = .{ .bytes = payload };
const want = walk.decode([]const u64, &r, t.arena.allocator()) catch return;
const p = t.core orelse return;