feat(integrations)!: remove Google Calendar triggers, keep Gmail

Merged
SA
2mo ago
+216-2863

Summary

  • Removes the Google Calendar trigger integration end to end: push/scheduled routes, the sync (sync tokens, watch channels, recurring-instance expansion), fire scheduling and its sweep job, the calendar tRPC client, the desktop provider and grammar, the shared trigger schema and matcher, and the calendar.readonly OAuth scope.
  • Keeps the Google connector for Gmail: OAuth, connection state, the mailbox watch and its daily renewal, and the message.received trigger.
  • 50 files, +216 / −2,863.

Why / Context

Measured on production on 2026-09-24: zero calendar triggers have ever been created (including on since-deleted automations) and zero runs, while all 28 Google connections watched their calendars and produced ~21,600 automation_events rows a day that nothing consumed — plus Google push traffic, channel renewals and a 15-minute scheduling sweep.

The one thing the trigger did that a schedule cannot is fire minutes before a meeting. An agent on a schedule with calendar access through the Google tools covers that without any of the state, and generalises ("look at my calendar and prep me") instead of a bespoke event model. The sync also read automation_events history back to classify edits vs creations, which was the reason that table could not be put on a retention window; the follow-up swap PR depends on this landing first.

How It Works

Deleted outright: google/calendar/**, google/jobs/sweep-schedules, lib/{syncCalendar,calendarEvents,scheduleCalendarFires}.ts, trpc/.../google/calendar.ts, providers/google/googleCalendar.tsx.

Edited to Gmail-only: reconcileWatches, the Google tRPC router's disconnect (no channels to stop), trigger options (labels + people), connection state helpers, scopes/constants, the shared trigger schema, matcher union and launched-kinds list, billing plan map, desktop grammar/provider registry/settings search, the web integration page copy, and the callback's required scopes.

google_calendar stays in the automation_trigger_kind Postgres enum (values cannot be dropped) with a comment; the satisfies check that every enum value is a live kind is relaxed to the one direction that still holds. No migration.

prune-payloads loses its calendar exclusion (the only provider it excluded).

Rollout

  • PostHog flag automation-event-triggers (829320) already updated (v7): payload no longer lists google_calendar, targeting unchanged. Clients read the payload, so the trigger and the Google integration card behave correctly the moment this deploys; older desktop builds ignore a kind absent from the payload.
  • Existing connections keep their calendar scope until they reconnect; new connects request gmail.readonly only.
  • Existing calendar watch channels keep pushing to the removed route until they expire (≤ 7 days) and get a 404. Harmless.
  • After deploy, delete the QStash schedule google/sweep-schedules (and anything targeting google/calendar/scheduled) in the Upstash console — schedules are console-only.
  • The google_calendar rows in automation_events (347k) are removed by the follow-up swap.

Testing

  • bunx turbo typecheck for shared, db, trpc, api, desktop, web — all green
  • bunx biome check on every touched directory
  • bun test: shared 34, trpc 42, api 267, desktop 268 — all pass
  • bun run check:i18n — the four re-keyed strings are translated in all 16 locales and every catalog compiles
  • Not exercised in a running app: the Gmail connect flow after the scope change. The callback's scope check and reconcileWatches are the two code paths that changed there, both covered by typecheck and unchanged in shape.

Summary by cubic

Removes the Google Calendar trigger integration end to end while keeping the Google connector for Gmail. No calendar trigger was ever created in production, yet all Google connections still watched their calendars and produced ~21,600 automation_events rows a day that nothing consumed, plus Google push traffic, channel renewals, and a 15-minute fire-scheduling sweep.

Rollout

  • After deploy, delete the QStash schedules google/sweep-schedules and whatever targets google/calendar/scheduled in the Upstash console — schedules are console-only.
  • Existing connections keep their calendar scope until they reconnect; new connects request gmail.readonly only.
  • Existing calendar watch channels keep pushing to the removed route until they expire (≤ 7 days) and get a 404.
  • The google_calendar value stays in the automation_trigger_kind Postgres enum (values cannot be dropped) with a comment; no migration is needed.

Summary by CodeRabbit

  • Removed Features
    • Google Calendar integration and Calendar-based automation triggers are no longer available. This includes Calendar event notifications, scheduling, and calendar selection in automation settings.
  • Updates
    • Google account connections now request Gmail access only. Integration descriptions clarify that mailbox access is read-only and automations can be triggered by arriving email.
    • Gmail watch management continues without Calendar channel management.
    • Google Calendar event payloads are now cleared during retention sweeps.