summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 15:05:16 -0300
committerGabriel Schneider <[email protected]>2026-11-25 15:08:19 -0300
commit4e5f978f90db55092420a5f5f8f06fff0a5f3d07 (patch)
treec857eea0e1dbaadecd68905ce8e7d824ab44639c /runtime
parente77e2b16927f1cd55fa2edde44bb591c6197b2c5 (diff)
parent2e98333b8d4ae7302eb53d7f6b0c667f371adcc5 (diff)
downloadpardes-4e5f978f90db55092420a5f5f8f06fff0a5f3d07.tar.gz
pardes-4e5f978f90db55092420a5f5f8f06fff0a5f3d07.zip
walk UI M12: D1's four changes (xtvnwlpo an Edit's change holds the reading pane it changes, Trail.edited after its File.load; tqswwxlu test/daemon.py's plain row under the walk default; vlkqvktp a newer build installed is said of no pane; owxmwxxn 2e98333b8d4a the no-build-could-load outcome an error of no pane, and the upgrade row reading what the walk UI draws) merged onto M11 and the Band fix (ovooknov), resolved by meaning: no text conflict and no file in common (D1: core/edit_cmd.zig, runtime/upgrade.zig, test/daemon.py; the rest of the line touches none of them), and none reads what another stack changed: D1's rows read the notice row as F2 left it only through the session's /log and the row's lead mark, which F2's give-way keeps (a row that fits is built byte for byte as before; a cut one keeps its mark and its words before its cause's path); core-test 1108/1279 (171 skipped: 1106 + D1's two), load 1.6 to 4
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'runtime')
-rw-r--r--runtime/upgrade.zig55
1 files changed, 48 insertions, 7 deletions
diff --git a/runtime/upgrade.zig b/runtime/upgrade.zig
index 62f49ffa..ca788cfc 100644
--- a/runtime/upgrade.zig
+++ b/runtime/upgrade.zig
@@ -89,10 +89,12 @@ fn inodeOf(path: [:0]const u8) ?u64 {
/// A newer build installed at that path since this process started, said
/// in a line, once a build: asked at a focus-in, where one comes back from
-/// rebuilding (a stat). ponytail: explicit only, no watch and no automatic
-/// upgrade.
+/// rebuilding (a stat). Of no pane, as the Upgrade's outcome is: a pane's
+/// message names its cause first (pick-ui SPEC ยง10.1), and the focused
+/// file's path is not this one's. ponytail: explicit only, no watch and
+/// no automatic upgrade.
pub fn noticeNewer(core: *pardes.Pardes) void {
- if (newer()) core.setMessage(.at(core.view().active), pardes.newer_build_words);
+ if (newer()) core.setMessage(.at(pardes.MAX_PANES), pardes.newer_build_words);
}
/// Whether to say a newer build is installed now (`noticeNewer`): asked
@@ -474,7 +476,10 @@ pub fn load(gpa: std.mem.Allocator, core_gpa: std.mem.Allocator, opts: pardes.Op
var o = opts;
o.load_path = null;
const p = try pardes.Pardes.init(core_gpa, o);
- p.setMessage(.at(p.view().active), std.fmt.bufPrint(&buf, "Upgrade: no build could load the session ({s}); its shells are here, and Restore {s} brings the rest back", .{ why, again_name[0..@min(again_name.len, 400)] }) catch "Upgrade: no build could load the session; its dump is kept for a Restore");
+ // An error, of no pane (tellEveryView): a notice would be retired at
+ // once by the fresh session's first word's echo (its shell's
+ // `Term`), and its Restore never read on the notice row.
+ _ = pardes.Messages.say(p, .@"error", pardes.MAX_PANES, std.fmt.bufPrint(&buf, "Upgrade: no build could load the session ({s}); its shells are here, and Restore {s} brings the rest back", .{ why, again_name[0..@min(again_name.len, 400)] }) catch "Upgrade: no build could load the session; its dump is kept for a Restore");
return p;
}
}
@@ -621,7 +626,7 @@ test "an upgrade from the build before reads the dump file its record names, and
try std.testing.expectError(error.FileNotFound, tmp.dir.statFile(std.testing.io, "pardes-upgrade-1.dump", .{}));
}
-test "an older build's dump named by a path past 4096 bytes is refused in words and kept for a Restore" {
+test "an older build's dump named by a path past 4096 bytes is refused in words and kept for a Restore: an error of no pane, which the fresh session's first word's echo leaves on the notice row" {
const gpa = std.testing.allocator;
var text_buf: [4200]u8 = undefined;
var long: [4096]u8 = undefined;
@@ -631,6 +636,42 @@ test "an older build's dump named by a path past 4096 bytes is refused in words
const q = try load(gpa, gpa, .{ .tty_only = true }, &rec);
defer q.deinit();
try std.testing.expect(rec.fresh);
- const pane = q.panes[q.view().active].?;
- try std.testing.expect(std.mem.indexOf(u8, q.messages.saidBy(pane), "Upgrade: no build could load the session") != null);
+ // The fresh session's first word (its shell's pane, `Term`) announced,
+ // an echo, as its host does at its start (exec.zig).
+ _ = pardes.Messages.say(q, .echo, q.view().active, "Term");
+ const said = q.messages.headline() orelse return error.NothingSaid;
+ try std.testing.expect(std.mem.startsWith(u8, said.words(), "Upgrade: no build could load the session"));
+ try std.testing.expectEqual(pardes.Messages.Kind.@"error", said.kind);
+ try std.testing.expectEqual(@as(usize, 0), said.src.len);
+}
+
+test "a newer build installed is said on the notice row in its own words, of no pane: the focused file's path is not its cause" {
+ const gpa = std.testing.allocator;
+ const p = try pardes.Pardes.init(gpa, .{ .tty_only = true });
+ defer p.deinit();
+ const pane = try p.setTestFile("one\ntwo\n");
+ // The focused file at a path as long as a session's scratch file's.
+ gpa.free(pane.file.?.path);
+ pane.file.?.path = try gpa.dupe(u8, "/home/someone/projects/a-rather-long-directory/of-the-session/notes-of-the-week.txt");
+ // A build installed at the start path since: another file there.
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "pardes", .data = "a newer build" });
+ exe_len = try tmp.dir.realPathFile(std.testing.io, "pardes", &exe_buf);
+ exe_buf[exe_len] = 0;
+ started_inode = inodeOf(exe().?).? +% 1;
+ defer {
+ exe_len = 0;
+ started_inode = null;
+ told_inode = null;
+ }
+ noticeNewer(p);
+ const said = p.messages.headline() orelse return error.NothingSaid;
+ try std.testing.expectEqualStrings(pardes.newer_build_words, said.words());
+ try std.testing.expectEqual(@as(u32, 0), said.pane);
+ try std.testing.expectEqual(@as(usize, 0), said.src.len);
+ // An 80-column terminal's notice row leads with its words.
+ var row_buf: [pardes.Messages.notice_row_cap]u8 = undefined;
+ const row = pardes.Messages.noticeRow(p, 80, &row_buf);
+ try std.testing.expect(std.mem.startsWith(u8, row.text, "\u{b7} a newer pardes is installed"));
}