diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 02:43:34 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 11:16:31 -0300 |
| commit | 4c5edb516c6c866fe6039037636804f4e868f4bb (patch) | |
| tree | 2818181f8a9c1a9697e8646f418be7606185d7e9 /core/tape.zig | |
| parent | c9ac46755632d5cd1bdc34fe211112d730ffc77f (diff) | |
| download | pardes-4c5edb516c6c866fe6039037636804f4e868f4bb.tar.gz pardes-4c5edb516c6c866fe6039037636804f4e868f4bb.zip | |
replica: a join's reloads are never taken as moving nothing (the one rule, which `tape.feedsTerminal` kept for a pty's output alone): a join refused for want of a view still reloads every terminal on every side (Core.zig `openViewInner`: `reloadTerminals` before `Views.open` returns null) and moves nothing a digest covers, so a near client with a key of its own on top took that unit as neutral (`confirm`, the same digest and no pty output: kept in `since`, not replayed), its key's fast path then left nothing on top, and the next output unit let the copy go and dropped `since` (`ahead`): that client never made the reload, held other pages than every other side, and once the flood pruned its history a page at a time it diverged: "digest N differs in panes pane 0.terminal pane 1.cwd" (pane 1's cwd is `.inherited: *Pane`, walked into pane 0's terminal) or, at the next join, "a terminal reloaded at a join is not the session's"; found by a ring of each replica's units and paths printed at its failure (seed 0 at 30 ms: the refused join `0/442` taken neutral, then the client's mouse `2/30` fast-pathed, then `0/443` released the copy); FIRST the test (a fifth client refused while every view is taken and a key of the client's is on top: the replica made 0 reloads where the session made 1, `expected 2, found 1` on the base), THEN `feedsTerminal` also names a unit with a `Site.reload` record; a user could not hit it today (real clients are screen state, which never reloads), and after the switch would have, whenever a fifth client was refused while another typed; and a third, seen once (seed 6 at 30 ms, the far client: "its digest, quiet, is not the session's"): a client that let its link go for its lag drops the units after it (`Link.lags`), but a check answered after the let-go was still judged (`Link.checked`) against a core behind on purpose: FIRST the lag test takes a check after its let-go (diverged on the base), THEN `checked` judges nothing once the link is let go; the soak, bytes, `--clients 5 --bytes --seeds 8` at 30/80/207 ms with the `cat` whole (Debug, load 25-44): 2 of 4 whole runs clean (diverged 0, unequal 0, quiet checks agreed, unlisted 0, corpus 22 of 22, no leak); in the other two, seed 2 at 80 ms (two clients at one session unit) and seed 0 at 30 ms (one client): OPEN, not root-caused (reports/pardes-term-join.md), never under a probe; seed 0 at 30 ms, 19 of 20 clean, one run hung spinning (killed, no trace); on the base seed 0 at 30 ms diverged every time and 9 of 24 runs; tui core-test 859/1011 (152 skipped), shell-test 1047/1050
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/tape.zig')
| -rw-r--r-- | core/tape.zig | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/tape.zig b/core/tape.zig index d977b53e..ea1a5691 100644 --- a/core/tape.zig +++ b/core/tape.zig @@ -1520,15 +1520,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; |
