summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 21:34:45 -0300
committerGabriel Schneider <[email protected]>2026-11-20 00:01:23 -0300
commit528530ed065b2059d16b08efd92103d1dbbccc31 (patch)
treed7594f1372f8dea949490df346930dda7b172ac4
parent5d22d59506b58dbcc58910fb167bd212c2516544 (diff)
downloadpardes-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
-rw-r--r--core/Messages.zig3
-rw-r--r--core/replica.zig35
-rw-r--r--core/root.zig2
3 files changed, 38 insertions, 2 deletions
diff --git a/core/Messages.zig b/core/Messages.zig
index 1fb232c7..46dab136 100644
--- a/core/Messages.zig
+++ b/core/Messages.zig
@@ -76,7 +76,8 @@ pub const Message = struct {
extern "c" fn localtime_r(timep: *const libc.time_t, result: *Tm) ?*Tm;
/// PARDES_NOTIME set (the tests, a snapshot run): every clock reads
- /// `--:--:--`.
+ /// `--:--:--`. A host's (`stamp`, dev/lsp): no step reads it, the text
+ /// it stamps crossing as a setMessage's.
pub fn noTime() bool {
const v = libc.getenv("PARDES_NOTIME") orelse return false;
return std.mem.span(v).len != 0;
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"));
+}
diff --git a/core/root.zig b/core/root.zig
index 02deeaa6..632385a0 100644
--- a/core/root.zig
+++ b/core/root.zig
@@ -614,7 +614,7 @@ const machine_lines = [_]struct { []const u8, usize, []const u8 }{
.{ "FrameStats.zig", 7, "a frame's clock and log: frames are local, never digested" },
.{ "Handover.zig", 29, "a window carried to another process over a socket: the session's host" },
.{ "Kind.zig", 1, "host_io's KindJob: a kind's job is the host's" },
- .{ "Messages.zig", 6, "the message clock, read through tape.value(.clock); PARDES_NOTIME, the tests' (a step's read of the environment: set on one side only it would diverge)" },
+ .{ "Messages.zig", 6, "the message clock, read through tape.value(.clock); PARDES_NOTIME, the tests', read by a host's `stamp` alone (between steps, or in a host's call), whose text the tape carries in the setMessage it makes: never a step's" },
.{ "Output.zig", 2, "the fonts module (Fonts lists them under tape.site(.fonts)) and the build's version line" },
.{ "Stream.zig", 14, "the disk search's worker: it runs off the step and its batches are inputs" },
.{ "builtins.zig", 2, "Mount's probe (tape.site(.probe)) and Term's shell check (tape.site(.shell))" },