diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 21:34:45 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 00:01:23 -0300 |
| commit | 528530ed065b2059d16b08efd92103d1dbbccc31 (patch) | |
| tree | d7594f1372f8dea949490df346930dda7b172ac4 /core/replica.zig | |
| parent | 5d22d59506b58dbcc58910fb167bd212c2516544 (diff) | |
| download | pardes-528530ed065b2059d16b08efd92103d1dbbccc31.tar.gz pardes-528530ed065b2059d16b08efd92103d1dbbccc31.zip | |
far client: PARDES_NOTIME is read by no step, said where it is read, and a test that a client whose environment differs replays the session's stamped text (no fix: the fault does not happen on this tree): `Messages.Message.noTime` is called by `clockText` alone, whose callers are `timeOfDay`, called by `stamp` alone, which only hosts call (dev/file_watch, dev/host_io's save and dumped themes, tui's, gui's and macos's lsp status and reloads: between steps, or inside the host's own entry during one, where the text then enters the tape as the setMessage the host makes, a nested input), and tape.zig's `guessed` for a `[8]u8` clock read, a branch no site instantiates (the clock sites return i64: the message's monotonic ms); dev/lsp's `hideTime` is a host's too; so the knob needs no option handed in: root.zig's machine_lines reason for Messages.zig, which said a step reads it, and noTime's doc say what is so; found dead, not changed: the `[8]u8` guess in tape.zig's `guessed` and with it `Guess.gmtoff`, the replica's `gmtoff()` and the welcome's `gmtoff` (abi/wire.zig), there for a message time of day guessed in a speculation, which no step reads any more; the test `a far client's replay of a message its session's host stamped takes the session's text, whatever its own PARDES_NOTIME says` (end of core/replica.zig: the session's host stamps a yank's message with PARDES_NOTIME set, the client replays it with it unset) passes on the base; gates on the seven together (the stack's top, load 18 to 50 beside them): tui core-test 855/999 (144 skipped), shell-test 1035/1038, pane-test 183/184, term-test 15/15, kitty-test 45/45, behaviour-test 275/275 and --replay 20 seeds 0 failures, process-test 3 of 144 (lspcomplete and lspcompletemoved, the base's, and headersweep-restored, which passes alone), gui unit-test 1633/1637 with the base's BaselineHarnessMismatch; replicas --clients 5 and --seeds 8: diverged 0, unequal 0, deltas wrong 0, quiet checks differed 0, unlisted stops 0, corpus 22 of 22, no leak report; the walk over every word and key passes; frame and perf gate against tree1 (farfaults): frames 77/77 byte-identical in Debug, unit-test 1633/1637, perfab corpus2x -0.087% (noise 0.092%, bar 0.4%, pictures identical), perfops 97 counts within 0.1% (largest +0.0329%)
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.zig | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/core/replica.zig b/core/replica.zig index 13c1fe46..3aeb21af 100644 --- a/core/replica.zig +++ b/core/replica.zig @@ -6331,3 +6331,38 @@ test "a far client's step that asks for a search goes on at once, and a session try std.testing.expect(a.core.stream.state == .done); try agrees(a, r); } + +// PARDES_NOTIME (the tests' `--:--:--` clock) is read by `Message.stamp`, +// which only a host calls: between steps, or in its own entry during one. +// The stamped text crosses as the setMessage the host makes, so a client +// whose environment says otherwise replays the session's text. +test "a far client's replay of a message its session's host stamped takes the session's text, whatever its own PARDES_NOTIME says" { + const gpa = std.testing.allocator; + const Stamping = struct { + var core: ?*Pardes = null; + fn yank(_: ?*anyopaque, _: []const u8) void { + var buf: [64]u8 = undefined; + const c = core.?; + c.setMessage(.at(c.view().active), pardes.Messages.Message.stamp(&buf, "yanked", "x")); + } + const vtable: pardes.Host.VTable = .{ .watched = TestHost.watched, .set_clipboard = yank }; + }; + const Shell = @import("dev").host_io.Shell; + const was = if (std.c.getenv("PARDES_NOTIME")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; + defer if (was) |v| gpa.free(v); + defer _ = if (was) |v| Shell.setenv("PARDES_NOTIME", v, 1) else @import("dev").host_io.testUnsetenv("PARDES_NOTIME"); + const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml" }, .{ .vtable = &Stamping.vtable }, false); + defer a.deinit(); + Stamping.core = a.core; + const r = try joinedFresh(a); + defer r.deinit(); + // The session's machine says `--:--:--`; the client's the time of day. + _ = Shell.setenv("PARDES_NOTIME", "1", 1); + const u = try gpa.dupe(u8, try a.own(.{ .command = "ClipYank" })); + defer gpa.free(u); + _ = @import("dev").host_io.testUnsetenv("PARDES_NOTIME"); + r.confirm(u); + r.settle(); + try agrees(a, r); + try std.testing.expect(try shows(r.core(), "--:--:-- yanked x")); +} |
