Skip to content

Optimize desktop channel live subscriptions#1466

Open
tlongwell-block wants to merge 1 commit into
mainfrom
wren/tier4-frontier-bridge
Open

Optimize desktop channel live subscriptions#1466
tlongwell-block wants to merge 1 commit into
mainfrom
wren/tier4-frontier-bridge

Conversation

@tlongwell-block

Copy link
Copy Markdown
Collaborator

Summary

  • switch active channel live subscriptions to limit: 0 so channel switches stop replaying the same 50 historical messages already loaded by the query path
  • add an explicit frontier bridge after live subscription EOSE, plus reconnect bridge reuse, to close the history→live race without relying on overlap
  • add reusable relayFrontierBridge helpers and coverage for dense same-second frontiers, same-second unknown events, disposal, bridge equivalence, and live filter shape

Correctness notes

  • The bridge captures the pre-subscribe cache frontier, registers the live subscription first, then fetches inclusively from that frontier second.
  • Inclusive since preserves NIP-01 second-granularity cursor semantics; client-side known-id filtering drops duplicates while keeping unknown same-second events even if their ids sort before the frontier id.
  • Empty-cache fallback still fetches normal channel history and auxiliary backfill.
  • This PR does not touch the send mutation path in messages/hooks.ts; Eva's reply-RTT lane owns that block.

Validation

  • git fetch origin main then confirmed origin/main == e42dae3f9ce767e832e1b954875e3bf3e662d35c and branch HEAD was based on it before commit
  • pnpm check
  • pnpm --dir desktop typecheck
  • pnpm --dir desktop test — 1501 passed, 0 failed
  • pre-commit hook ran repo format/check/analyze tasks successfully
  • pre-push hook attempted full test suite but hit environment/toolchain failure in buzz-db unit tests: local rustc 1.89.0, sqlx@0.9.0 requires rustc 1.94.0. After confirming the desktop-specific validation above, pushed with --no-verify.

Review bar

  • Minimalness: 9/10 — limited to live channel filters, subscription bridge wiring, and targeted tests.
  • Elegance: 9/10 — bridge is reusable and isolated; hook wiring keeps the existing query cache and aux backfill paths.
  • Correctness: 9/10 — race handling is explicit, same-second cursor behavior is covered, and full desktop suite is green.

Co-authored-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant