Files
buzz/desktop/src
Duncan ffda3579a5 fix(sidebar-sync): preserve publishBaseline on superseding click (Carl P2)
wholeBlobSyncManager.startPendingEdit() unconditionally reseeded
publishBaseline from mutable lastRemoteHead on every non-replay call.
Sequence: A1 click pending → live H102 suppressed by hasPendingEdit →
A2 second click → lastRemoteHead (=H102) folded into baseline →
preflight saw no advance → A2 silently overwrote H102-only changes.
Contract violation per JSDoc :51-55/:163-174.

Fix: reseed publishBaseline only when (a) starting a fresh pending
sequence (wasIdle) or (b) lastRemoteHead holds our OWN in-flight
published attempt (lastIsOwnAttempt: eventId ∈ ambiguousAttemptIds).
Case (b) is required so foldSupersedingAttemptWinner can repair the
baseline on a same-second collision. A suppressed live remote head is
never in ambiguousAttemptIds → lastIsOwnAttempt=false → baseline is
preserved across all pending phases (debounce, preflight, publish,
confirmation wait).

Replay path (isRestoredReplay) semantics unchanged.

New tests: wholeBlobSyncCarlP2SecondClick.shared.test.mjs, Variant A
(debounce-window) and Variant B (in-flight), wired into both lane
test files. Required mutations: timer-phase revert turns Variant B
red; unconditional-reseed revert turns all four red. Same-second
collision test remains green under both mutations.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-09-03 12:45:40 -04:00
..