Repository navigation
Description
Search first
- I searched and no similar issues were found
Searched logseq/db-test and logseq/logseq (open and closed) for: property history, status history, import edn history, graph import, logseq.property.history, export edn property history. Related but not the same: #1120 ("enable property history" has no effect), #1389 (selected-block EDN round trip moves a target block), #1385 (partial EDN import and search).
What Happened?
logseq graph import --type edn of a full (:graph) export does not restore property history records (:logseq.property.history/*, the history of a task's status changes). The export file contains them. After the import they do not exist, so the restored graph has no status history. Nothing is reported: the CLI prints "Imported" and exits 0.
The same data round-trips with the :graph-human export, so the two exports disagree.
On a minimal graph with one task whose status changed twice: source graph 2 history records, :graph restore 0, :graph-human restore 2. On two real graphs the restore lost 22 and 39 history records. In those graphs I re-exported the restored graph and compared it with the original export (entity ids replaced by uuids): no other user data was lost.
Reproduce the Bug
Current stable desktop build, CLI only. <id> is the block id printed by the second command.
- Create a graph with a task whose status changes twice:
The query returns
logseq graph create --graph history-src logseq upsert block --graph history-src --target-page Repro --content "task one" logseq upsert block --graph history-src --id <id> --update-properties '{:logseq.property/status :logseq.property/status.todo}' logseq upsert block --graph history-src --id <id> --update-properties '{:logseq.property/status :logseq.property/status.doing}' logseq query --graph history-src --query '[:find (count ?h) . :where [?h :logseq.property.history/block]]'2. - Export it as a full graph and check that the file has the records:
logseq graph export --graph history-src --type edn --file full.edn --edn-options '{:export-type :graph}' --pretty-print grep -c 'logseq.property.history' full.edn10lines: 4 property definitions and 2 records with 3 datoms each (for example[194 :logseq.property.history/block 193]). - Import it into a new graph and count again:
The query prints no count (
logseq graph import --graph history-restored --type edn --input full.edn logseq query --graph history-restored --query '[:find (count ?h) . :where [?h :logseq.property.history/block]]'nullwith--output json): no records. The import printedImported edn from full.ednand the CLI exit code was 0. The block itself keeps its current status (:logseq.property/status.doing). Waiting 10 seconds changes nothing. - For comparison, a human export restores them:
The same query on
logseq graph export --graph history-src --type edn --file human.edn --edn-options '{:export-type :graph-human}' --pretty-print logseq graph import --graph history-human --type edn --input human.ednhistory-humanreturns2.
Expected Behavior
A :graph export restores everything it contains, including property history, as :graph-human does. The source describes :graph as "designed to be simple, reliable and for machines". If dropping history is intended, the import should say so (a warning or a count of skipped records) and not report plain success.
Screenshots
Files
Browser, Desktop or Mobile Platform Information
macOS 26.6.2 (arm64), Desktop app 2.0.2, logseq CLI 533ac43 (built 2026-10-07T14:07:14Z, upstream commit 533ac4382a, "fix(repeat): step Deadline and Scheduled in the local calendar (#13615)"). Reproduced against a CLI-owned worker.
Additional Context
Investigation (build 533ac43; code checked against master 4a5f1a253f, 2026-10-09)
- Confirmed: the full export contains the history records (step 2), and the restored graph has none, immediately and 10 seconds after the import (step 3). They are never created, as opposed to being created and removed later.
- Confirmed: the import code is unchanged on
master.datoms-for-importandbuild-datom-import(deps/db/src/logseq/db/sqlite/export.cljs:1266-1283) are byte-identical in533ac43and4a5f1a253f. - Where the CLI import goes: it calls
:thread-api/import-edn(src/main/frontend/worker/handler/export.cljs:77-90), which buildsbuild-datom-import(retract the current db, then[:db/add e a v]for every datom) and transacts with{::sqlite-export/imported-data? true}. - An upstream test expects this to work:
import-graph-preserves-property-history(deps/db/test/logseq/db/sqlite/export_test.cljs:1200, added withb18056c910, 2026-02-25, "enhance: export-edn exports property history ... also ensure that it is idempotent"). It exports withgraph-export-type, which is:graphunlessLOGSEQ_EXPORT_HUMAN=1, imports, and asserts "Original property history datoms are imported". I did not run it. - Suspected, not confirmed: that test calls
build-exportandbuild-importon an in-memory db, while the CLI import goes through the worker (:thread-api/import-edn, which transacts withldb/transact!and the worker transaction pipeline). So the records are probably lost in the worker's transaction path and not inbuild-import. I did not find the step that discards them: nothing insrc/main/frontend/worker/pipeline.cljsremoves:logseq.property.history/*entities, andvalidate-import-txsonly drops datoms for "disallowed key" errors. I did not run the import under a debugger. - Round-trip method for the real graphs: export, import into a scratch graph, export again, then compare datoms with ids replaced by uuids, ignoring built-in entities, derived
:block/refsand:block.temp/*. Result for both graphs: 0 datoms of user data lost, history records lost 22 and 39. The records are present in the original export file, which matches the live graph.
Are you willing to submit a PR?
- I'm willing to submit a PR (Thank you!)
Activity
yuxi-liu-wired commentedon Oct 27, 2026
Fixed in logseq/logseq#13886 (fix(import): EDN export and import keep pages, history, search and the target block). Its description has the cause and the test that pins it; it fails on current master and passes with the fix.
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export
fix(import): keep property history when importing a graph EDN export