fix(rtc): do not mark sync idle when checksums diverge by tiensonqin · Pull Request #13169 · logseq/logseq · GitHub
Skip to content

fix(rtc): do not mark sync idle when checksums diverge - #13169

Open
tiensonqin wants to merge 1 commit into
masterfrom
logseq/rtc-indicator-checksum-idle-1150
Open

fix(rtc): do not mark sync idle when checksums diverge#13169
tiensonqin wants to merge 1 commit into
masterfrom
logseq/rtc-indicator-checksum-idle-1150

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1147.

The RTC cloud indicator treated an open websocket with zero pending local/asset/server ops as idle (green), even when local-checksum and remote-checksum were both present and different. Clients could therefore show sync complete while journal content still diverged.

Behavior

  • Idle/green requires matching checksums when both are present.
  • Missing checksums stay unknown (not treated as a match or a mismatch).
  • When checksums diverge, the indicator uses a non-idle diverged warning state (red) instead of green idle.
  • The details popup always shows a checksum-mismatch warning plus the local and remote checksums (not only in dev/node-test).
  • Pending local/asset/server counts still take precedence for queuing/syncing.

Tests

bb dev:test -v frontend.components.rtc.indicator-test — 12 tests, 41 assertions, 0 failures.

Also green: clj-kondo on the changed indicator files, bb lang:validate-translations, and bb lang:lint-hardcoded --git-changed.

Open in Web Open in Cursor 

The RTC indicator treated an open websocket with zero pending ops as
idle/green even when local and remote checksums differed. Require matching
checksums for idle, show a warning state and details when they diverge.

Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
Copilot AI lite review requested due to automatic review settings September 4, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change aligns with the stated behavior, adds targeted test coverage, and includes required i18n updates for the new user-facing strings.

Pull request overview

This PR fixes the RTC cloud sync indicator so it no longer shows an idle/green state when local and remote checksums are both present but differ, and surfaces a checksum mismatch warning (with the actual checksums) in the details popup.

Changes:

  • Add checksum divergence detection and incorporate it into the indicator state/class computation (idle is suppressed when checksums diverge).
  • Show a checksum-mismatch warning plus local/remote checksum values in the sync details popup whenever divergence is detected.
  • Add CSS styling for the new diverged state and add unit tests covering match/mismatch/unknown checksum cases and pending-count precedence.
File summaries
File Description
src/main/frontend/components/rtc/indicator.cljs Adds checksum divergence logic, updates indicator class computation, and renders mismatch warning + checksum values in the details popup.
src/main/frontend/components/file_sync.css Styles the diverged indicator state using the existing file-sync error color token.
src/test/frontend/components/rtc/indicator_test.cljs Adds focused tests for checksum divergence behavior and its interaction with pending ops.
src/resources/dicts/en.edn Adds new i18n keys for checksum mismatch warning and checksum labels.
src/resources/dicts/zh-cn.edn Adds the corresponding zh-CN translations for the new checksum-related i18n keys.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Sync finished with diverged state

3 participants