Skip to content

fix(wiki): preserve import frontmatter#943

Merged
perber merged 7 commits intomainfrom
fix/import-frontmatter-revisions
May 1, 2026
Merged

fix(wiki): preserve import frontmatter#943
perber merged 7 commits intomainfrom
fix/import-frontmatter-revisions

Conversation

@perber
Copy link
Copy Markdown
Owner

@perber perber commented Apr 27, 2026

Treat UI content that looks like frontmatter as plain body text while keeping importer updates on the frontmatter-preserving path.

Also initialize baseline revisions for existing pages when revisions are enabled so revision history starts from the current state.

Treat UI content that looks like frontmatter as plain body text while keeping importer updates on the frontmatter-preserving path.

Also initialize baseline revisions for existing pages when revisions are enabled so revision history starts from the current state.
Copilot AI review requested due to automatic review settings April 27, 2026 16:35
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 adjusts wiki content handling so that UI-authored markdown that resembles YAML frontmatter is stored verbatim as body text, while importer-driven updates still preserve/merge frontmatter. It also adds baseline revision initialization so revision history begins from the current state when revisions are enabled.

Changes:

  • Split content upsert behavior into UI (treat as plain body) vs importer (preserve/merge frontmatter) paths.
  • Thread an FromImport flag through the update use case down to TreeService.UpdateNode.
  • Initialize baseline content revisions for existing pages when revisions are enabled, and update tests to reflect the new frontmatter behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/wiki/wiki.go Calls baseline revision creation on startup when revisions are enabled.
internal/wiki/pages/update_page.go Adds FromImport flag to route importer vs UI behavior.
internal/wiki/pages/copy_page.go Updates UpdateNode call signature with new fromImport arg.
internal/wiki/import_adapter.go Sets FromImport: true for importer updates.
internal/core/tree/tree_service.go Adds fromImport parameter and routes content writes to the correct NodeStore method.
internal/core/tree/node_store.go Makes UpsertContent treat input as plain body; adds UpsertContentPreservingFrontmatter for importer behavior.
internal/core/tree/node_store_test.go Adds/updates tests to validate UI vs importer frontmatter handling.
internal/core/tree/tree_service_test.go Updates tests to reflect that “frontmatter-like” UI content is no longer parsed/validated as YAML.
internal/links/link_service_test.go Updates UpdateNode calls for the new signature.
internal/core/revision/service.go Updates UpdateNode calls for the new signature during restore/rollback.
internal/core/revision/service_test.go Updates UpdateNode calls for the new signature.

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

Comment thread internal/wiki/wiki.go Outdated
Comment thread internal/wiki/wiki.go
Comment thread internal/core/tree/tree_service_test.go
perber and others added 3 commits April 27, 2026 18:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Use bulk page and link lookups during refactor apply to reduce repeated work.

Also add a benchmark make target to make these paths easier to measure.
Align the test name with the behavior it now verifies after frontmatter-like UI content stopped failing parsing.
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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.


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

Comment thread internal/links/links_store.go Outdated
Comment thread internal/links/link_service.go
Comment thread internal/core/tree/tree_service.go
Comment thread internal/core/tree/tree_service_test.go
Comment thread internal/wiki/wiki.go Outdated
perber added 3 commits May 1, 2026 16:20
Batch outgoing link lookups to avoid SQLite parameter limits during large refactors and reindex operations.

Handle page enumeration and page load errors when creating baseline revisions so unreadable pages are skipped instead of silently weakening startup reliability.
Skip the editor navigation blocker when the latest store state is already clean after saving.

Use a ref-based one-shot bypass to avoid React set-state-in-effect lint errors while keeping the rename/history close flow stable.
@perber perber merged commit d8b8540 into main May 1, 2026
5 checks passed
@perber perber deleted the fix/import-frontmatter-revisions branch May 1, 2026 15:13
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