summaryrefslogtreecommitdiff
path: root/core/replica.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-22 16:57:59 -0300
committerGabriel Schneider <[email protected]>2026-11-22 18:52:03 -0300
commitb3c38ea198e1fe915f029d7e41b469b8a53d2338 (patch)
treed6db809889ae1412146ca9dc806fb7d61f8e2bd2 /core/replica.zig
parent9863a63b614d200852853825031189364dcacfdc (diff)
parent6401b327a217c144895e22fb7ad24d986af97d86 (diff)
downloadpardes-b3c38ea198e1fe915f029d7e41b469b8a53d2338.tar.gz
pardes-b3c38ea198e1fe915f029d7e41b469b8a53d2338.zip
integration: the pair's chain on the gathered line: pardes-pair-10 (`vxutwuwz`, the pair's ten changes on pardes-merge50 past the four already gathered: a window's facts its client's (P47: WindowOpacity applied by a client window, `Font` gated by the desktop builds' capabilities, not the frontend's build), a window pair's session listed as a window's (P49), the user's terminal put back when a pair's client dies with no word (P48), a pair's user told a newer build is installed, an addon's landing on the tape and a client on the session's machine running a kind loaded by path (`Site.landing`, P51), an upgraded pair's session attended until its client is back, and test/daemon.py's `--with-pair`, `base_env`, `listed_as` and the Restore test as P44) on pardes-merge57 (the terminals' old road deleted, the wire at 30); two textual conflicts: core/replica.zig `Peer`'s fields (the pair's `bye` and `pair` kept, the deletion's removal of `sid` with its `Screens` kept) and test/daemon.py's head (the pair's `WITH_PAIR`, `base_env` and `listed_as` kept where the deletion had removed `KEEP`); the semantic ones the text did not show: the pair's `zwrkukrx` (`PARDES_TERM_BYTES`, its switch to the bytes road) merged without a conflict into core/replica.zig `takeJoined` (setting `r.t.screen_state`, a field the deletion removed), runtime/session.zig (`Peers.bytes`, removed) and test/process.zig (its passthrough): all three taken out, the gathered line's text there exactly, no road to choose (core/root.zig's machine_lines for replica.zig stays at the gathered line's 76: the pair's +1 was that getenv); test/daemon.py's two functions the gathered line added after the pair's base (`kept_views`, `kitty_image`) built their environment in the idiom `base_env()` replaced at every other site: now `base_env()` (the same without `--with-pair`; with it they run as a user who exported PARDES_PAIR, as every other mode does); the pair's `Peers.input` focus line, written after `screensOut` (deleted), stands alone before the step; `Site.landing` stays at the enum's end after `medium` (`images` gone): `wire.semantics` moves as any tape change does, no version line; and found by the gate: test/panes.zig's P51 test (the pair's, written on its old base) called `Authority.init` and `Replica.init` with the road's flag the deletion removed (pane-test did not compile): the argument removed, as merge57 did in core/jj.zig; nothing in core/tape.zig, abi/wire.zig or core/views.zig resolved by hand; gate (Debug tui in the workspace, loads 2-10): core-test 916/1073 (157 skipped), shell-test 1115/1118 (3 skipped), pane-test 182/183 (1 skipped: the base's + the P51 test), term-test 15/15, kitty-test 45/45, addon-test 5/5, behaviour-test and --replay 275/275, consumer-test, process-test own 0 of 146 and as pairs 0 of 146 (themesel first time as a pair, alone 0 of 5 first time and 5 of 5 on the runner's retry: pair-8's open case); the soak --clients 5 diverged 0, unequal 0 at 30/80/207 ms, unlisted 0, the corpus 22 of 22, no leak; daemon.py on Debug and ReleaseSafe: plain 3 of 3 each, --restore PASS each (P44's test, failing on the base), --pair, --attach-upgrading, --clients 3 of 3 each, --far PASS on ReleaseSafe and on Debug 3 of 3 alone (once at load 10 by_hash saw a client join again); --upgrade from the installed build PASS; with --with-pair every mode passes on both builds (plain, clients, manage, launch, relink, far, restore, attach-upgrading, pair, window-clients, gui, games, kitty-image), its --upgrade both ways past pair-10's wall and failing later (far_exec; a client's check differing after a ReleaseSafe-to-Debug Upgrade); the frame and perf gate against tree3 (gpu/pp11-g): 77/77 frames, perfab corpus2x +0.105% (noise 0.048%), 121 counts within 0.1% (largest terminal-on-all +0.085%)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/replica.zig')
-rw-r--r--core/replica.zig27
1 files changed, 21 insertions, 6 deletions
diff --git a/core/replica.zig b/core/replica.zig
index 3aac5e82..71a8de71 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -1361,6 +1361,12 @@ pub const Peer = struct {
again: bool = false,
/// ...or that its window was closed (Peers.closed).
close: bool = false,
+ /// It said a bye: none, and the session let it go with no word of its
+ /// own (`closing`, `cut`), is a client that died (killed: P48).
+ bye: bool = false,
+ /// A pair's first client (`Joining.own`): the terminal its session
+ /// keeps is its (`Peers.pair_left`).
+ pair: bool = false,
/// Inputs read (each one's seq, as the client numbered them).
seq: u32 = 0,
/// The `stamp` frame its next input came with (its reader's).
@@ -1643,6 +1649,7 @@ pub const Peer = struct {
const b = (wire.decodeClient(tag, payload) catch return false).bye;
peer.again = b.again;
peer.close = b.close;
+ peer.bye = true;
return false;
},
.ping => {
@@ -1775,6 +1782,14 @@ pub const Peers = struct {
/// hung up) and the session is a pair's not kept (daemon.sessionState): it
/// ends there (runtime/session.zig).
closed: bool = false,
+ /// Its pair's first client left (P48): with no word at all (killed),
+ /// true; its session's frontend puts the user's terminal back then,
+ /// and lets it go either way (tui.zig `Own.sent`), and clears this.
+ pair_left: ?bool = null,
+ /// Its pair's first client's terminal or window found again (a focus
+ /// in): the session asks whether a newer build is installed, as its own
+ /// frontend asks at its own (runtime/session.zig), and clears this.
+ pair_focused: bool = false,
/// An Upgrade told its clients so (`refuseAll`): a connection handed
/// over before its exec is told the same, never closed by the exec
/// unanswered. Its exec failed: the next boundary takes joins again.
@@ -1896,6 +1911,7 @@ pub const Peers = struct {
const t0 = nowNs();
defer if (ps.samples) ps.input_ns.append(ps.gpa, nowNs() - t0) catch {};
core.toView(peer.view);
+ if (peer.pair and in.event == .focus and in.event.focus) ps.pair_focused = true;
ps.t.stamp = stampOf(in);
core.update(in.event);
core.step();
@@ -2000,7 +2016,7 @@ pub const Peers = struct {
core.gpa.free(bytes);
return daemon.refuseReplica(fd, "out of memory");
};
- peer.* = .{ .peers = ps, .fd = fd, .id = ps.next_id, .view = .at(k), .dump = bytes, .blobs = blobs, .dump_gpa = core.gpa };
+ peer.* = .{ .peers = ps, .fd = fd, .id = ps.next_id, .view = .at(k), .dump = bytes, .blobs = blobs, .dump_gpa = core.gpa, .pair = joining.own };
ps.next_id +%= 1;
if (ps.next_id == 0) ps.next_id = 1;
// The session's digest as dumped, for the joiner to check its load by
@@ -2075,6 +2091,7 @@ pub const Peers = struct {
ps.closeViewOf(core, peer, peer.again or peer.cut);
if (ps.count() == 0) core.unattended = ps.detached;
if (ps.count() == 0 and peer.close and daemon.sessionState() == .pair) ps.closed = true;
+ if (peer.pair) ps.pair_left = !peer.bye and !peer.closing and !peer.cut;
ps.seq += 1;
ps.unit(0, ps.seq);
ps.letGo(peer);
@@ -6169,12 +6186,10 @@ const may_wait = [_]Wait{
.{ .what = "*", .on = .addon, .stop = "a kind's close", .why = "a kind's pane closed: its state let go on the session" },
.{ .what = "*", .on = .addon, .stop = "a kind's word", .why = "a word to a kind (a key it takes as one): its own state" },
.{ .what = "*", .on = .addon, .stop = "a kind's open", .why = "a kind's pane opened (`Life`): its state made on the session" },
-} ++ (if (pardes.font_picker) [_]Wait{
- // A window's view (the font words are a window's).
+} ++ (if (pardes.builtins.capabilities.font_picker) [_]Wait{
+ // A window's view's words, which a terminal's build has too: a window
+ // client of its session runs them.
.{ .what = "Font *", .on = .any, .stop = "fonts", .why = "the session's machine's fonts, its disk" },
-} else [_]Wait{}) ++ (if (pardes.builtins.capabilities.font_picker) [_]Wait{
- // ...and Fonts a terminal's build has too, which a window client of its
- // session runs (exec.zig's Font, a window build's alone, does not).
.{ .what = "Fonts", .on = .any, .stop = "fonts", .why = "the session's machine's fonts, its disk" },
} else [_]Wait{});