Merged
Conversation
Store historical custom frontmatter in revisions so frontmatter-only changes create history entries and restore can rebuild custom fields without changing managed metadata ownership.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the revision system to persist and restore custom (non-managed) frontmatter so that frontmatter-only edits produce revision history and restores can rehydrate those custom fields while keeping LeafWiki-managed metadata owned by the live page state.
Changes:
- Add
TreeService.ReadPageRaw()to read markdown including frontmatter. - Extend
RevisionState/Revisionto storeExtraFrontmatter+ExtraFrontmatterHash, and include the hash in “did content change?” detection. - Update revision restore to rebuild markdown with historical extra frontmatter, plus add tests for capture/restore and legacy/backward-compat behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/core/tree/tree_service.go | Adds ReadPageRaw() API for retrieving raw markdown (incl. frontmatter). |
| internal/core/revision/types.go | Adds extra frontmatter fields/hashes to revision types for persistence/JSON. |
| internal/core/revision/service.go | Captures extra frontmatter into revisions, compares hashes for history creation, and rebuilds markdown on restore. |
| internal/core/revision/service_test.go | Adds coverage for capturing/restoring custom frontmatter and legacy revision behavior. |
| internal/core/revision/fs_store_test.go | Adds backward-compat test for decoding legacy revision JSON without the new fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use the importer write path only when a revision actually carries custom frontmatter so legacy body-only restores keep YAML-looking content as plain body text.
perber
added a commit
that referenced
this pull request
May 3, 2026
Store historical custom frontmatter in revisions so frontmatter-only changes create history entries and restore can rebuild custom fields without changing managed metadata ownership.
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.
Store historical custom frontmatter in revisions so frontmatter-only changes create history entries and restore can rebuild custom fields without changing managed metadata ownership.