Skip to content

Conversation

@GTFalcao
Copy link
Collaborator

@GTFalcao GTFalcao commented Nov 6, 2025

Closes #18964

Summary by CodeRabbit

  • New Features

    • Added upcoming event alert polling for Google Calendar—notifies users of events approaching their start time based on configurable alert windows.
    • Added upcoming event polling for Microsoft Outlook Calendar—detects and emits events shortly before their scheduled start time.
  • Releases

    • Google Calendar component updated to version 0.6.0
    • Microsoft Outlook Calendar component updated to version 0.4.0

@vercel
Copy link

vercel bot commented Nov 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Nov 6, 2025 5:54pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Nov 6, 2025 5:54pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

Walkthrough

The changes introduce polling-based alternatives to subscription-based sources for Google Calendar and Microsoft Outlook Calendar that periodically fetch upcoming events and emit them shortly before their scheduled start times. Version bumps in package.json files reflect these additions.

Changes

Cohort / File(s) Summary
Google Calendar version update
components/google_calendar/package.json
Version bumped from 0.5.13 to 0.6.0
Google Calendar polling source
components/google_calendar/sources/upcoming-event-alert-polling/test-event.mjs, components/google_calendar/sources/upcoming-event-alert-polling/upcoming-event-alert-polling.mjs
New test fixture exporting sample Google Calendar event data; new polling source module implementing upcoming event detection with emitted events tracking, time-window filtering, and state management via database
Microsoft Outlook Calendar version update
components/microsoft_outlook_calendar/package.json
Version bumped from 0.3.4 to 0.4.0
Microsoft Outlook Calendar polling source
components/microsoft_outlook_calendar/sources/new-upcoming-event-polling/new-upcoming-event-polling.mjs
New polling source module fetching upcoming calendar events within a configurable time window, tracking emitted events to prevent duplicates, and emitting events before their start time

Sequence Diagrams

sequenceDiagram
    participant Poller as Polling Loop
    participant Source as Polling Source
    participant DB as Database
    participant API as Calendar API
    
    loop On Each Poll Cycle
        Poller->>Source: Execute polling
        Source->>DB: Get emitted events tracker
        Source->>Source: Clean up past events
        Source->>Source: Calculate time window (now → now + minutesBefore)
        Source->>API: Fetch events in window
        API-->>Source: Return events
        
        loop For Each Event
            Source->>Source: Check if already emitted
            alt Event not emitted & within threshold
                Source->>Source: Calculate timeRemaining
                alt timeRemaining > 0 AND timeRemaining ≤ minutesBefore
                    Source->>DB: Record emitted event
                    Source->>Poller: Emit event with metadata
                end
            end
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • State management logic: Both polling sources maintain and manipulate emitted events trackers in the database; review correctness of tracking, cleanup routines, and edge cases (e.g., timezone handling, time calculations)
  • Filtering and deduplication: Verify time-window calculations, event filtering logic, and deduplication correctness across both implementations
  • Pattern consistency: Two similar implementations in different integrations—review for consistency and correctness of parallel logic, especially around time comparisons and event metadata generation

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description only contains a reference to the closed issue without providing context about the changes, implementation details, or testing instructions. Add a brief summary of the changes in the PR description, including what polling sources were added and why the polling approach was chosen over subscriptions.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding polling-based sources for upcoming events in Google Calendar and Microsoft Outlook Calendar components.
Linked Issues check ✅ Passed The PR successfully implements timer-based polling sources for both Google Calendar and Microsoft Outlook Calendar to detect upcoming events, meeting the core requirement of issue #18964.
Out of Scope Changes check ✅ Passed The PR also includes version bumps (0.5.13→0.6.0 for Google Calendar, 0.3.4→0.4.0 for Outlook) and test fixtures, which are appropriate supporting changes for the new polling functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch upcoming-event-polling-sources

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aebf7b0 and dd912a3.

📒 Files selected for processing (5)
  • components/google_calendar/package.json (1 hunks)
  • components/google_calendar/sources/upcoming-event-alert-polling/test-event.mjs (1 hunks)
  • components/google_calendar/sources/upcoming-event-alert-polling/upcoming-event-alert-polling.mjs (1 hunks)
  • components/microsoft_outlook_calendar/package.json (1 hunks)
  • components/microsoft_outlook_calendar/sources/new-upcoming-event-polling/new-upcoming-event-polling.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-10-10T19:18:27.998Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.

Applied to files:

  • components/google_calendar/sources/upcoming-event-alert-polling/upcoming-event-alert-polling.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components

Comment on lines +1 to +3
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs";
import sampleEmit from "./test-event.mjs";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix timezone handling before computing alert windows

Microsoft Graph returns event.start.dateTime in the calendar’s local time without an offset, paired with event.start.timeZone. Parsing it with new Date(event.start.dateTime) makes Node assume the runtime’s timezone (typically UTC), so the alert window is shifted by the user’s timezone offset. For example, a 9 AM Pacific event is treated as 9 AM UTC, causing the alert to fire ~7 hours early. Please normalize with the provided timezone before comparing against now.

@@
-import sampleEmit from "./test-event.mjs";
+import sampleEmit from "./test-event.mjs";
+import { DateTime } from "luxon";
@@
-      const startTime = event.start
-        ? new Date(event.start.dateTime)
-        : null;
-
-      if (!startTime) {
+      const start = event.start?.dateTime ?? event.start?.date;
+      if (!start) {
+        continue;
+      }
+      const zone = event.start?.timeZone
+        || event.originalStartTimeZone
+        || "UTC";
+      const startDateTime = DateTime.fromISO(start, { zone });
+      if (!startDateTime.isValid) {
+        continue;
+      }
+      const startTime = startDateTime.toJSDate();
+
+      if (!startTime) {
         continue;
       }
@@
-        emittedEvents[event.id] = startTime.getTime();
+        emittedEvents[event.id] = startTime.getTime();

Also applies to: 108-129

🤖 Prompt for AI Agents
In
components/microsoft_outlook_calendar/sources/new-upcoming-event-polling/new-upcoming-event-polling.mjs
around lines 1-3 and also apply same change to lines 108-129: the code currently
parses event.start.dateTime with new Date(...) which treats the timestamp as
runtime-local/UTC and ignores event.start.timeZone, shifting alert windows; fix
by parsing the ISO local date with the provided timeZone (e.g., use a
timezone-aware parser such as Luxon or moment-timezone) — create a DateTime by
combining event.start.dateTime and event.start.timeZone, convert that to a
consistent zone (preferably UTC) for comparisons with now, do the same for
event.end.dateTime, and use those normalized UTC timestamps when computing alert
windows and comparisons.

Copy link
Collaborator

@lcaresia lcaresia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but have some failed actions to look.

@vunguyenhung
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TRIGGER] Upcoming Event polling for Google Calendar and Outlook Calendar

4 participants