summaryrefslogtreecommitdiff
path: root/core/tape.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-22 16:50:34 -0300
committerGabriel Schneider <[email protected]>2026-11-22 16:53:19 -0300
commit9863a63b614d200852853825031189364dcacfdc (patch)
treed235648a2ac14b3e311746ced3433ed6865e2061 /core/tape.zig
parent6544f73a6b50e5ba68564beea7784593bb54348e (diff)
parentbad506bd45846e012246a33b5d3097b3e92f02bc (diff)
downloadpardes-9863a63b614d200852853825031189364dcacfdc.tar.gz
pardes-9863a63b614d200852853825031189364dcacfdc.zip
integration: the old road deleted and the emulator's boundary on the gathered line: pardes-merge56 (`qvwrwxtu`: the installed tree and the source view's changes to their last slice) and pardes-term-join-9 (`twssqzqw`, fourteen changes on pardes-merge55: every client's terminals by the pty's bytes and nothing else: the delta protocol, its flow control and core/term/screen_state.zig deleted (-3,605 +504 lines), the wire at 30, one soak; S1: abi/term.zig's Ops in replicated and local, the terminal's digest covering what a step reads, every call of the core's into a terminal listed with its rule as a test; a client's own join again judged after its goodbye; a pty's size one fact the core hands its host for every fork, adopt and resize; a closed view sizes no terminal); no textual conflict; one semantic one, resolved here: core/jj.zig's Churn test (the layers' last round) called Authority.init and Replica.init with the road's flag the deletion took away: the argument removed; core-test 916/1073 (157 skipped), shell-test 1115/1118; its gate: .scratch/sketch/reorg/merge57, the numbers in PARDES.md (2026-11-22)
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.zig70
1 files changed, 11 insertions, 59 deletions
diff --git a/core/tape.zig b/core/tape.zig
index f231831d..1cbf8aed 100644
--- a/core/tape.zig
+++ b/core/tape.zig
@@ -140,9 +140,6 @@ pub const Site = enum(u16) {
/// 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.
medium,
- /// Whether a terminal holds a kitty image after its program's output
- /// (Pane.term_images): a screen-state replica's emulator never has one.
- images,
};
/// What the sites return. wire.semantics hashes their shape with the
@@ -311,13 +308,6 @@ pub const Tape = struct {
dump_check: bool = false,
dumps: usize = 0,
dump_bytes: usize = 0,
- /// Screen-state terminals (core/term/screen_state.zig, docs/next-daemon.md
- /// phase 5): an authority recording for replicas, or a replica. A
- /// terminal's emulator is the authority's alone: its output is recorded
- /// without its bytes (they cross as screen state), its pty writes are
- /// not recorded, and no digest covers it. A replica's core never writes
- /// one but by `apply`.
- screen_state: bool = false,
/// The session's (replica.Peers): called between two of its inputs once
/// what it recorded since its last unit passes `unit_max`, to send that
/// as a unit: a pump of a flood's reads is cut into units under it.
@@ -423,12 +413,7 @@ pub const Tape = struct {
t.noteWrites();
t.noteHost(core);
}
- // A terminal's output crosses as screen state, not as its bytes.
- if (t.screen_state and input.* == .update and input.update.args[0] == .output) {
- var bare = input.*;
- bare.update.args[0].output.bytes = &.{};
- t.record(.input, Input, &bare);
- } else t.record(.input, Input, input);
+ t.record(.input, Input, input);
return .{ .tape = t };
}
@@ -806,12 +791,12 @@ pub const Tape = struct {
// output) is the session's answer, kept, and a replica whose
// emulators are fed the same bytes asks its own and compares: a
// check a unit, for nothing (P30: a digest, not state).
- if (comptime s == .positions or s == .prompt) if (!t.screen_state) {
+ if (comptime s == .positions or s == .prompt) {
const mine = @call(.auto, f, full);
t.scratch.clearRetainingCapacity();
walk.encode(R, &mine, &t.scratch.writer) catch @panic("tape: out of memory");
if (!std.mem.eql(u8, t.scratch.written(), t.last_ret.bytes[t.last_ret.at..])) t.diverge("what this replica's terminal told ({t}) is not what the session's did", .{s});
- };
+ }
var ret = t.last_ret;
return walk.decode(R, &ret, a orelse t.arena.allocator()) catch {
t.diverge("the tape's answer to {t} is short", .{s});
@@ -885,17 +870,6 @@ pub const Tape = struct {
return t.depth > 0 or t.replay or t.speculating;
}
- /// A replica's core under screen-state terminals: its emulators are
- /// written by `apply` alone, never by its own steps.
- pub fn screenReplica(t: *const Tape) bool {
- return t.screen_state and (t.replay or t.speculating);
- }
-
- /// An authority recording for screen-state replicas.
- pub fn screenAuthority(t: *const Tape) bool {
- return t.screen_state and !t.replay and !t.speculating;
- }
-
/// What a speculation reached is the authority's (`why`): the input is
/// undone and waits for the authority's order.
pub fn poison(t: *Tape, why: []const u8) void {
@@ -913,14 +887,6 @@ pub const Tape = struct {
return true;
}
- /// A speculation that moves a terminal's view: it may (its rollback
- /// puts the view back, replica.zig `views`); a screen-state replica's
- /// says it did (a delta sets the view again).
- pub fn viewOnly(t: *Tape, comptime _: []const u8) bool {
- if (t.speculating and t.screen_state) t.touched = true;
- return false;
- }
-
/// A speculation read a terminal's rows or moved its view (`Tape.touched`).
pub fn touchTerminal(t: *Tape) void {
if (t.speculating) t.touched = true;
@@ -1153,7 +1119,8 @@ fn tagOf(comptime entry: anytype, comptime Made: type) [:0]const u8 {
/// The entries that answer stop by nature: the answer is the session's.
const keeps_stopping = [_]Host.Fn{
// A shell's input: a device by the user's line (a far shell may feel
- // like ssh), and off the tape with screen-state terminals.
+ // like ssh; core/echo.zig predicts its echo), and off the tape outside
+ // a speculation.
.pty_write,
// Its host says into the core on every call that the shell started
// and where (host_io.forkShell: acknowledgeShell, setCwd), and gives
@@ -1197,8 +1164,10 @@ fn hostCall(t: *Tape, p: *const Pardes, comptime f: Host.Fn, args: Host.Args(f))
const R = Host.Ret(f);
const name = @tagName(f);
// A terminal's answers and what is typed at it from its output are the
- // authority's to write, never a replica's: off the tape on both sides.
- if (comptime std.mem.eql(u8, name, "pty_write")) if (t.screen_state and !t.speculating) {
+ // authority's to write, never a replica's: off the tape on both sides
+ // (a replica's replay of the step writes nothing, and checks nothing:
+ // a write returns nothing a step reads).
+ if (comptime std.mem.eql(u8, name, "pty_write")) if (!t.speculating) {
if (!t.replay) _ = p.host.call(f, args);
return;
};
@@ -1353,19 +1322,6 @@ pub fn stepping() bool {
return (on orelse &none).stepping();
}
-/// Screen-state terminals, on either side (`Tape.screen_state`).
-pub fn screenState() bool {
- return (on orelse &none).screen_state;
-}
-
-pub fn screenReplica() bool {
- return (on orelse &none).screenReplica();
-}
-
-pub fn screenAuthority() bool {
- return (on orelse &none).screenAuthority();
-}
-
pub fn poison(why: []const u8) void {
(on orelse &none).poison(why);
}
@@ -1380,10 +1336,6 @@ pub fn authorityOnly(comptime why: []const u8) bool {
return (on orelse &none).authorityOnly(why);
}
-pub fn viewOnly(comptime why: []const u8) bool {
- return (on orelse &none).viewOnly(why);
-}
-
pub fn touchTerminal() void {
(on orelse &none).touchTerminal();
}
@@ -1832,11 +1784,11 @@ test "a core pumped twice with one host and once with another: which functions i
const R = pardes.replica;
var first: Pumped = .{ .ns = 0 };
var second: Pumped = .{ .ns = 1 << 40 };
- const a = try R.Authority.init(gpa, .{ .cols = 80, .rows = 24 }, .{ .ctx = &first, .vtable = &Pumped.one }, false);
+ const a = try R.Authority.init(gpa, .{ .cols = 80, .rows = 24 }, .{ .ctx = &first, .vtable = &Pumped.one });
defer a.deinit();
const boot = Pumped.said(a.t.buf.items);
try std.testing.expectEqual(Host.mask(.{ .vtable = &Pumped.one }), boot.mask);
- const r = try R.Replica.init(gpa, 1, try a.unit(0, 0), false);
+ const r = try R.Replica.init(gpa, 1, try a.unit(0, 0));
defer r.deinit();
const hosts = [_]Host{ .{ .ctx = &first, .vtable = &Pumped.one }, .{ .ctx = &second, .vtable = &Pumped.more } };
for (hosts, [_]usize{ 0, 1 }, 1..) |h, sets, seq| {