DB Sync: server rejects valid local order repair; same-identity restoration fails with UUID uniqueness conflict

Đang mở
#1,518 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
12/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
clojure, macos, sqlite

Hướng nghiên cứu

The rejection path is in src/main/frontend/worker/sync/handle_message.cljs, specifically handle-tx-reject!, which drops :error-detail from recorded status. The server-side UUID uniqueness conflict and index state are not in this repository and need a maintainer replay against the deployed revision. Done would mean the raw server error is retained and the same-entity UUID conflict is reproduced or ruled out; this is not a newcomer task.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Search first
  • Searched logseq/db-test, logseq/logseq, and the Logseq Forum for validation failures, sync rejections, and UUID uniqueness conflicts.

Related: #1515 covers client repair-loop amplification. Historical #711 and logseq/logseq#12473 discuss missing-identity validation failures during remote apply/rebase. Neither establishes the same-identity server conflict captured here; #12473 was closed without merging after a rebase redesign. No exact duplicate was identified in these searches.

What Happened?

A duplicate-order repair passes the installed client's local transaction validation but is rejected by the deployed DB Sync server. Attempting to restore the affected block's full identity/content is also rejected, with a UUID uniqueness conflict involving the same entity ID and UUID at different transaction ordinals.

This report concerns the observed server rejection and failed identity restoration, separately from the client rejection/regeneration loop in #1515. The original event/code path that created the affected state is not established.

Captured server response (sanitized excerpt):

:type "tx/reject"
:reason "db transact failed"
:error-detail contains:
  "DB write failed with invalid data"
  :entity-map {:block/order "b5wV", :db/id E, :block/properties ()}
  :errors [["invalid dispatch value"]]

The server's diagnostic describes an order-only entity, missing block identity/content. E is a symbolic replacement, not a real entity ID.

Reproduce the Bug

Scope: the following affected-state sequence was exercised. There is no demonstrated fresh-graph/UI recipe for creating the original server condition. A maintainer replay needs the affected server's pre-apply state. Use isolated copies/test infrastructure, not a production graph.

  1. Preserve a matched client graph and operation queue containing the automatic two-sibling order repair. Both targets have complete local block identities. Its normalized forward payload is four datoms:

    [A :block/order "b5w"  T false]
    [A :block/order "b5wV" T true]
    [B :block/order "b5w"  T false]
    [B :block/order "b5x"  T true]
    

    A, B, and T are symbolic placeholders. These are transaction-report datoms, not an import script.

  2. Replay the exact captured repair on an isolated copy through the installed thread-api/transact / ldb/transact! path with validation active. Observed: accepted locally; repeating the repair on the repaired state changes zero datoms.

  3. Submit that pending repair to the affected deployed server in a bounded attempt. Capture the raw rejection at client handler entry, before detail is discarded. Observed: the order-only validation error above. Uploads were paused before normal rejection processing to prevent another storm.

  4. In a separate bounded diagnostic attempt, submit the existing target's complete identity/content and structural attributes. Observed:

    Cannot add #datascript/Datom [E :block/uuid U T_incoming true]
    because of unique constraint:
    (#datascript/Datom [E :block/uuid U T_conflicting true])
    

    This is a sanitized excerpt: E and U are identical in both datoms; T_incoming and T_conflicting differ. Explicitly retracting and reasserting the UUID also failed. These diagnostic attempts are not a recommended recovery procedure.

  5. Create a new sibling with a fresh UUID, identical text, and the same parent/page using the native CLI. Observed: upload accepted before removing the old local block. The distinct pending operations were also accepted during recovery.

Expected Behavior

Valid edits should apply consistently to the server's entity/identity state. Reasserting an existing identity should not encounter this same-entity UUID conflict; if reconciliation is required, provide an actionable, content-preserving recovery path and retain the detailed server error.

Screenshots

Not a UI issue. Sanitized payload/error structure is included above.

Files

No private graph, SQLite queue, raw logs, or screenshots attached. All graph/account names, original UUIDs, entity IDs, transaction ordinals, note text, local paths, and credentials are omitted. Matched backups and raw diagnostic evidence were retained privately.

Browser, Desktop or Mobile Platform Information
  • macOS desktop, Apple Silicon arm64; Darwin 25.6.0.
  • Logseq 2.0.1, installed revision 5a23230a56-dirty; database graph using DB Sync.
  • Deployed server revision/schema and pre-apply index state are unavailable. Latest-upstream equivalence has not been established.
Additional Context
  • Two separate malformed local entities were cleaned with content/children preserved. They were not the repair targets; local validation became clean without resolving the server rejection.
  • After targeted recovery: local validation had zero errors; all three distinct pending operations and the fresh-UUID block were accepted; pending local/server/assets were zero, connection open, last error null. Original queue backups and failed repairs were retained rather than clearing user operations.
  • Recomputed local and remote checksums still differ. Queue drainage proves working operation processing, not full replica consistency.
  • The deployed response contained :error-detail, but the installed handle-tx-reject! does not retain it in recorded rejection status.
  • Hypothesis, not proven cause: inconsistent server entity/UUID index or snapshot state. Please inspect the target's pre-apply EAVT/AVET/UUID-unique state and replay the repair on the deployed revision to identify the first inconsistent transition. The observed errors alone do not identify that transition or prove a specific index defect.
Are you willing to submit a PR? If you know how to fix the bug.
  • I'm willing to submit a PR (Thank you!)
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
29
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của logseq/db-test

Tất cả issue của logseq/db-test

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.