From afea6add5ad7c406dc1b05fbb65311c9049bdfd1 Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 2 Sep 2026 15:10:39 -0400 Subject: [PATCH] fix(sidebar-sync): use hold bootstrap in P3 restart test; remote head drives merge at doPublish not bootstrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bootstrap fetch returns [] (hold) so publishStars is called unconditionally — the subsumed guard only runs on apply-remote, which would require extra async ticks to verify. The 501-entry merge still exercises at the production seam: when the 2s debounce fires and doPublish calls fetchRemoteStars (fetchCalls=2), the 500-entry remote head triggers mergeWithRemote producing 501 entries. Without preservedKey forwarded from the foreign record, boundStarStore evicts the clicked channel there. The test structure now matches the existing bootstrap replay test (hold bootstrap → timer fires → publish cycle exercises the production path). Co-authored-by: Will Pfleger Signed-off-by: Will Pfleger --- .../src/features/sidebar/lib/mergeLaneHook.shared.test.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/desktop/src/features/sidebar/lib/mergeLaneHook.shared.test.mjs b/desktop/src/features/sidebar/lib/mergeLaneHook.shared.test.mjs index 32508bb2f4..420119f7e3 100644 --- a/desktop/src/features/sidebar/lib/mergeLaneHook.shared.test.mjs +++ b/desktop/src/features/sidebar/lib/mergeLaneHook.shared.test.mjs @@ -660,9 +660,14 @@ export function runMergeLaneHookSuite({ const publishCalls = []; let fetchCalls = 0; + // Bootstrap fetch returns hold (empty) so publishStars is always called + // unconditionally — the subsumed guard only suppresses on apply-remote. + // The per-publish mergeWithRemote fetch (fetchCalls === 2) returns the + // 500-entry remote head, triggering the 501-entry merge that evicts the + // clicked channel without preservedKey. relayClient.fetchEvents = async () => { fetchCalls++; - return fetchCalls === 1 ? [remoteHead] : []; + return fetchCalls === 2 ? [remoteHead] : []; }; relayClient.publishEvent = async (evt) => { publishCalls.push(evt);