summaryrefslogtreecommitdiff
path: root/core/replica.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 19:02:34 -0300
committerGabriel Schneider <[email protected]>2026-11-20 19:02:34 -0300
commit486f347adeed5bac6aaabe8be34e6a69bf323a62 (patch)
treeda8b333b4033889aa2fd16ab7f5a4bef35b0401d /core/replica.zig
parent4053e62a2aabd794db9075d93ebe57eec3f432a6 (diff)
parent06f6c72583faf8256190a0ae195a8085e7cd7f32 (diff)
downloadpardes-486f347adeed5bac6aaabe8be34e6a69bf323a62.tar.gz
pardes-486f347adeed5bac6aaabe8be34e6a69bf323a62.zip
integration: six small faults on a hang-up as a close: pardes-faults-6 (a hang-up with no daemon kills the language servers' children; the daemon's reader hands a note under a lock; a retried Edit write answered from the listener's hold; the cursor hidden when a frame has no caret; syntax-test deleted and the grammar tiers' tests skipping; the tty harness's Esc after what came before is read) and pardes-merge41, merged without a textual conflict; tui core-test 874/1031 (157 skipped), shell-test 1073/1076, term-test 17/17, both soaks diverged 0, unequal 0, unlisted 0, the window builds; the coordinator's gate in the ledger (reorg/merge42)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/replica.zig')
-rw-r--r--core/replica.zig36
1 files changed, 36 insertions, 0 deletions
diff --git a/core/replica.zig b/core/replica.zig
index 1883e836..0b554ed5 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -7364,6 +7364,42 @@ test "a client joined while a script's writes to a body are held to go in as one
try n.agree();
}
+test "a client runs an Edit a script's write started once, as its session does, when the held write is asked again" {
+ var n = try NinepJoin.init("b\na\n", TestHost.host());
+ defer n.deinit();
+ try n.join();
+ const ctl = n.node(.ctl);
+ const req: pardes.ctlfs.Req = .{ .tag = 7, .op = .write, .node = ctl, .data = "Edit , | sort\n" };
+ // The step alone: its loop's pass would run the command (here, with no
+ // host to run it, fail it).
+ const first = try n.serve(req, false);
+ try std.testing.expectEqual(pardes.ctlfs.Status.ok, first.status);
+ // The write held as the session's listener holds it (runtime/9p_io.zig).
+ n.a.core.fs.edit_hold = .{ .asker = @ptrCast(n.a.core), .slot = 0, .seq = 1, .tag = req.tag, .node = ctl, .handle = 0, .written = first.written };
+ // Its command answers: the Edit is done.
+ n.a.apply(.{ .pipe_resp = .{ .id = n.a.core.pipe.edit_run.?.id, .success = true, .outputs = &.{"a\nb\n"} } });
+ n.a.seq += 1;
+ try n.send(try n.a.unit(0, n.a.seq));
+ try n.agree();
+ // A retry of the held write's park, as the listener serves it: its
+ // answer from the hold, no step, the Edit not run again by anyone.
+ const again = pardes.filesystem.EditHold.retried(&n.a.core.fs, req) orelse try n.serve(req, true);
+ try std.testing.expectEqual(pardes.ctlfs.Status.ok, again.status);
+ try std.testing.expect(n.a.core.pipe.edit_run == null);
+ try n.agree();
+}
+
+test "an Edit's stop token is each process's own (selection_pipe.next_token): a client's differs from its session's, and they agree" {
+ var n = try NinepJoin.init("b\na\n", TestHost.host());
+ defer n.deinit();
+ try n.join();
+ _ = try n.serve(.{ .tag = 1, .op = .write, .node = n.node(.ctl), .data = "Edit , | sort\n" }, false);
+ const session = n.a.core.pipe.edit_run.?.request.token;
+ const client = n.late.?.core().pipe.edit_run.?.request.token;
+ try std.testing.expect(session != client);
+ try n.agree();
+}
+
/// A session with a shell, for a run's 9P state across a join: a host
/// whose pty takes the line and whose tty nobody else holds.
const RunJoin = struct {