From 7d9aaa29703750c4f129790314a54c9a6cd5c7c5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 3 Aug 2026 07:38:46 -0700 Subject: [PATCH] terminal/snapshot: clarify incremental history errors Document why incremental history decoding exposes native page finalization errors and intentionally bypasses the one-shot ExistingHistory guard after READY. --- src/terminal/snapshot/snapshot.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/terminal/snapshot/snapshot.zig b/src/terminal/snapshot/snapshot.zig index 2153802b4..f3adda8cb 100644 --- a/src/terminal/snapshot/snapshot.zig +++ b/src/terminal/snapshot/snapshot.zig @@ -426,6 +426,8 @@ pub const Decoder = struct { DuplicateHistory, /// A history PAGE cannot join a native PageList. + /// These propagate from `nextPage`'s non-limit finalize errors; + /// only limit failures are deliberately converted into drops. InvalidPageDimensions, RowCountOverflow, PageSizeOverflow, @@ -553,6 +555,12 @@ pub const Decoder = struct { try page.discard(self.stream.reader()); break :rows 0; }; + // The one-shot history decoder rejects a Screen which already has + // complete history. This incremental path intentionally bypasses + // that guard: the terminal has been live since READY and may have + // accumulated new history. Generation and width checks above keep + // the destination compatible, while per-page finalization enforces + // its current scrollback limits. break :rows history.decodePage( self.stream.reader(), alloc,