diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 14:21:49 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 14:49:19 -0300 |
| commit | d4a712935cdc106b736fa984d176dd7ccbe8a66c (patch) | |
| tree | a0838e089a8e9974b7bfeae635bc0c535b904e55 /runtime | |
| parent | 1e4e1cb6a20b26307b259da629ce926c44585fdf (diff) | |
| download | pardes-d4a712935cdc106b736fa984d176dd7ccbe8a66c.tar.gz pardes-d4a712935cdc106b736fa984d176dd7ccbe8a66c.zip | |
upgrade: a newer build installed is said of no pane, as the Upgrade's outcome is (D1, the install gate's failure 3: `--upgrade` between the tree's own Debug and ReleaseSafe builds, both ways, `the newer build said` TimeoutError): noticeNewer said it about the focused pane (from when a message was a chip in that pane's tag); under the walk UI a pane's message names its cause first on the notice row (pick-ui SPEC §10.1, Messages.say's causeWord), so the row read `· <the focused file's path> a newer pardes …` and, in 80 columns behind the test's 77-byte path, only `· /home/…/.scratch… 2 messages · SPC h m`; THE FIX: `.at(MAX_PANES)` (tellEveryView's rule: the session's news, of no pane in particular); TEST FIRST: upgrade.zig "a newer build installed is said on the notice row in its own words, of no pane: ..." (the focused file at an 84-byte path, another file at the start path than the one started from) fails on walkui-final, the message about the focused pane (serial 2); a user could have hit it: a narrow terminal on a file with a long path, the focus-in that tells of a newer build showing that file's path alone
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.zig | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/runtime/upgrade.zig b/runtime/upgrade.zig index 62f49ffa..7e376da5 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 @@ -634,3 +636,34 @@ test "an older build's dump named by a path past 4096 bytes is refused in words 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); } + +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")); +} |
