Draft
Conversation
…model callbacks, and UI toggle Co-authored-by: apdarr <3004606+apdarr@users.noreply.github.com>
…xisting failures unchanged Co-authored-by: apdarr <3004606+apdarr@users.noreply.github.com>
…e UTC timezone for calendar Co-authored-by: apdarr <3004606+apdarr@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Exploratory integration with Google Calendar API
Exploratory Google Calendar API integration
Mar 6, 2026
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.
Adds foundational plumbing for syncing training plan workouts to Google Calendar. Follows the existing Strava integration patterns: service object → background jobs → model callbacks.
Data model
users.google_calendar_id— persistent calendar ID per userplans.calendar_sync_enabled— per-plan sync toggleactivities.google_calendar_event_id— tracks synced eventsGoogleCalendarServiceHandles all Calendar API interactions via
google-apis-calendar_v3: find/create a dedicated "Lace Training" calendar, CRUD events as all-day entries, and refresh Google OAuth tokens via Signet.Background jobs
SyncPlanToCalendarJob— bulk sync on enableRemovePlanCalendarEventsJob— bulk remove on disableUpdateCalendarEventJob— triggered by activityafter_updateDeleteCalendarEventJob— triggered by activitybefore_destroyModel callbacks
after_updateenqueues sync/remove whencalendar_sync_enabledchangesafter_updateenqueues event update on distance/description/date change;before_destroyenqueues event deletionOAuth scope
Google OAuth now requests
https://www.googleapis.com/auth/calendarwithaccess_type: "offline".UI
Toggle button on plan show page, visible only when user has a connected Google account.
Notes
User#has_google_access_token?uses parameterized raw SQL to check token presence without triggering ActiveRecord encryption decryption — works around a pre-existing issue where test env lacks encryption credentials.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.