From 5b857bb55fae0a220f54b140bc1b46c3efb991bb Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 19 Nov 2026 05:01:46 -0300 Subject: core: the session's facts are the core's state, read once at its start (the reorganisation's 12b, the design round's step 3; the user's ruling P16 and the lean put with P17: a far client's `~`, default shell and "is this shell installed" are the session's): its home (`~`) and the shell its terminals run when no `Shell` is set ($SHELL if executable, else /bin/sh) are fields beside `session_dir`, `session_home` and `session_shell` (working names, the user's to rule), each read once with `session_dir` by Pardes.readSessionFacts (tape.value(.env): a replay of the boot reads the session's answers), at the session's start and after a load of a dump made before they were dumped, and carried by the dump; `sessionDir` no longer fills itself at first use (it was filled at the start already), and a client's step reads the session's, never its own machine's: Pardes.expandHome (`~` the session's home; `~user` a passwd read, taped, as before) at Save, a tag's name, Theme's path, Get, Incl, a Look of `~/x`, a 9P name and pager, Dump's path, sam's B, e, r and w (sam_edit.World.home) and DumpDir's check (config.Runtime.apply takes the home); bare `Shell`, the shell a terminal runs, the settings report and its 9P twins read `session_shell`; "is this shell installed" (Shell , Term , a 9P exec) is a question to the session's disk, tape.site, so far away it waits a round trip instead of answering from the client's machine and rolling back; deleted: the value reads at config.defaultShell (now the process's read, made at the start alone) and at Core.sessionDir, and the tape's `cwd` tag (the directory is read under `env` at the start); fs.expandHome stays for this process's own home, the launcher's (runtime/main.zig) and the state file's directory and a Restore's name (the session's side: a client's Restore waits, its replay reads the tape); the tape's shape changes (`cwd` gone, `shell` a site), so the semantics word moves (the tape's shape now hashes the sites too: it did not see a site gone or added, and this change alone left it as it was), adacca2db2b39264 -> 517cd1c276996a3c: an old build and a new refuse each other's clients, in words; a test at the end of core/replica.zig (a joined client's own `Look ~/x`, bare `Shell` and Tutor, a word run in the session's directory, record no `env` read; the client's shell and directory are the session's), shown failing on the change before (`Look ~/x` read the environment); not handled: a Restore of a dump carries that dump's facts (as `session_dir` did); tui core-test 833/976 (143 skipped), shell-test 1011/1014, pane-test 183/184, behaviour-test 275/275 and --replay 275/275, process-test 2 of 144 failed (lspcomplete, lspcompletemoved, the base's; hscroll flaked once), replicas --clients 5 diverged 0 unequal 0 deltas wrong 0 quiet differ 0 at 30/80/207 ms, stopped 89/73/108, gui unit-test 1609/1613 (its perf check's BaselineHarnessMismatch the base's), daemon.py plain, --far, --games, --window-clients pass; gate-w seam-b-3 against tree1: 77/77 frames byte-identical in Debug, its unit-test 1609/1613, perfab corpus2x +0.095% (pictures identical in all 10 runs), perfops 97 counts within 0.1% (largest +0.0198%, body-appends on longline) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/exec.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core/exec.zig') diff --git a/core/exec.zig b/core/exec.zig index 6804a22e..5a9bf192 100644 --- a/core/exec.zig +++ b/core/exec.zig @@ -333,7 +333,7 @@ pub fn saveTo(p: *Pardes, id: usize, path: []const u8) void { var home_buf: [4096]u8 = undefined; const full = std.Io.Dir.path.resolvePosix( p.scratch.allocator(), - &.{ Pardes.paneDir(pane), @import("fs.zig").expandHome(path, &home_buf) }, + &.{ Pardes.paneDir(pane), p.expandHome(path, &home_buf) }, ) catch |err| return p.reportError(id, "save", err); if (!std.Io.Dir.path.isAbsolute(full)) return p.reportError(id, "save", error.NoDirectory); if (full.len > Pardes.SavePath.cap) return p.reportError(id, "save", error.PathTooLong); @@ -1022,25 +1022,25 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[] p.settings.shell.pending = true; if (!p.announce) return; var said: pardes.Kind.Buf(320) = .{}; - return p.setMessage(v.active, said.print("Shell: the default again, {s} ($SHELL, else /bin/sh)", .{config.defaultShell()[0..@min(config.defaultShell().len, 256)]})); + return p.setMessage(v.active, said.print("Shell: the default again, {s} ($SHELL, else /bin/sh)", .{p.sessionShell()[0..@min(p.sessionShell().len, 256)]})); } var why: [320]u8 = undefined; - if (pardes.tape.value(.shell, @import("dev").host_io.Shell.refusal, .{ want[0..@min(want.len, 200)], &why })) |refused| { + if (pardes.tape.site(.shell, null, @import("dev").host_io.Shell.refusal, .{ want[0..@min(want.len, 200)], &why })) |refused| { var text: pardes.Kind.Buf(340) = .{}; return p.reportFailure(v.active, text.print("Shell: {s}", .{refused})); } - if (!p.settings.apply(setting, want)) p.reportFailure(v.active, "Shell: takes " ++ comptime config.Runtime.takes(.shell).?); + if (!p.settings.apply(setting, want, p.sessionHome())) p.reportFailure(v.active, "Shell: takes " ++ comptime config.Runtime.takes(.shell).?); }, // Bare, each says its value, as acme's Tab says the width. inline .tab, .callstack_depth => |_, tag| if (arg == null) { var said: pardes.Kind.Buf(40) = .{}; return p.setMessage(v.active, said.print("{s} {d}", .{ setting.word, @field(p.settings, @tagName(tag)) })); - } else if (!p.settings.apply(setting, arg)) { + } else if (!p.settings.apply(setting, arg, p.sessionHome())) { var said: pardes.Kind.Buf(96) = .{}; p.reportFailure(v.active, said.print("{s}{s}: takes {s}", .{ setting.word, if (tag == .tab) ": invalid tab width" else "", comptime config.Runtime.takes(tag).? })); }, // Said with what it takes: its words, its range. - else => if (!p.settings.apply(setting, arg)) { + else => if (!p.settings.apply(setting, arg, p.sessionHome())) { var buf: [160]u8 = undefined; var text: std.Io.Writer = .fixed(&buf); // A list of values too long for the row is cut. -- cgit v1.3