Improve Google Calendar task sync reliability#1843
Closed
martin-forge wants to merge 6 commits intocallumalpass:mainfrom
Closed
Improve Google Calendar task sync reliability#1843martin-forge wants to merge 6 commits intocallumalpass:mainfrom
martin-forge wants to merge 6 commits intocallumalpass:mainfrom
Conversation
Contributor
Author
|
Cross-PR compatibility note from auditing the open Google Calendar PRs:
Recommended merge handling: either merge #1802 first and rebase this PR so the queue/index covers exception IDs too, or merge this PR first and rebase #1802 so its exception cleanup routes through the retry-safe delete path. |
This was referenced Apr 30, 2026
Contributor
Author
|
Superseded by #1851, which consolidates the Google Calendar fixes into one ready-to-review PR. |
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.
Maintainer note
Ready to merge. This is the highest-priority active Google Calendar data-integrity fix. It is distinct from #1802, but both PRs touch cleanup paths. If #1802 lands first, this PR should be rebased so the persisted deletion/index recovery also covers #1802's detached exception event IDs. If this lands first, #1802 should be rebased so detached exception cleanup routes through this retry-safe delete path. #1832 and #1844 are independent except for routine rebase conflicts.
Summary
This PR hardens TaskNotes Google Calendar task sync around the failure modes that can orphan, miss, hide, stale, or duplicate calendar events:
scheduled,due, orboth, using the configuredsyncTriggerstatus: cancelled) when syncing an existing event IDThe sync invariant remains simple: tasks belong on Google Calendar based on the existing configured date trigger. This does not add status filtering or completed-task busy/free behavior.
Root Cause
Deleted task files could lose their
googleCalendarEventIdbefore Google cleanup succeeded, especially when Google sync was not connected/ready. Task create/update/reschedule work could also be skipped while Google Calendar was unavailable instead of being replayed later. Google can retain deleted events asstatus: cancelledtombstones that still return from direct event lookup but are hidden from ordinary calendar views, so updating an existing event ID needs to restore it toconfirmed.There were also status and create/update race paths: direct
syncTaskToCalendarcalls for the same unsynced task could both create a Google event before the frontmatter event ID write became visible through metadata; a debounced intermediate status update could run after a later completion update; and a task that was already complete before it became calendar-eligible could be synced through the ordinary create/update path without the completed title marker.Validation
npm test -- tests/services/TaskCalendarSyncService.test.ts tests/unit/issues/issue-google-calendar-delete-retry-queue.test.ts --runInBandnpm run typechecknpm run lint -- --quietnpm run build:testobsidian plugin:reload id=tasknotes vault=test