Fix Google Calendar sync race condition and recurring completion date bug#1764
Open
martin-forge wants to merge 6 commits intocallumalpass:mainfrom
Open
Fix Google Calendar sync race condition and recurring completion date bug#1764martin-forge wants to merge 6 commits intocallumalpass:mainfrom
martin-forge wants to merge 6 commits intocallumalpass:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d date (callumalpass#396) toggleRecurringTaskComplete and toggleRecurringTaskSkipped now default to the task's scheduled occurrence date for scheduled-anchor recurring tasks when no explicit date is passed, instead of unconditionally using today.
…ass#396) The plugin-level toggleRecurringTaskComplete wrapper independently derived the completion date from getTodayLocal(), diverging from the TaskService fix. Now uses the same scheduled-anchor resolution. Also replaced pseudo-test with a behavioural test that exercises the real TaskService.toggleRecurringTaskComplete method with mocked dependencies.
…sts (callumalpass#396) The main.ts wrapper was resolving the notice date from the caller's potentially stale task object. Now reads from cacheManager before the service call, matching the authoritative source the service uses. Added behavioural regression tests for toggleRecurringTaskSkipped to match the existing completion path coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
The only failing check here is the known repo-wide I re-ran the targeted tests for the changes in this PR, plus If branch protection allows, I believe this PR is ready to merge as-is. If helpful, I’m also happy to put together a separate PR for the CI issue rather than fold that into this change. |
3 tasks
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.
Summary
Two independent Google Calendar sync reliability fixes:
Debounce stale metadata cache:
TaskCalendarSyncService.updateTaskInCalendardiscarded the explicit task payload during the 500ms debounce and re-fetched fromcacheManager.getTaskInfo, which often returned stale data because Obsidian's metadata cache hadn't finished indexing. Fixed by caching the authoritative task payload in apendingTasksMap during the debounce window.Recurring completion records wrong occurrence:
toggleRecurringTaskCompleteandtoggleRecurringTaskSkippeddefaulted togetTodayLocal()when no explicit date was passed, even for scheduled-anchor recurring tasks. Completing a task late (e.g. Saturday's task on Sunday) recorded Sunday incomplete_instances— butcomplete_instancesis an occurrence index, not a completion timestamp, so this left Saturday's occurrence open and sent the wrongEXDATEto Google Calendar. Fixed by defaulting totask.scheduledfor scheduled-anchor tasks, so the correct occurrence is marked as done.Issue linkage
Test plan
npx jest tests/services/TaskCalendarSyncService.test.ts— debounce uses explicit payload, not stale cachenpx jest tests/unit/issues/issue-396-recurring-late-completion-wrong-date.test.ts— scheduled-anchor defaults to scheduled date; completion-anchor still defaults to today; undefined anchor defaults to schedulednpx tsc --noEmit— clean typechecknpm run build— clean buildCI note
The
test (20)check fails onCould not locate module tasknotes-nlp-core— this is a pre-existing repo-wide CI issue that is also affecting other PRs (for example #1677), and it was not introduced by these changes.