Skip to content

Re-enable NoteDoctor to sync notes on startup - #3388

Closed
Usiel wants to merge 1 commit into
trunkfrom
usielriedl/enable-note-doctor
Closed

Re-enable NoteDoctor to sync notes on startup#3388
Usiel wants to merge 1 commit into
trunkfrom
usielriedl/enable-note-doctor

Conversation

@Usiel

@Usiel Usiel commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

NoteDoctor scans for local/ghost discrepancies on idle and queues sync attempts. It was disabled during the 2020 rewrite and never turned back on. Looks to me like it was just forgotten in the already very complex rewrite, but please correct me if I'm wrong @dmsnell. The doctor would be quite useful in combination with #3387.

Fix

Uncommented code and added some automated tests.

Release

Other changes:

  • Re-enable NoteDoctor to sync notes on startup

NoteDoctor scans for local/ghost discrepancies on idle and queues sync
attempts. It was disabled during the 2020 rewrite and never turned back on.
@dmsnell

dmsnell commented Jun 12, 2026

Copy link
Copy Markdown
Member

My memory is weak on this, but my guess is that we turned off the NoteDoctor and left it in just in case the need arose again. After some of the rewrites, the fundamental data-flow issues were resolved and so the problem the doctor solved no longer existed.

Since it adds new concurrency work I would be hesitant to re-enable it without a clear justification so that we can avoid any potential backfiring.

What led you to believe it was necessary again?

@Usiel

Usiel commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for having a look at these PRs!

What led you to believe it was necessary again?

Re-enable NoteDoctor to sync notes on startup

Sorry, I forgot to mention this in the PR body 😅 In detail: When a user has a sync that failed to sync (e.g. 413) and starts up Simplenote, the note won't try to sync again without the NoteDoctor.

This became more obvious with #3387. If you're not convinced of NoteDoctor anymore, I'd suggest just removing the code completely, and we can handle this case in #3387 in a more defensive manner (i.e. no resync, just persist the error state properly across app instances).

@dmsnell

dmsnell commented Jun 15, 2026

Copy link
Copy Markdown
Member

When a user has a sync that failed to sync (e.g. 413) and starts up Simplenote, the note won't try to sync again without the NoteDoctor.

this seems problematic. why does it not try again? it should have a local copy of the note that doesn’t match what’s on the server. is there another bug this is hiding?

@Usiel

Usiel commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

this seems problematic. why does it not try again? it should have a local copy of the note that doesn’t match what’s on the server. is there another bug this is hiding?

Yep, it does have the local copy, and the NoteDoctor fills the gap by checking the ghost state vs the current local state. So not necessarily a bug, there just isn't any specific code to handle this case (besides the NoteDoctor) from what I see.

I had another look into NoteDoctor, reduced its scope further and further (only run once at startup instead of continuously, only resync notes that have no ghost) until it became safe enough for me... but also pretty useless :) I'm not comfortable to introduce this change anymore and will go with the defensive changes directly on #3387.

[...] we can handle this case in #3387 in a more defensive manner (i.e. no resync, just persist the error state properly across app instances).
(#3388 (comment))

@Usiel Usiel closed this Jun 16, 2026
Usiel added a commit that referenced this pull request Jun 16, 2026
#3388 tries to re-enable the NoteDoctor which retries (among other things) failed syncs. After looking into it a bit deeper, I think the risk of the NoteDoctor messing up data is too high.

Without the NoteDoctor we had the following:
- Sync fails due to some error
- User restarts Simplenote
- Note with failed sync showed as pending

NoteDoctor solved this by actually syncing the note again. If it fails again we then show the error.

With this commit we instead just sync the error state, so when the app is reopened the user still sees the error and can then take action.
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