Skip to content

Comments

[Bug] google_calendar-update-following-instances duplicates the first instance when rescheduling a recurring event#20058

Merged
jcortes merged 1 commit intomasterfrom
fix-issue-20056-google-calendar
Feb 18, 2026
Merged

[Bug] google_calendar-update-following-instances duplicates the first instance when rescheduling a recurring event#20058
jcortes merged 1 commit intomasterfrom
fix-issue-20056-google-calendar

Conversation

@jcortes
Copy link
Collaborator

@jcortes jcortes commented Feb 18, 2026

WHY

Resolves #20056

Summary by CodeRabbit

  • Bug Fixes

    • Improved update flow for following instances of recurring Google Calendar events: deletion now occurs before recurrence trimming, with added error handling that attempts to restore deleted instances and surfaces clear partial-failure messages when operations partially succeed.
  • Chores

    • Bumped component and action versions to reflect this update.

@jcortes jcortes self-assigned this Feb 18, 2026
@vercel
Copy link

vercel bot commented Feb 18, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Feb 18, 2026 2:30pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

Walkthrough

Deletes the target recurring instance first, then trims the original recurrence and creates a new recurring event inside a try/catch; on failure the action attempts to restore the deleted instance and emits partial-failure messaging. Action and package versions bumped.

Changes

Cohort / File(s) Summary
Update-following-instances action
components/google_calendar/actions/update-following-instances/update-following-instances.mjs
Version bumped 0.0.30.0.4. Workflow reordered to delete the targeted instance before trimming the original recurrence. Trimming and new-event creation moved into a guarded try/catch; on error the deleted instance is patched back to "confirmed" (restore path). Adds step4TrimApplied flag to track partial-failure scenarios, supports new recurrence computation paths (explicit repeatFrequency or inherit original without COUNT), and adjusts exported summary/results.
Package metadata
components/google_calendar/package.json
Package version bumped 0.8.40.8.5 (no other metadata changes).

Sequence Diagram(s)

sequenceDiagram
  participant Action
  participant GoogleCalendar
  participant Logger

  Action->>GoogleCalendar: DELETE instance (instanceId)
  GoogleCalendar-->>Action: 200 OK
  Action->>GoogleCalendar: TRY: PATCH original event (RRULE trimmed -> UNTIL)
  GoogleCalendar-->>Action: 200 OK
  Action->>GoogleCalendar: CREATE new event (newRecurrence / attendees / timezone)
  GoogleCalendar-->>Action: 200 Created
  Action->>Logger: emit success summary

  alt PATCH/CREATE fails
    Action->>GoogleCalendar: PATCH deleted instance -> status "confirmed" (restore)
    GoogleCalendar-->>Action: 200 OK / Error
    Action->>Logger: emit partial-failure summary (restored or restore failed)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the bug being fixed: duplicating the first instance when rescheduling recurring events in Google Calendar's update-following-instances action.
