-
Notifications
You must be signed in to change notification settings - Fork 0
Automated Test: fix/handle-collective-multiple-host-destinations #367
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,7 +125,8 @@ export default class LarkCalendarService implements Calendar { | |
| async createEvent(event: CalendarEvent): Promise<NewCalendarEventType> { | ||
| let eventId = ""; | ||
| let eventRespData; | ||
| const calendarId = event.destinationCalendar?.externalId; | ||
| const [mainHostDestinationCalendar] = event.destinationCalendar ?? []; | ||
| const calendarId = mainHostDestinationCalendar?.externalId; | ||
| if (!calendarId) { | ||
| throw new Error("no calendar id"); | ||
|
Comment on lines
125
to
131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Find the Calendar interface definition
fd "\.ts$" packages/app-store | xargs rg "interface Calendar" -A 20Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 1562 🏁 Script executed: # Check the actual LarkCalendarService createEvent signature
cat packages/app-store/larkcalendar/lib/CalendarService.ts | head -150Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 5129 🏁 Script executed: # Find all calendar services
fd -type d "packages/app-store/*/lib" | grep -E "calendar|outlook|google" | head -10Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 260 🏁 Script executed: # Find the Calendar interface definition in types
fd -type f "Calendar.ts" packages/Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 260 🏁 Script executed: # Search for interface Calendar in the codebase
rg "interface Calendar" --type ts -A 15Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 3906 🏁 Script executed: # Find all calendar services and their createEvent signatures
find packages/app-store -name "CalendarService.ts" -o -name "calendar.ts" | head -20Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 919 🏁 Script executed: # Check other calendar services
ls -la packages/app-store | grep -E "google|outlook|caldav|ical"Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 284 🏁 Script executed: # Check Google Calendar Service createEvent signature
head -200 packages/app-store/googlecalendar/lib/CalendarService.ts | grep -A 5 "createEvent"Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 396 🏁 Script executed: # Check Outlook Calendar Service createEvent signature
head -200 packages/app-store/office365calendar/lib/CalendarService.ts | grep -A 5 "createEvent"Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 422 🏁 Script executed: # Check CalDAV Calendar Service createEvent signature
head -200 packages/app-store/caldavcalendar/lib/CalendarService.ts | grep -A 5 "createEvent"Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 72 🏁 Script executed: # Count how many calendar services have the credentialId parameter
rg "async createEvent\(event: CalendarEvent, credentialId: number\)" packages/app-storeRepository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 72 🏁 Script executed: # Count how many calendar services still have the old signature
rg "async createEvent\(event: CalendarEvent\):" packages/app-storeRepository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 1649 🏁 Script executed: # Check if tsconfig enforces strict type checking
cat tsconfig.json | head -50Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 135 🏁 Script executed: # Check if there's a build or type-check script
cat package.json | grep -A 5 '"scripts"'Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 353 🏁 Script executed: # Look for any type errors or TODO comments about the credentialId migration
rg "credentialId" packages/app-store --type ts -B 2 -A 2 | head -100Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror Length of output: 7274 Interface compliance: The Note: This issue affects multiple calendar services (Office 365, Exchange, Hubspot, Salesforce, and others) — only the Google Calendar service has been updated so far. Consider whether this is part of a broader migration effort. 🤖 Prompt for AI Agents |
||
| } | ||
|
|
@@ -160,7 +161,8 @@ export default class LarkCalendarService implements Calendar { | |
| } | ||
|
|
||
| private createAttendees = async (event: CalendarEvent, eventId: string) => { | ||
| const calendarId = event.destinationCalendar?.externalId; | ||
| const [mainHostDestinationCalendar] = event.destinationCalendar ?? []; | ||
| const calendarId = mainHostDestinationCalendar?.externalId; | ||
| if (!calendarId) { | ||
| this.log.error("no calendar id provided in createAttendees"); | ||
| throw new Error("no calendar id provided in createAttendees"); | ||
|
|
@@ -187,7 +189,8 @@ export default class LarkCalendarService implements Calendar { | |
| async updateEvent(uid: string, event: CalendarEvent, externalCalendarId?: string) { | ||
| const eventId = uid; | ||
| let eventRespData; | ||
| const calendarId = externalCalendarId || event.destinationCalendar?.externalId; | ||
| const [mainHostDestinationCalendar] = event.destinationCalendar ?? []; | ||
| const calendarId = externalCalendarId || mainHostDestinationCalendar?.externalId; | ||
| if (!calendarId) { | ||
| this.log.error("no calendar id provided in updateEvent"); | ||
| throw new Error("no calendar id provided in updateEvent"); | ||
|
|
@@ -231,7 +234,8 @@ export default class LarkCalendarService implements Calendar { | |
| * @returns | ||
| */ | ||
| async deleteEvent(uid: string, event: CalendarEvent, externalCalendarId?: string) { | ||
| const calendarId = externalCalendarId || event.destinationCalendar?.externalId; | ||
| const [mainHostDestinationCalendar] = event.destinationCalendar ?? []; | ||
| const calendarId = externalCalendarId || mainHostDestinationCalendar?.externalId; | ||
| if (!calendarId) { | ||
| this.log.error("no calendar id provided in deleteEvent"); | ||
| throw new Error("no calendar id provided in deleteEvent"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 112
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 1119
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 201
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 72
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 1896
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 1428
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 1752
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 719
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 293
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 72
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 755
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 241
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 2443
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 111
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 1030
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 409
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 1431
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 971
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 220
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 186
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 399
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 1519
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 410
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 2271
🏁 Script executed:
Repository: admin-coderabbit/coderabbit-cal_dot_com-mirror
Length of output: 1428
Fix deleteEvent fallback logic when externalCalendarId is missing
The fallback logic on line 315-318 is broken. When
externalCalendarIdis undefined/null, the.find()searches forcal.externalId === undefined, which never matches any calendar. This causescalendarIdto become undefined, forcing deletion to always target the "primary" calendar regardless of where the event was created. Since 404 errors are silently swallowed (line 339), deletion silently fails when the event is on another calendar.Use the first destination calendar or primary directly:
🔧 Suggested fix
🤖 Prompt for AI Agents