From 5af775e9817395af39792cc609b832394d4a4fb8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 30 Oct 2026 15:15:01 -0300 Subject: replica: what only the authority holds, a step reads off the tape (tape.authority): the store's closed panes and Recent, a script's hold on a pane's events, the 9P socket, the session's config directory and startup file; a replica's own are never read, and never put back by a rollback The Panes picker's closed rows, Recent's rows, a closed pane brought back (a Look at @pN, a Panes row), a jump to a closed file and the +Jumps rows read `p.store` and `p.recent`, `.authority` state a replica keeps on its own: its store has no file, its Recent only what it replayed since it joined. The rows made of them went into digested state, so every client of a session diverged together after a Del (H4), every client that joined after one diverged at its first unit forever (H11: trackJump dropped a closed file's jumps at every step when Recent did not know the file), a client's Del of a file the session's Recent knew made the stat the session skipped (H12: noteClosed looked in Recent first), and a client on another machine read its own store (H13). - tape.authority: poison, then a value read: the authority's answer is taped, a replay takes it, a speculation waits for it. One site, `.authority`. - Readers through it: Query's Recent and closed-pane rows, Store.reopen's record, Pardes.recentByHash (jumps, +Jumps), mouse.reportRange's readers check (a script reading a pane's events takes a look or exec: `pane.fs.readers`, the 9P server's), Tty9p's socket check, Pardes.configDir and startupPath (ThemeFile, DumpThemes, Config, DumpConfig, an init file saved), DumpConfig's dump directory. - trackJump no longer reads Recent at every step: a closed file's jump stays; the jump to it drops that file's entries when Recent has forgotten it, as when the file is gone. - noteClosed asks the host (recentKeeps, a taped stat) before it looks in Recent: the same syscall on every side. - The tty toggle, read on every key, is session state: Pardes.tty_toggle, from the options when the core is made, dumped. - The rollback copy no longer saves `store` and `recent` (rollback.zig `unsaved`): their bytes put back pointed at lists the host's heap (recentGpa) had freed, which the epoch never holds. A speculated Del then a Panes listing read a freed name (H8, the segfault). Tests, each failing before: a rollback leaves the store and Recent as a speculation left them; a replica joined after a pane closed has the session's jump to it, its Panes and Recent rows, asked by either (and the variant hunt's Recent written by another window); a replica's Del of a file its session's Recent knows asks the host what the session asked. Co-Authored-By: Claude Opus 5.5 --- src/Output.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/Output.zig') diff --git a/src/Output.zig b/src/Output.zig index 359db1cf..7c8b7f59 100644 --- a/src/Output.zig +++ b/src/Output.zig @@ -1005,6 +1005,12 @@ test "full Help renders builtin rows, a call hierarchy guide, then language keys try std.testing.expect(std.mem.indexOf(u8, group, "Callstack: static caller chains") != null); } +/// Where a dump goes by default, as the session's environment says (the +/// authority's, `tape.authority`): in `buf`. +fn dumpDirectory(buf: []u8) []const u8 { + return pardes.dump.defaultDirectory(buf) orelse ""; +} + pub fn openConfig(p: *Pardes, id: usize) !void { var out: std.Io.Writer.Allocating = .init(p.gpa); errdefer out.deinit(); @@ -1015,8 +1021,8 @@ pub fn openConfig(p: *Pardes, id: usize) !void { try p.locations_config.write(&located.writer); try config.Runtime.writeReport(&out.writer, .{ .locations = located.written(), - .default_dump_dir = if (host_fs) (pardes.dump.defaultDirectory(&dir_buf) orelse "") else "", - .startup_config_path = p.opts.startup_config_path, + .default_dump_dir = if (host_fs) pardes.tape.authority(dumpDirectory, .{@as([]u8, &dir_buf)}) else "", + .startup_config_path = p.startupPath(), .platform = builtins.viewPlatform(p), .theme_name = p.theme().name, .theme_file = pardes.colors.loadedThemeFile(p), -- cgit v1.3