Description check ✅ Passed The description is minimal but adequate, referencing the resolved issue #20056 which contains full context about the bug being addressed.
Linked Issues check ✅ Passed The code changes directly address issue #20056 by deleting the original instance before trimming the RRULE and adding error handling with restoration logic to prevent duplicate first instances.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the duplicate instance bug: version bumps for the action and package, operation flow reordering with deletion step, error handling, and restoration logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix-issue-20056-google-calendar

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@components/google_calendar/actions/update-following-instances/update-following-instances.mjs`:
- Around line 194-203: The deleteEvent call (this.googleCalendar.deleteEvent) is
non-atomic with the subsequent updateEvent/createEvent steps so if updateEvent
or createEvent fails the original instance is permanently lost; wrap the Step
4/5 sequence (the calls to updateEvent and createEvent) in a try/catch and in
the catch attempt to re-create the deleted instance (using this.calendarId,
this.instanceId and the original event payload/state you saved before deletion)
as a fallback, and if re-creation also fails emit a clear, distinct
$.export("$summary", ...) message indicating a partial-failure state (deleted
original instance, replacement not created) so callers/users can take corrective
action.

@jcortes jcortes force-pushed the fix-issue-20056-google-calendar branch from 082c3ce to 473506b Compare February 18, 2026 00:31
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@components/google_calendar/actions/update-following-instances/update-following-instances.mjs`:
- Around line 232-243: When building newRecurrence in update-following-instances
(the block that assigns newRecurrence when this.repeatFrequency is falsy), do
not reuse originalEvent.recurrence verbatim if it contains a COUNT=... rule;
instead strip any COUNT component from the inherited RRULE string (use the same
COUNT-removal regex/logic already used in modifyRecurrenceRule) so the tail
series does not reapply the original total-count and over-generate
instances—i.e., detect COUNT in originalEvent.recurrence and return a recurrence
string with COUNT removed (or otherwise replaced with UNTIL if you choose option
2), but default to removing COUNT when no new repeatFrequency is provided.
- Around line 275-292: When attempting the split, set a boolean flag (e.g.,
step4TrimApplied) before calling this.googleCalendar.updateEvent(...) that
performs the Step 4 RRULE trim so you can detect that the original series was
modified; in the outer catch where you currently try to restore the instance
(catch (splitError)), export a partial-failure summary if the restore succeeds
and step4TrimApplied is true (e.g., $.export("$summary", "Partial failure: split
failed but original instance was restored; the series RRULE was already modified
and may require manual repair.")), and keep the existing summary only for the
nested catch (_restoreError) where restoration itself fails; ensure the flag is
set immediately prior to calling updateEvent and cleared/left as-is based on
outcome so the rethrown splitError always accompanies the proper summary.

@jcortes jcortes force-pushed the fix-issue-20056-google-calendar branch 2 times, most recently from 0967e15 to c780922 Compare February 18, 2026 00:53
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@components/google_calendar/actions/update-following-instances/update-following-instances.mjs`:
- Around line 287-295: The restore/updateEvent call is sending the original
sendUpdates value which can trigger duplicate attendee notifications; change the
restore path so the updateEvent call uses sendUpdates coerced to "none" (e.g.,
replace passing this.sendUpdates with a local/inline value forced to "none" for
the restore) when calling this.googleCalendar.updateEvent with calendarId:
this.calendarId, eventId: this.instanceId and requestBody: { ...targetInstance,
status: "confirmed" }; ensure other code paths still use the original
this.sendUpdates.
- Around line 253-272: The createEvent call is passing the event payload under
resource which the underlying events.insert expects as requestBody, so replace
the resource property with requestBody in the createEvent invocation inside
update-following-instances (the call that constructs newEvent) and do the same
in create-event (the createEvent wrapper usage around line 147) so the payload
is sent correctly; locate the calls to this.googleCalendar.createEvent and
change the argument object to use requestBody: { summary..., start..., end...,
recurrence..., attendees..., colorId... } instead of resource.

… instance when rescheduling a recurring event
@jcortes jcortes force-pushed the fix-issue-20056-google-calendar branch from c780922 to 4cc7515 Compare February 18, 2026 14:30
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.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@components/google_calendar/actions/update-following-instances/update-following-instances.mjs`:
- Around line 287-295: The restore path currently calls
this.googleCalendar.updateEvent with sendUpdates: this.sendUpdates which can
re-notify attendees; change the updateEvent call in the restore/error-recovery
branch so it uses sendUpdates: "none" (replace the this.sendUpdates usage) to
prevent a second invite; update the call around this.googleCalendar.updateEvent
(the block that sends targetInstance/status: "confirmed" for this.instanceId) to
hard-code "none" for sendUpdates.
- Around line 253-272: The event payload is being passed under the
non‑recognized "resource" key (e.g., in update-following-instances's createEvent
call and create-event action) so events.insert() drops the body; either change
the createEvent call sites to pass the payload under "requestBody" (replace the
resource: {...} object with requestBody: {...}) or update the createEvent
wrapper in google_calendar.app.mjs to translate incoming resource -> requestBody
before calling events.insert(); verify by checking the createEvent wrapper and
requestHandler for any mapping and ensure events.insert() receives a requestBody
containing summary, start, end, recurrence, attendees, colorId, etc.

Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

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

LGTM! Passed all QA tests! Ready for Release!

@pipedream-component-development
Copy link
Collaborator

✅ All tests passed - ready for release!
📖 See the test report(s) below:

@jcortes jcortes merged commit 6f51137 into master Feb 18, 2026
9 checks passed
@jcortes jcortes deleted the fix-issue-20056-google-calendar branch February 18, 2026 16:13
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.

[Bug] google_calendar-update-following-instances duplicates the first instance when rescheduling a recurring event

3 participants