fix: [BUG] Some notes never exit "modified" status#77
Merged
Conversation
Automated fix generated by Claude Code based on issue analysis. --- 🤖 Generated with Claude Code GitHub Action Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
0ac6698 to
eab4331
Compare
phernandez
pushed a commit
that referenced
this pull request
Apr 6, 2025
Signed-off-by: phernandez <paul@basicmachines.co>
Closed
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.
This PR fixes issue #72
Changes Summary
I fixed Issue #72 where notes with wikilinks stayed in "modified" status after syncing. The problem was that after processing relations in files with wikilinks, the final checksum wasn't being accurately computed and saved, causing false "modified" status on subsequent syncs.
Changes made:
Created a new test file (
tests/sync/test_sync_wikilink_issue.py) that reproduces the issue with notes containing wikilinks staying in modified status.Fixed the
sync_markdown_filemethod insrc/basic_memory/sync/sync_service.py:The fix ensures that after relations between files are established and updated, the final file state is properly captured in the checksum, preventing false "modified" status in subsequent syncs. This issue was particularly noticeable when importing existing notes with wikilinks from other vaults, as mentioned in the bug report.
Original Issue
Bug Description
Some notes never seem to exit "Modified" status, even if sync occurs when file has not been modified.
Steps To Reproduce
Steps to reproduce the behavior:
basic-memory syncorsync --verboseorstatusExpected Behavior
If note hasn't changed, should no longer be listed as modified.
Actual Behavior
Described above. Note that hash value in verbose sync does not change.
Environment
Additional Context
Initially I thought it was to do with the file encoding (line endings being either LF or CR LF) but that didn't seem to matter. I've chased it down to having something to do with a wikilink. If the note is synced with a pre-existing link (ie, the note is pasted or moved into the vault from another vault, regardless of whether the wikilinks point to an existing note or not), it can stay at Modified. If that link is removed, the note is synced, and then sync is run again, it gets removed from the status/sync Modified list. If the wikilink is then returned to the file, it shows up as modified at first sync, then when sync is run again, it disappears.
I tried the remove/re-add links to a template, and the remove/re-add doesn't fix the inclusion in the sync Modified list.
Possible Solution
No clue, sadly. Feels random.
🤖 Generated with Claude Code GitHub Action