From 26d0581168ac4b582025ecb01b36968850344811 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 06:07:10 -0300 Subject: runtime, dev: the daemon's notes are the session loop's own, so `note` leaves the frontend calls (nine to eight: options, open, close, start, sent, upgradeAsked, restoring, restored): the loop's note puts an adopted shell on its queue (both frontends take it in their wait), hands a client's connection to Peers (joined at the next step boundary, its post the wake, as the window did) and wakes the queue for a new daemon's hello; the terminal's deliverNote, its adopted and replica messages and arms (in apply and in Own.close's drain) and the window's deliverNote and both Own.note are deleted, the terminal's Shell names its session loop (`session`) so that a quit before the first frame starts the daemon's reader through the loop's watch; and the test first: an Adopt's shells arriving while output fills the queue were dropped by Inbox.push, their masters closed and the shells lost with them (448 outputs in, the shell and the end of the list pushed, 448 taken), in the window today, and in the terminal once its notes came through this queue (vaxis's queue had made the daemon's thread wait); the queue now keeps room for one Adopt's shells beyond the output's (adopt_capacity, the ring 64 + 1 longer, the output's bound unchanged) and each pane's end of file beyond those; a user could have hit it: Adopt in a window while another pane floods; tui core-test 858/1009 (151 skipped), shell-test 1049/1052, term 17/17, pane 183/184, kitty 45/45, behaviour-test and --replay 275/275, process-test 0 of 144 failed (msg, pagercolor and exec-bigdrag failed once in the run, passed on their retries), soak --clients 5 diverged 0, unequal 0, checked/wrong 1874/0 1937/0 1831/0, quiet checks 597/0 673/0 779/0, unlisted 0, corpus 22 of 22, no leak; --bytes --clients 5 diverged 0, unequal 0, quiet checks 693/0 586/0 802/0, corpus 22 of 22, no leak, its one unlisted stop at `now` the base's; gui unit-test 1646/1650 with only BaselineHarnessMismatch; daemon.py plain, --far, --games (keys stopped 0 and 0), --window-clients, --upgrade both ways pass (load 8-22) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- test/replicas.zig | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/replicas.zig b/test/replicas.zig index 7bf79055..7610ad8c 100644 --- a/test/replicas.zig +++ b/test/replicas.zig @@ -1120,7 +1120,6 @@ const Soak = struct { } pub fn upgradeAsked(_: *Soak) void {} - pub fn note(_: *Soak, _: anytype) void {} pub fn restoring(_: *Soak, _: *pardes.Pardes) void {} pub fn restored(_: *Soak, _: *SessionLoop) void {} -- cgit v1.3 From c8ac386d8f2404417b6d09af1635e1104bcc66ae Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 10:50:39 -0300 Subject: test: the tty harness ends a case as closing its terminal ends it: Harness.deinit closes the master first, waits on the app for up to 5 s and SIGKILLs and reaps it only after (it SIGKILLed at once and never reaped); the whole process-test on the run's own binaries under a subreaper, before and after: wall 82.7 s (load 8) against 84.7 s (load 9) and 87.4 s (load 15), the processes left 5 s after its end 1 and 1 (cmdexit's own `sleep 30`), 0 of 144 failed each time: nothing measurable, since every tty case runs without a daemon and a hangup is Killed.handle's (the terminal put back, then the signal's own death by raise), which runs no exit hook either, so a language server's group is not killed (lsp_client's killAllAtExit, an atexit) whichever way the case ends; the final tree, this change on the three before it: tui core-test 858/1009 (151 skipped), shell-test 1050/1053, term 17/17, pane 183/184, kitty 45/45, behaviour-test and --replay 275/275, process-test 0 of 144 failed, soak --clients 5 diverged 0, unequal 0, checked/wrong 1874/0 1937/0 1831/0, quiet checks 597/0 673/0 779/0, unlisted 0, corpus 22 of 22, no leak, --bytes --clients 5 diverged 0, unequal 0, corpus 22 of 22, no leak, its one unlisted stop at `now` the base's; gui unit-test 1647/1651 with only BaselineHarnessMismatch; daemon.py plain, --far, --games (keys stopped 0 and 0), --window-clients, --upgrade both ways pass; the macOS library (Linux, aarch64-macos) and FreeBSD tui build; the frame and perf gate against tree2 PASS (77 of 77 frames byte-identical, perfab corpus2x -0.039% with noise 0.080%, perfops 121 counts within 0.1%, the largest +0.0056%) (load 4-17) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- test/e2e_harness.zig | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/e2e_harness.zig b/test/e2e_harness.zig index f7d65b03..26e942e7 100644 --- a/test/e2e_harness.zig +++ b/test/e2e_harness.zig @@ -149,9 +149,25 @@ pub const Harness = struct { return true; } + /// The app ended as closing its terminal ends it: the master closed (its + /// hangup), the app given `end_ms` to end, SIGKILLed only after, and + /// reaped: what it ends at its own end (its shells, its language servers' + /// groups) does not outlive the case. pub fn deinit(self: *Harness) void { - posix.kill(self.pid, posix.SIG.KILL) catch {}; _ = libc.close(self.master); + const end_ms = 5000; + const until = nowMs() + end_ms; + var status: c_int = 0; + var none: [0]posix.pollfd = .{}; + while (libc.waitpid(self.pid, &status, libc.W.NOHANG) == 0) { + if (nowMs() < until) { + _ = posix.poll(&none, 5) catch 0; + continue; + } + posix.kill(self.pid, posix.SIG.KILL) catch {}; + _ = libc.waitpid(self.pid, &status, 0); + break; + } self.stream.deinit(); self.gpa.destroy(self.raw); self.term.deinit(self.gpa); -- cgit v1.3