Skip to content

Desktop, Mobile: Fixes #12104: Ensure merges to revisions during cleaning are synced to the target #12444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

mrjo118
Copy link
Contributor

@mrjo118 mrjo118 commented Jun 10, 2025

In PR #11035 the revision cleaning process was changed to ensure revision deletions were synced upstream to the sync target. Unfortunately this PR was missing a change to ensure that the update to the surviving revision would be synced upstream as well. This would result in revisions being broken on other Joplin clients, when at least one revision for a note containing revisions has been cleaned. This PR addresses this issue.

This fixes #12104

Testing:
I have tested the change using a backup of the sync target for my own Joplin profile, using a note which has revisions spread across 2 days. Using this backup with file system sync on Android emulator, I forced cleaning of the oldest of the revisions by setting a value of 3 days for the note history expiry. Then I synced the change and pulled the file system sync directory onto my pc, and then synced this directory to a new profile on Joplin desktop. I then confirmed that the merged revision was correctly synced, and the remaining revisions correctly displays a preview of the contents.

@mrjo118 mrjo118 changed the title Desktop, Mobile: Fixes #12104: Ensure merges to revisions during cleaning sync to the target Desktop, Mobile: Fixes #12104: Ensure merges to revisions during cleaning are synced to the target Jun 10, 2025
@laurent22
Copy link
Owner

Any chance test units could be added for this? It's scary that no tests failed when the previous change was committed.

@mrjo118
Copy link
Contributor Author

mrjo118 commented Jun 10, 2025

Any chance test units could be added for this? It's scary that no tests failed when the previous change was committed.

What should it test? Just that the updated_time is updated on the revisions record?

@laurent22
Copy link
Owner

If you look at Synchronizer.revisions.test.ts it's doing something close to integration tests with simulation of sync between clients. It's something like this we would need

@mrjo118
Copy link
Contributor Author

mrjo118 commented Jun 16, 2025

If you look at Synchronizer.revisions.test.ts it's doing something close to integration tests with simulation of sync between clients. It's something like this we would need

@laurent22 I've now added a test for this and verified that it fails without this change. I've also written the test in a way that it is compatible with my changes in PR #12487

@@ -230,4 +230,57 @@ describe('Synchronizer.revisions', () => {

jest.useRealTimers();
});

it('should delete old revisions and sync updated revisions remotely, when revision deletion retains some revisions locally', async () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read this three times and still not sure what it means or why these concepts are part of the same sentence or how they relate to each others.

I don't assume it's possible to split this into several tests?

Or maybe add a comment to explain what it does? Look at the other tests in this file, some have detailed examples in comment to explain the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a detailed comment similar to others in the class. Hopefully that is clear enough

@mrjo118 mrjo118 requested a review from laurent22 June 30, 2025 17: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.

For some notes, note history is available but all entries show blank contents in the UI
2 participants