Skip to content

Conversation

@akshayutture-augment
Copy link

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@akshayutture-augment
Copy link
Author

@greptileai

@greptile-apps
Copy link

greptile-apps bot commented Nov 14, 2025

Greptile Overview

Confidence Score: 0/5

  • This PR introduces critical runtime bugs that will break calendar and booking operations
  • Score reflects critical async/await bugs: getCalendarCredentials stores promises instead of Calendar objects (type violation), and multiple forEach(async) patterns cause calendar/video operations to silently fail by not waiting for completion
  • Critical attention needed on packages/core/CalendarManager.ts (breaks return type), packages/app-store/vital/lib/reschedule.ts, packages/app-store/wipemycalother/lib/reschedule.ts, packages/trpc/server/routers/viewer/bookings.tsx, and packages/features/bookings/lib/handleCancelBooking.ts (operations won't complete)

Important Files Changed

File Analysis

Filename Score Overview
packages/app-store/index.ts 3/5 Converted sync imports to dynamic import() for lazy loading - core change enabling async pattern
packages/app-store/vital/lib/reschedule.ts 1/5 Added await to getCalendar but uses async in forEach - deletions won't complete
packages/app-store/wipemycalother/lib/reschedule.ts 1/5 Added await to getCalendar but uses async in forEach - deletions won't complete
packages/core/CalendarManager.ts 0/5 Critical: getCalendar now async but not awaited in getCalendarCredentials - stores promises not Calendar objects
packages/features/bookings/lib/handleCancelBooking.ts 2/5 Mostly correct async/await usage, but one forEach with async callback won't wait for updates to complete
packages/trpc/server/routers/viewer/bookings.tsx 1/5 Uses async callback in forEach - calendar deletions won't complete before continuing

Sequence Diagram

sequenceDiagram
    participant Client
    participant CalendarManager
    participant getCalendar
    participant appStore
    participant CalendarApp
    participant CalendarService

    Client->>CalendarManager: getCalendarCredentials(credentials)
    CalendarManager->>getCalendar: getCalendar(credential)
    Note over CalendarManager,getCalendar: ⚠️ CRITICAL: Not awaited!
    getCalendar->>appStore: await appStore[calendarType]
    appStore-->>getCalendar: Promise<CalendarApp>
    getCalendar->>CalendarApp: Check lib.CalendarService
    CalendarApp-->>getCalendar: CalendarService class
    getCalendar->>CalendarService: new CalendarService(credential)
    CalendarService-->>getCalendar: Calendar instance
    getCalendar-->>CalendarManager: Promise<Calendar>
    Note over CalendarManager: Returns Promise, not Calendar!
    CalendarManager-->>Client: calendarCredentials (with Promise objects)
    
    Client->>CalendarManager: getConnectedCalendars(calendarCredentials)
    CalendarManager->>CalendarManager: await item.calendar
    Note over CalendarManager: Correctly awaits the Promise here
    CalendarManager->>CalendarService: calendar.listCalendars()
    CalendarService-->>CalendarManager: calendar list
    CalendarManager-->>Client: connectedCalendars
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Additional Comments (5)

  1. packages/app-store/vital/lib/reschedule.ts, line 125-134 (link)

    logic: async callback in forEach doesn't wait for promises. The calendar deletions won't complete before the function continues.

  2. packages/app-store/wipemycalother/lib/reschedule.ts, line 125-134 (link)

    logic: async callback in forEach doesn't wait for promises. The calendar deletions won't complete before the function continues.

  3. packages/trpc/server/routers/viewer/bookings.tsx, line 553-565 (link)

    logic: async callback in forEach doesn't wait for promises. The calendar/video deletions won't complete before the function continues.

  4. packages/features/bookings/lib/handleCancelBooking.ts, line 458-470 (link)

    logic: async callback in forEach doesn't wait for promises. The calendar updates won't complete before the function continues.

  5. packages/core/CalendarManager.ts, line 23-36 (link)

    logic: getCalendar is now async but not awaited here. This stores promises instead of Calendar objects, breaking the return type.

    export const getCalendarCredentials = async (credentials: Array<CredentialPayload>) => {
      const calendarCredentials = await Promise.all(
        getApps(credentials)
          .filter((app) => app.type.endsWith("_calendar"))
          .flatMap(async (app) => {
            const credentials = await Promise.all(
              app.credentials.map(async (credential) => {
                const calendar = await getCalendar(credential);
                return app.variant === "calendar" ? [{ integration: app, credential, calendar }] : [];
              })
            );
            return credentials.flat();
          })
      );
    
      return calendarCredentials.flat();
    };
    

12 files reviewed, 5 comments

Edit Code Review Agent Settings | Greptile

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.

3 participants