Schedule Google Meet imports hourly and on connect

Closed
EH
2d ago
+375-0

Context

Eleventh PR of the Google Meet app, following #30587 (app shell), #30588 (test setup), #30589 (Google OAuth connection), #30590 (Meet API client), #30591 (listing), #30592 (transcript mapping), #30593 (calendar event matching), #30595 (Call Recording write and role), #30597 (import of one conference) and #30598 (queueing a connection's recent conferences). The app will import Google Meet recordings, transcripts and Gemini notes into Call Recordings, the same way the Teams, Fathom and Granola apps do. The full sequence of PRs is listed in #30587.

Until now nothing started an import. This PR adds the two triggers, so a connected Google account gets the transcripts of its recent conferences imported without any action.

What this PR does

  • google-meet-queue-connection-discoveries: a logic function on an hourly cron (17 * * * *). It lists the app's Google connections, skips the ones whose sign-in failed and need a reconnect, and queues one google-meet-queue-conference-imports job per connection. It only fans out: the Meet API calls happen in the queued jobs, each with its own timeout.
  • google-meet-register-connection: the provider's onConnectLogicFunction. Right after an account is connected it queues the same discovery job for that connection, so the first import does not wait for the next hour.
  • buildGoogleMeetDiscoveryJob and enqueueGoogleMeetDiscoveriesOrThrow: build and queue the discovery jobs in batches of 200. The job id combines the trigger, the connection and the current hour, so a repeated enqueue within an hour starts one run, and a new connection is never deduplicated against the scheduled run of the same hour.

Both triggers reuse the six-hour look-back of #30598. Importing older history after a first connection is left for a later PR.

The app is still unpublished and has no twenty-app keyword, so the cron only runs where the app is installed from the repository.

Checks

Run locally in the app folder: yarn install --immutable, yarn lint, yarn typecheck, yarn test:unit (75 tests), the repo formatter and twenty app build pass. The built manifest contains the four logic functions, the cron pattern, and the on-connect function on the provider. The unit tests mock the SDK; the triggers have not been run on a live workspace yet. The integration test needs a running server and was not run locally; CI runs it.