Harden partial EDN imports - #12929
Open
megayu wants to merge 10 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the “Import EDN Data” flow by rejecting unsupported EDN shapes (including full-graph exports), requiring a valid editor target for block imports, preventing concurrent submissions, and preserving existing page identity/metadata when importing partial EDN into an existing graph.
Changes:
- Add preflight classification for Import EDN Data (full-graph vs partial vs unsupported) and improve UI flow safety (target preservation, duplicate-submit blocking).
- Extend sqlite import/build/validation to better preserve existing page attributes (UUID/title/name/journal fields, properties, tags, aliases) and to tighten EDN validation behavior for this import path.
- Add/extend test coverage for the hardened import behavior and new validation rules; add new i18n keys for the new notifications.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/test/frontend/handler/db_based/import_test.cljs |
Adds CLJS UI-level tests for Import EDN Data preflight, editor-target handling, and duplicate-submit blocking. |
src/resources/dicts/zh-cn.edn |
Adds new Simplified Chinese i18n strings for hardened Import EDN Data messages. |
src/resources/dicts/en.edn |
Adds new English i18n strings for hardened Import EDN Data messages. |
src/main/frontend/modules/shortcut/config.cljs |
Preserves editor context when invoking search via shortcut so downstream commands can reuse the editing target. |
src/main/frontend/handler/events/ui.cljs |
Extends :go/search event handling to accept/update :search/args editor context. |
src/main/frontend/handler/db_based/import.cljs |
Hardens Import EDN Data dialog handling (shape checks, editor target enforcement, submitting lockout, scoped dialog closing). |
src/main/frontend/components/header.cljs |
Captures editor context before pointer focus changes so search-from-header can preserve the editing target. |
src/main/frontend/components/cmdk/core.cljs |
Switches to util/stop for consistent preventDefault+stopPropagation behavior. |
deps/outliner/src/logseq/outliner/op.cljs |
Threads :import-edn-data? into validation so Import EDN Data can use stricter validation behavior. |
deps/db/test/logseq/db/sqlite/export_test.cljs |
Adds unit tests for Import EDN Data validation/shape constraints and metadata preservation/merge behavior. |
deps/db/src/logseq/db/sqlite/export.cljs |
Implements Import EDN Data shape detection, rejects unsupported export metadata, preserves existing-page attributes, and tightens validation reporting. |
deps/db/src/logseq/db/sqlite/build.cljs |
Ensures existing-page updates aren’t treated as “minimal” when alias-merge metadata requires additional txs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
megayu
force-pushed
the
fix/import-edn-data-hardening
branch
from
July 21, 2026 06:45
8e8b8fc to
4d0652e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix logseq/db-test#1004 , logseq/db-test#994