mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-10-26 14:30:13 +00:00
6be2f81fec
* fix(collab): the relay does not store a byte-identical re-sent frame (BUG-3135) A reconnecting tab re-pushes its whole document, and the relay stored each copy: 92 MB of byte-identical rows above watermarks on the live op-log. The relay now appends through store.AppendSyncFrame, which skips a frame that is byte-identical to an earlier row of the same item. The byte compare decides; the hash only narrows the lookup. Subtype twins and envelope frames are stored as before. A skipped frame is still broadcast, and still acknowledged: its cursor is the item's MAX(id), read under appendMu, so every row at or below it has already reached each peer's bus. It does not advance the sender's lastPersistedOpID, which the restore bracket reads as "this frame is in the op-log". Replay-safe because op-log GC removes an item's rows all or nothing, so the earlier twin exists while anything could follow it. No reader of MAX/MIN(id) or of the flush cursor sees a frame that never got an id. Measured on BUG-3134's harness: +2 rows / +331 bytes per reconnect became +1 / +10 (the SyncStep1), and +325 bytes per repeat join became +4. Claude-Session: https://claude.ai/code/session_01X4uYKs5ZPF28eCWfm8VPvE * fix(store): answer the duplicate check and MAX(id) in one statement (BUG-3135, codex round 1) Codex raised a delete landing between the two reads. No op-log delete path can reach a live readLoop today, but one statement makes the skip exactly as durable as the insert it replaces under any interleaving, without relying on that. Claude-Session: https://claude.ai/code/session_01X4uYKs5ZPF28eCWfm8VPvE