Skip to content

fix: preserve import frontmatter#808

Merged
perber merged 2 commits intomainfrom
fix/import-frontmatter-preservation
Mar 27, 2026
Merged

fix: preserve import frontmatter#808
perber merged 2 commits intomainfrom
fix/import-frontmatter-preservation

Conversation

@perber
Copy link
Copy Markdown
Owner

@perber perber commented Mar 27, 2026

Keep non-managed frontmatter fields during import while preserving LeafWiki-managed metadata on write.

Add regression coverage for planner title precedence, importer execution, disk persistence, and node store merging of raw markdown with frontmatter.

Keep non-managed frontmatter fields during import while preserving LeafWiki-managed metadata on write.

Add regression coverage for planner title precedence, importer execution, disk persistence, and node store merging of raw markdown with frontmatter.
Copilot AI review requested due to automatic review settings March 27, 2026 15:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the markdown import pipeline to preserve non-LeafWiki frontmatter fields (e.g., title, aliases, custom keys) while ensuring LeafWiki-managed metadata is still controlled on write, and adds regression tests around title precedence and persistence.

Changes:

  • Preserve non-managed frontmatter during import execution instead of stripping all frontmatter.
  • Update NodeStore.UpsertContent to accept raw markdown (with optional frontmatter) while keeping LeafWiki-managed fields authoritative.
  • Add regression coverage for planner title precedence, executor/importer behavior, and disk persistence of preserved frontmatter.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/importer/planner_test.go Adds regression test ensuring leafwiki_title takes precedence over title.
internal/importer/importer_service_test.go Updates/extends importer service tests to verify preserved frontmatter and disk persistence.
internal/importer/executor_test.go Updates executor tests to assert preserved non-internal frontmatter behavior.
internal/importer/executor.go Implements frontmatter-preserving import content construction.
internal/core/tree/node_store_test.go Adds test validating raw frontmatter extras are merged while managed fields are enforced.
internal/core/tree/node_store.go Switches UpsertContent to parse raw content and preserve extras while syncing managed frontmatter.
internal/core/markdown/markdown.go Adds helper to set raw markdown while preserving managed frontmatter and replacing extras.

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

Use shared markdown frontmatter serialization for importer extra fields and add regression coverage for distinct preserved values.

This removes duplicated YAML encoding logic and avoids behavior drift between importer and markdown write paths.
@perber perber merged commit a0afe68 into main Mar 27, 2026
6 of 7 checks passed
@perber perber deleted the fix/import-frontmatter-preservation branch March 27, 2026 15:54
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.

2 participants