diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 04:17:12 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 05:21:29 -0300 |
| commit | 8d9f4c88072089b53c77ab7e66b01c461fbbee74 (patch) | |
| tree | 590a18e451e7bc9a60eae087217b51f0ceb74efa /dev/host_io.zig | |
| parent | 6e8735895d04c0073eb28cc1a2f431a2ba587e9d (diff) | |
| download | pardes-8d9f4c88072089b53c77ab7e66b01c461fbbee74.tar.gz pardes-8d9f4c88072089b53c77ab7e66b01c461fbbee74.zip | |
dev, runtime: the addons' jobs and draws, the pipes and a search answer through the session's one queue in both frontends, and their workers are the queue's: the terminal's own posts to vaxis's queue are deleted (its pipe_done, search_rows and kind_job messages and their arms in apply and in Own.close's drain, deliverSearch, deliverPipe, the two inline deliver functions), its pipe, search, job and draw post with Inbox.pushPipe, pushSearch and pushJob as the window's did and takeQueue lands them; Inbox.land (landLsp grown to every worker's answer: a pipe's, a search's rows, a job's or a draw's, a handover's end) replaces the two frontends' copies of those arms; pipe_tasks and job_tasks leave both Shells and the window's Own for the Inbox beside lsp_task, ended in Inbox.deinit (and so a client's draws in both clients, which the terminal's client never canceled), the pipes canceled by the session loop's Restore and the search's worker by the loop's end, not by each frontend's close and restoring; a terminal client's queue wakes its loop (wakeForQueue) now that its draws come through it; the test first: on the base a search worker's post into vaxis's full queue waited for the loop to take one and a cancel did end it (vaxis's Queue.push waits on a cancelable condition), so no worker could have hung, but the terminal's keys waited behind up to 512 queued batches of rows in that one queue (the input thread's post waits in it too); now rows wait in the session's queue and keys never behind them, pinned by host_io's test of pushSearch into a full queue (a take lets it in, a cancel ends the wait and frees the rows); tui core-test 857/1008 (151 skipped), shell-test 1048/1051, term 17/17, pane 183/184, kitty 45/45, behaviour-test and --replay 275/275, process-test 0 of 144 failed (wheeldrift and exec 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, one unlisted stop at `now` at 30 ms (the base's, known); gui unit-test 1645/1649 with only the perf check's BaselineHarnessMismatch; daemon.py plain, --far, --games, --window-clients, --upgrade both ways pass (upgrade-back failed once at its Adopt into the old build's fresh session, then passed 3 of 3) (load 11-22)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'dev/host_io.zig')
| -rw-r--r-- | dev/host_io.zig | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/dev/host_io.zig b/dev/host_io.zig index 5465fc7a..1c4fe332 100644 --- a/dev/host_io.zig +++ b/dev/host_io.zig @@ -2270,6 +2270,38 @@ test "PTY EOF reserve cannot evict terminal output" { for (batch.items[Inbox.output_capacity..batch.len], 0..) |msg, pane| try std.testing.expectEqual(pane, msg.eof.pane.index()); } +test "a search's rows posted into a full queue wait for room: a take lets them in, a cancel ends the wait and frees them" { + const gpa = std.testing.allocator; + const io = std.testing.io; + var queue: Inbox = .{ .io = io, .gpa = gpa, .lsp_allocator = gpa }; + defer queue.deinit(); + queue.acceptReader(.at(0), 1); + const Post = struct { + fn run(q: *Inbox, posted: *?bool) void { + const rows = std.testing.allocator.dupe(u8, "a.txt:1:1-2 hit\n") catch return; + posted.* = Inbox.pushSearch(q, .{ .gen = 1, .rows = rows }); + } + }; + for ([_]bool{ false, true }) |cancel| { + // The loop busy: its queue full of output. + for (0..Inbox.output_capacity) |_| queue.push(.{ .output = .{ .pane = .at(0), .gen = 1, .bytes = try gpa.dupe(u8, "busy") } }); + var posted: ?bool = null; + var worker = try io.concurrent(Post.run, .{ &queue, &posted }); + try PtyTests.waitBlocked(&queue); + if (cancel) worker.cancel(io) else { + var batch = queue.take(); + for (batch.slice()) |msg| msg.deinit(gpa, gpa); + worker.await(io); + } + try std.testing.expectEqual(!cancel, posted.?); + var rest = queue.take(); + defer for (rest.slice()) |msg| msg.deinit(gpa, gpa); + try std.testing.expectEqual(@as(usize, if (cancel) Inbox.output_capacity else 1), rest.len); + if (!cancel) try std.testing.expectEqualStrings("a.txt:1:1-2 hit\n", rest.items[0].search.rows); + try std.testing.expectEqual(@as(usize, 0), queue.waiting); + } +} + test "completions retain their arrival order across LSP and pipes" { const gpa = std.testing.allocator; var queue: Inbox = .{ .io = std.testing.io, .gpa = gpa, .lsp_allocator = gpa, .lsp_id = 2 }; |
