summaryrefslogtreecommitdiff
path: root/src/replica.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 22:06:33 -0300
committerGabriel Schneider <[email protected]>2026-11-17 22:23:50 -0300
commit920110be4c597b4b93fc2d38179c09b335186253 (patch)
treefb5a3eaebb48b8c52ec0e23540e5065d940995d0 /src/replica.zig
parent7d10ad68b07a7bbab23fa8565d39183e4387c478 (diff)
downloadpardes-920110be4c597b4b93fc2d38179c09b335186253.tar.gz
pardes-920110be4c597b4b93fc2d38179c09b335186253.zip
words: a session with no frontend of its own is `detached` in the code, one word for what was `headless`, `parked`, `alone_unattended`, `Term.none` and `!attached()` (PARDES.md ruling 1): main.zig's and gui.zig's `headless` (run, runNative, localSession) are `detached`, tui.zig's `Term.none` is `Term.detached`, the window's `Shell.parked` (its Gui kept while detached) is `Shell.detached`, `replica.Peers.alone_unattended` is `Peers.detached`, and the terminal's `Shell.attached()` is `Shell.detached()`, its five callers and `watched` negated to match (a test's Shell with no screen is not detached, as it was attached); the tape's `headless`, a replica core that skips `render` and the host calls inside it (set on every client), is `skips_render`, its replay run named `skips-render` ("replay X: skips-render replica: N digests agree"), and the two that read that line follow (test/tty.zig's other-build replay, test/cross_replay.py); NOT renamed, a different fact: `Core.unattended` (detached AND no client: nobody looks), a watched field on the tape by index; names only, no logic moved; tui core-test 811/950 (139 skipped), shell-test 993/996, behaviour-test 269/273 (the four addon ABI tests the base fails) and the same with --replay, process-test 2 of 144 failed (lspcomplete and lspcompletemoved, the base's), replicas pass (checked/wrong 0), daemon.py main passes; gui frame corpus 77/77 byte-identical against mbase, unit-test 1582/1590 (the base's 8 failures)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/replica.zig')
-rw-r--r--src/replica.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/replica.zig b/src/replica.zig
index 32c8acd7..09746377 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -730,7 +730,7 @@ pub const Replica = struct {
pub fn initDump(gpa: Allocator, id: u16, view: u8, bytes: []const u8, opts: pardes.Options) !*Replica {
const r = try gpa.create(Replica);
r.* = .{ .gpa = gpa, .id = id, .view = view, .t = tape.memory(gpa), .guess = true };
- r.t.headless = true;
+ r.t.skips_render = true;
// Its terminals are the session's deltas (Peers sends them).
r.t.screen_state = true;
errdefer {
@@ -1847,9 +1847,9 @@ pub const Peers = struct {
/// Wakes the session's loop (its wait for input) from a reader.
wake_ctx: ?*anyopaque = null,
wake: ?*const fn (?*anyopaque) void = null,
- /// What the session would be with no client: unattended without a
- /// terminal of its own (the host says).
- alone_unattended: bool = false,
+ /// No frontend of its own (the host says): with no client either, the
+ /// session is unattended.
+ detached: bool = false,
/// The worst a join cost the session's step, and the last one's dump.
join_ns: u64 = 0,
each_join: std.ArrayListUnmanaged(u64) = .empty,
@@ -2044,7 +2044,7 @@ pub const Peers = struct {
// its view not kept yet, and takes a new one.
const back = if (joining.view) |v| core.rejoinView(v) else false;
const k = (if (back) joining.view else core.openView()) orelse {
- core.unattended = ps.count() == 0 and ps.alone_unattended;
+ core.unattended = ps.count() == 0 and ps.detached;
if (ps.count() == 0) ps.stop(core);
return daemon.refuseReplica(fd, "that session has as many views as it takes");
};
@@ -2117,7 +2117,7 @@ pub const Peers = struct {
ps.screens.dropPeer(peer.sid);
core.undrawn &= ~(@as(u8, 1) << @intCast(peer.view));
ps.closeViewOf(core, peer, peer.again);
- if (ps.count() == 0) core.unattended = ps.alone_unattended;
+ if (ps.count() == 0) core.unattended = ps.detached;
ps.seq += 1;
ps.unit(0, ps.seq);
ps.letGo(peer);
@@ -2129,7 +2129,7 @@ pub const Peers = struct {
/// session no one else watches leaves the session its layout, for a
/// client that comes after to find.
fn closeViewOf(ps: *Peers, core: *Pardes, peer: *Peer, again: bool) void {
- if (again) core.awayView(peer.view) else if (ps.count() == 0 and ps.alone_unattended) core.leaveView(peer.view) else core.closeView(peer.view);
+ if (again) core.awayView(peer.view) else if (ps.count() == 0 and ps.detached) core.leaveView(peer.view) else core.closeView(peer.view);
}
/// Its threads ended and joined, its link closed.
@@ -2265,7 +2265,7 @@ pub const Peers = struct {
};
ps.inbox.clearRetainingCapacity();
ps.lock.unlock(ps.io);
- core.unattended = ps.alone_unattended;
+ core.unattended = ps.detached;
}
pub fn deinit(ps: *Peers) void {