diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 08:13:35 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 14:27:36 -0300 |
| commit | 27837e6345b51ceb2ceaaee58fd593024feb07c8 (patch) | |
| tree | a9d8a92c13333545203b5a17f153b609bb9815df /core/fs.zig | |
| parent | 5671a8275203334594b6f3b548e6a6012ef9fae6 (diff) | |
| download | pardes-27837e6345b51ceb2ceaaee58fd593024feb07c8.tar.gz pardes-27837e6345b51ceb2ceaaee58fd593024feb07c8.zip | |
ninep: the audit's two more finds ride with the rest: the panes the last look or exec touched (fs.results and each open's) and a column's or the workspace's tag truncation (fs.header_rewrite, header_trunc_pending, header_held) are digested and dumped, dropped at a revive as the opens are; found by reading the namespace field by field (reports/pardes-faults-4.md section 3): exec.leased reads an open's results to keep a done command pane a script reads from being taken again, and a new open's results are the session's last (no test: it needs a finished command pane read by a script); a header's truncation is the pane tag's twin: test "a client joined after a script truncated the workspace's tag writes the tag its session writes" (unequal on the base); the rest of the namespace is no fault (set and read in one request's step, or replies, the log, the listener) but edit_hold (listed: the session's listener sets it between steps); gate on this tip (load 5-18): tui core-test 868/1023 (155 skipped), shell-test 1063/1066, pane-test 183/184, behaviour-test 275/275 and --replay 275/275, term-test 17/17, kitty-test 45/45, addon-test 5/5, process-test 1 of 144 (pty/run's "busy while a job holds the tty", at load 18; 3 of 3 alone), replicas --clients 5, --bytes --clients 5 and both with --seeds 8: diverged 0, unequal 0, unlisted stops 0, corpus 22 of 22, no leak; attach probe 0 of 6; cross_replay 29 digests agree on each replica; daemon.py plain, --far, --games, --window-clients, --upgrade base -> this and this -> base pass; the macOS (Linux host), macOS arm and FreeBSD builds; the frame and perf gate against tree2 PASS: 77/77 frames, gui unit-test 1660/1664, perfab corpus2x +0.009%, perfops 121 within 0.1% (largest client-key-down on medium +0.054%)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/fs.zig')
| -rw-r--r-- | core/fs.zig | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/core/fs.zig b/core/fs.zig index dcc33cd6..eadb7c19 100644 --- a/core/fs.zig +++ b/core/fs.zig @@ -843,7 +843,10 @@ pub const EditHold = struct { pub const Namespace = struct { /// What a step reads that 9P requests made (every request an input /// each replica replays) is the core's like any state: the open - /// records and the writes held to go in as one edit, digested and dumped (a client's join takes them from + /// records (a command pane a script reads is not taken again: + /// exec.leased), the panes the last look or exec touched (a new open's + /// own), the writes held to go in as one edit and a header tag's + /// truncation, digested and dumped (a client's join takes them from /// the dump; a session revived from one drops the opens with the /// connections that held them: dump.zig `loadAndRevive`). The rest is /// the server's (core/walk.zig): its sockets and the mounts (dumped @@ -861,9 +864,9 @@ pub const Namespace = struct { "lsp_answer_at", "edit_started", "edit_hold", "edit_said", "lsp_result", "write_room", "write_waits", "log_full_hash", "pages", "closed_lines", "ran_at", "refilled", "failures", "ename", "news", "hanging_up", "log", "plumb_held", - "results", "results_len", "started", "header_rewrite", "header_trunc_pending", "header_held", + "started", }, - .len = .{.{ "opens", "opens_len" }}, + .len = .{ .{ "opens", "opens_len" }, .{ "results", "results_len" } }, }; socket_path: []const u8 = "", tcp_address: ?std.Io.net.IpAddress = null, @@ -1025,11 +1028,17 @@ pub const Namespace = struct { /// Its digest (core/walk.zig): the opens in use, and writes held by /// their length (their bytes are the same writes on every side; a /// stream of 8 KB appends hashed whole cost each its length again; - /// none held, the rest of `batch` is nothing a step reads). Nothing at + /// none held, the rest of `batch` is nothing a step reads), the panes + /// the last look or exec touched, a header's truncation. Nothing at /// all for a session no script holds anything of. pub fn digest(st: *const Namespace, h: *pardes.walk.Hasher) void { - comptime if (pardes.walk.fieldNames(Namespace).len != 3) @compileError("Namespace.digest: hash every field the walk does not leave out"); + comptime if (pardes.walk.fieldNames(Namespace).len != 8) @compileError("Namespace.digest: hash every field the walk does not leave out"); for (st.opens[0..st.opens_len]) |*o| pardes.walk.hash(tree.Open, o, h); + h.update(std.mem.sliceAsBytes(st.results[0..st.results_len])); + if (st.header_rewrite != null or st.header_trunc_pending != null or st.header_held) { + const words = [_]u64{ st.header_rewrite orelse std.math.maxInt(u64), st.header_trunc_pending orelse std.math.maxInt(u64), @intFromBool(st.header_held) }; + h.update(std.mem.asBytes(&words)); + } const b = &st.batch; if (b.bytes.items.len == 0) return; const words = [_]u64{ b.serial, b.node, b.handle, b.at, b.bytes.items.len, b.last_ns }; @@ -1041,8 +1050,12 @@ pub const Namespace = struct { pub fn forget(st: *Namespace, gpa: std.mem.Allocator) void { for (&st.opens) |*o| o.deinit(gpa); st.opens_len = 0; + st.results_len = 0; st.batch.bytes.deinit(gpa); st.batch = .{}; + st.header_rewrite = null; + st.header_trunc_pending = null; + st.header_held = false; } pub fn mount(st: *Namespace, gpa: std.mem.Allocator, name: []const u8, dial: []const u8) !void { |
