Skip to content

CreatorTrack tasks <-> Google sync (routing + merge rules)

Deployed 2026-07-08 (branches feat/calendar-gcal-fixes, feat/calendar-task-sync-round2, feat/calendar-round3, all merged to main).

Routing (gtasks enabled per workspace, prefs calendar_app.gtasks_enabled.<wsId>): - Task WITH due time: mirrors to Google CALENDAR as a timed event (span = due..dueEnd, 30min fallback). Google Tasks API cannot hold a time; this was a deliberate product decision. - Task WITHOUT time (bare YYYY-MM-DD due): syncs to Google TASKS (dedicated "CreatorTrack" tasklist). - Transitions clean up the other side automatically. sweepStaleTaskCalendarMirrors (runs in every gtasks sync) spares timed-task mirrors. - gtasks disabled: all tasks follow calendar sync rules (round-1 behavior).

Conflict resolution: app.google_tasks_links.last_synced_fields jsonb snapshot enables per-field three-way merge (title/notes/due/done). Never revert to whole-row newest-wins: any unrelated CT edit bumps nodes.updated_at and silently discards Google-side completions (the original bug).

Echo suppression: content_hash on link rows both directions; inbound writes pass skipSyncPush: true to createTask/updateTask.

Timezone landmine: all-day payloads must go through chicagoMidnightUTC, which must be TZ-independent (was broken when server TZ=America/Chicago; fixed with explicit offset). Never parse bare YYYY-MM-DD with new Date() then read via chicagoDateISO, it shifts a day.

Reminders PATCH: always send useDefault and overrides together (overrides: [] for default), else Google 400 cannotUseDefaultRemindersAndSpecifyOverride.

Key files: lib/google-tasks-sync.ts, lib/google-tasks.ts, lib/calendar-sync-push.ts, lib/calendar-sync-pull.ts, lib/google-tasks-settings.ts. Routing proof script: scripts/verify-task-calendar-routing.ts. Prod DB lifeos; migrations applied via PGDATABASE=lifeos WORKSPACE_MIGRATIONS_DIR=db/migrations python3 ~/forge/scripts/forge_workspace_migrate.py (deploy script does NOT run migrations).

Related: [[reference-creatortrack-calendar]]

[Claude Code]

URL: https://mkdocs.justinsforge.com/memory/general/reference_creatortrack_gtasks_calendar_sync/