Repository navigation
wip: preserve DB graph files on CLI reopen - #15
Merged
Merged
Conversation
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.
Scope (WIP)
Preserves the five built-in DB-graph file entities when
@logseq/cliopens an existing graph:logseq/config.edn,logseq/custom.css,logseq/custom.js,logseq/publish.css, andlogseq/publish.js. The initialization transaction now omits files whose:file/pathalready exists. Fresh graphs still receive defaults; a partial graph receives defaults only for missing files. Also uses the platform classpath delimiter so the config template path works on Windows.This is a narrow file-content protection slice for #12, not a full CLI reopen-safety fix. The PR targets
privbecause that is the branch from which the isolated worktree was created. Keep this PR draft; do not merge or close #12 yet.Verified
init-connreopens preserve their:file/contentvalues and an unrelated block.bb dev:run-test-namespaces -n logseq.outliner.cli-issue12-test— 3 tests, 13 assertions, 0 failures/errors.bb dev:run-test-namespaces -n logseq.db.sqlite.create-graph-issue12-test— 1 test, 5 assertions, 0 failures/errors.bb dev:run-test-namespaces -n logseq.api.db-based.cli-test— 6 tests, 17 assertions, 0 failures/errors.git diff --check— clean.Known gap / merge blocker
init-connstill runs the broader initial-data transaction on every open. A disposable-graph probe observed:logseq.kv/local-graph-uuidregenerated and:logseq.kv/graph-created-atreset on reopen. The same transaction reasserts:logseq.kv/schema-versionand:logseq.kv/graph-initial-schema-versionto the compiled version, which is unsafe for older graphs without a migration. These KV fields are outside this file-content slice and are not fixed here. Do not interpret passing file tests as whole-graph reopen idempotence.The tests compare Datascript
:file/contentstrings, not raw SQLite bytes. Export/script caller paths were inspected but not exercised end-to-end in this PR. No existing graph content was recovered or migrated. No user graph was opened for verification.Before ready for review