diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-30 02:01:30 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-30 03:13:15 -0300 |
| commit | f8a56c962d5103b84453d4305cd27973a71d4aa3 (patch) | |
| tree | 95da95264b53fab6637808bd62410f7740b2880c /src/upgrade.zig | |
| parent | 6118ad214bb74744e7b38004b34e4487a6635be1 (diff) | |
| download | pardes-f8a56c962d5103b84453d4305cd27973a71d4aa3.tar.gz pardes-f8a56c962d5103b84453d4305cd27973a71d4aa3.zip | |
replica clients join again: one that diverged (a digest the session's unit did not end on) and one the session let go to upgrade dial it again, the same join as the first, and say why in a line over their frame until a key; a client of another build is told "session upgraded to a newer pardes: upgrade this client too"
tty.zig `remote` is a loop of joins over one terminal: the link ended, its reader joined, the replica let go, the session dialled again (an upgrade's exec and load, and its daemon's, retried for 20 s), its dump loaded, its view's size sent again. `Remote.notify` draws the line (`noticeLine`, the client's own, never the session's core).
The welcome carries the session's semantics: the daemon judged the hello by the hash it last heard, which an upgrade under way may not have said yet.
replica.zig `Peers.refuseAll`: before an Upgrade's dump each client is sent `refused` after what it was sent (up to 200 ms) and let go, its view with it.
"A newer pardes is installed" is a Host call (`newer_build`) the core makes in its focus step, so replica clients take the line from the tape; the GUI still says it itself.
PARDES_TEST_DIVERGE=<n> puts a client's core off the session's once quiet after its n-th unit. test/daemon.py: the clients test has one rejoin and agree; the upgrade test has a client of the old build told to upgrade and one of the build running join again and agree.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/upgrade.zig')
| -rw-r--r-- | src/upgrade.zig | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/upgrade.zig b/src/upgrade.zig index 49e8aff5..37c79991 100644 --- a/src/upgrade.zig +++ b/src/upgrade.zig @@ -74,11 +74,18 @@ fn inodeOf(path: [:0]const u8) ?u64 { /// rebuilding (a stat). ponytail: explicit only, no watch and no automatic /// upgrade. pub fn noticeNewer(core: *pardes.Pardes) void { - const was = started_inode orelse return; - const now = inodeOf(exe() orelse return) orelse return; - if (now == was or told_inode == now) return; + if (newer()) core.setMessage(core.active, pardes.newer_build_words); +} + +/// Whether to say a newer build is installed now (`noticeNewer`): the +/// tty's Host answers the core's focus step with it, so its replica +/// clients take the line from the tape. +pub fn newer() bool { + const was = started_inode orelse return false; + const now = inodeOf(exe() orelse return false) orelse return false; + if (now == was or told_inode == now) return false; told_inode = now; - core.setMessage(core.active, "a newer pardes is installed: Upgrade (SPC s U) moves this session onto it"); + return true; } pub fn exe() ?[:0]const u8 { |
