Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(cli): pass graph export EDN options directly - #13200

Open
hahaArthur17 wants to merge 1 commit into
logseq:masterfrom
hahaArthur17:fix/cli-export-edn-options
Open

fix(cli): pass graph export EDN options directly#13200
hahaArthur17 wants to merge 1 commit into
logseq:masterfrom
hahaArthur17:fix/cli-export-edn-options

Conversation

@hahaArthur17

Copy link
Copy Markdown
Contributor

Summary

  • Pass --edn-options directly to thread-api/export-edn, preserving the worker's top-level option structure.
  • Add the default :export-type :graph only when callers omit :export-type.
  • Update the help text, examples, and CLI documentation to show explicit :graph-options for :graph-human.
  • Add payload-level regression coverage and a real selected-nodes CLI E2E case.

Why

As reported in #13071, the previous export_payload implementation kept :export-type at the top level but wrapped every other key under :graph-options. The worker's build-export function reads :block-id, :page-id, :rows, and :node-ids from the top level, so selected-node exports received nil and could report success while writing an empty :pages-and-blocks result.

This follows the suggested fix from the issue: remove that generic wrapper and forward the EDN options map directly. The CLI still inserts :export-type :graph when it is omitted.

I reproduced the original behavior on the latest master before making the change: the source block was queryable, the export command exited successfully, but the generated EDN contained an empty :pages-and-blocks [].

Verification

  • The new payload regression assertion failed before the production change because top-level :node-ids was missing, then passed after the fix.
  • The new real CLI E2E imports a block with a fixed UUID, exports it through :selected-nodes, and verifies that the output contains the block text.
  • Full non-sync CLI E2E: 91/91 passed.
  • CLI test suite: 237/237 passed in a no-space temporary path.
  • CLI E2E harness unit tests: 83 tests / 317 assertions passed.
  • git diff --check passed.

Compatibility note

:graph-human customization now follows the worker's native contract and must be supplied explicitly under :graph-options, for example:

{:export-type :graph-human :graph-options {:include-timestamps? true}}

The CLI help, examples, and documentation are updated accordingly.

AI assistance

I used AI-assisted tools to help analyze the CLI/worker contract, implement the change, design regression coverage, and run verification. I reviewed the resulting diff and validated the fix with a real CLI export before opening this PR.

Fixes #13071

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: graph export --edn-options nests all keys under :graph-options, silently breaking :block, :page, :view-nodes and :selected-nodes

1 participant