Skip to content

fix(sync): create user page only with its first created-by ref - #14097

Merged
tiensonqin merged 1 commit into
masterfrom
devin/1795396697-created-by-user-page
Nov 23, 2026
Merged

tiensonqin merged 1 commit into
masterfrom
devin/1795396697-created-by-user-page

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #14096: a graph member's first new block was rejected by db-sync with Nothing found for entity id [:block/uuid <member user uuid>].

add-created-by-ref-hook added the user page (gen-created-by-block) to any pipeline tx while the page was missing locally, even when the tx referenced it nowhere. During download, set-graph-sync-metadata! transacts kv entries with {:persist-op? false}, so the member's user page was created in a tx that is never uploaded. Later local txs found the page via d/entity, emitted only [:db/add e :logseq.property/created-by-ref id], and the server rejected them.

(cond->> add-created-by-tx-data
-  (nil? created-by-ent) (cons created-by-block))
+  (and (nil? created-by-ent) (seq add-created-by-tx-data))
+  (cons created-by-block))

Now the user page is created in the same (uploaded) tx as its first created-by-ref.

The issue's other suggestion (adding :sync-download-graph? to rtc-tx-or-download-graph?) is not needed: transact-pipeline already skips compute-extra-tx-data for :sync-download-graph? txs via derive-extra-data?, so the hook never runs on the snapshot import itself.

Graphs where the page was already created locally-only need a fresh download; after this fix the download no longer creates it.

Tests

  • Added frontend.worker.pipeline-test/user-page-is-created-only-by-a-tx-that-references-it-test: fails on master (page created by a :persist-op? false kv tx; first block tx lacks the page datoms), passes with the fix.
  • frontend.worker.pipeline-test, db-sync-test, sync.download-test, node-sync-test, reaction tests: 0 failures. clj-kondo clean.
  • Not verified end-to-end against a db-sync server with two accounts.

Link to Devin session: https://app.devin.ai/sessions/962ef90b853a4956a13511492839ecde
Open in Devin Desktop: https://app.devin.ai/desktop/session/962ef90b853a4956a13511492839ecde?variant=devin
Requested by: @tiensonqin


🟢 Devin Review found nothing to fix · View findings

Devin Review

Non-uploaded transactions such as the graph-sync metadata write during download created the member's user page locally, so later uploads referenced a page the server never received. Fixes #14096.
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@tiensonqin
tiensonqin merged commit f6ce0e0 into master Nov 23, 2026
19 of 20 checks passed
@tiensonqin
tiensonqin deleted the devin/1795396697-created-by-user-page branch November 23, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant