Files
buzz/desktop/src
Duncan cd0eedd13a refactor(sidebar-sync): single-call readOutboxWithMeta recovers preservedKey from foreign records; add P3 reconnect+restart hook regressions
Thufir pass-2 findings — all four corrections applied:

1. P3 restart durability: replace two-function readOutbox+readOutboxPreservedKey
   with readOutboxWithMeta<S> that enumerates records once and returns
   { store, preservedKey }. Key selected by max queuedAt across ALL records (own
   and foreign); after quit, the prior window's nonce is gone so its record is
   foreign — the old isOwn filter returned undefined, losing the reservation.
   Both hooks forward outboxMeta.preservedKey directly to publish* on bootstrap.

2. Two-read snapshot/provenance split closed: the capacity bound now applies
   inside readOutboxWithMeta using the selected preservedKey, so the clicked
   channel is never evicted before it reaches the manager.

3. discardPending() clears pendingPreservedKey: minor correctness fix so a
   confirmed publish resets the field alongside pendingStore and clearOutbox.

4. Test consolidation: remove non-causal reconnect/remount tests from
   channelStarsSync.test.mjs (+120) and channelMutesSync.test.mjs (+192).
   Replace with two parameterized regressions in mergeLaneHook.shared.test.mjs:
   - P3 reconnect: triggers the actual subscribeToReconnects callback registered
     by the hook, asserts clicked channel survives 501-entry merge.
     Failing mutation: revert hook reconnect to publish*(pending).
   - P3 restart: seeds a foreign-nonce outbox envelope with preservedKey,
     mounts hook (bootstrap reads foreign record → recovers key → publishes),
     fires 2s debounce, asserts clicked channel survives 501-entry merge.
     Failing mutation: revert to readOutboxPreservedKey (isOwn filter) or drop
     bootstrap preservedKey forward.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-09-02 15:01:01 -04:00
..
2026-03-09 13:02:11 -07:00