Skip to content

fix(import): handle missing block embeds - #12887

Merged
tiensonqin merged 3 commits into
masterfrom
fix/og-import-missing-embeds
Jul 15, 2026
Merged

tiensonqin merged 3 commits into
masterfrom
fix/og-import-missing-embeds

Conversation

@megayu

@megayu megayu commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

logseq/db-test#927

This fixes a file graph import failure where db-worker-node can reject an import transaction with :entity-id/missing.

The failure was diagnosed from logs showing transactions containing blocks like:

{:block/title ""
 :block/link [:block/uuid ...]}

followed by:

Nothing found for entity id [:block/uuid ...]

That shape is produced by block embeds such as {{embed ((uuid))}}. Before this change, the importer created placeholder/index entries for normal :block/refs targets, but not for :block/link targets. If the worker received a :block/link pointing to a missing UUID, the transaction could fail and the import flow could continue processing later files, leaving a partially imported graph.

This change:

  • Includes :block/link UUID targets in the import block index, matching existing :block/refs handling.
  • Cleans up missing block embed placeholders by retracting dangling ``:block/link` values during missing-ref cleanup.
  • Propagates export/import file failures instead of swallowing them after notification.
  • Waits for each worker transaction report during file graph import before continuing, so worker failures stop the import instead of letting the UI proceed with a diverged state.

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.

Pull request overview

This PR fixes file-graph import failures caused by block embeds ({{embed ((uuid))}}) that produce :block/link lookup refs to missing block UUIDs, which could previously cause db-worker-node to reject a transaction and leave the graph partially imported. It also tightens failure propagation and sequencing so worker/import failures stop the import flow rather than letting the UI continue.

Changes:

  • Include :block/link UUID targets in the import block index (matching existing :block/refs handling) and retract dangling :block/link values during missing-ref cleanup.
  • Propagate export/import failures by rethrowing after user notification, rather than swallowing errors and continuing.
  • Ensure file-graph import waits for each on-tx-report completion before proceeding to the next report.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/main/frontend/components/imports.cljs Await on-tx-report sequentially to prevent UI from continuing after worker transact failures.
deps/graph-parser/src/logseq/graph_parser/exporter.cljs Index :block/link UUID targets; retract missing embed links; rethrow on import/export errors so failures abort.
deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs Extend import cleanup coverage for missing embeds and add a failure-propagation test for aborting on export-file failure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@megayu
megayu force-pushed the fix/og-import-missing-embeds branch from ab14006 to 1c9b28b Compare July 9, 2026 07:59
@megayu
megayu requested a review from tiensonqin July 9, 2026 08:00
@tiensonqin
tiensonqin merged commit 86c4784 into master Jul 15, 2026
18 checks passed
@tiensonqin
tiensonqin deleted the fix/og-import-missing-embeds branch July 15, 2026 14:05
@tiensonqin tiensonqin mentioned this pull request Aug 31, 2026
1 of 2 tasks
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 1, 2026
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants