Skip to content

Conversation

@tomerqodo
Copy link

Benchmark PR from qodo-benchmark#702

devin-ai-integration bot and others added 2 commits January 21, 2026 15:41
Add filtering to SelectedCalendarRepository.findNextSubscriptionBatch to
exclude generic calendars (holidays, contacts, shared, imported, resources)
based on their externalId suffixes.

Changes:
- Add GENERIC_CALENDAR_SUFFIXES constant mapping providers to their
  generic calendar suffixes in AdaptersFactory
- Add getGenericCalendarSuffixes method to AdapterFactory interface
- Update findNextSubscriptionBatch to accept and use genericCalendarSuffixes
  parameter to filter out calendars with matching externalId suffixes
- Update CalendarSubscriptionService.checkForNewSubscriptions to pass
  generic calendar suffixes from the adapter factory
- Update tests to cover the new filtering logic

Co-Authored-By: Volnei Munhoz <volnei.munhoz@gmail.com>
import type { Prisma } from "@calcom/prisma/client";

export class SelectedCalendarRepository implements ISelectedCalendarRepository {
export class PrismaSelectedCalendarRepository implements ISelectedCalendarRepository {
Copy link

Choose a reason for hiding this comment

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

Bug: The class SelectedCalendarRepository was renamed, but its usages in production code and tests were not updated, which will cause a runtime error.
Severity: CRITICAL

Suggested Fix

Update all import statements that use SelectedCalendarRepository to import PrismaSelectedCalendarRepository instead. Files to update include apps/web/app/api/cron/calendar-subscriptions/route.ts, apps/web/app/api/webhooks/calendar-subscription/[provider]/route.ts, and the corresponding test file. Alternatively, add a backward-compatible export: export { PrismaSelectedCalendarRepository as SelectedCalendarRepository };.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location:
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts#L5

Potential issue: The class `SelectedCalendarRepository` was renamed to
`PrismaSelectedCalendarRepository`, but this change was not propagated to all files that
import it. Critical production code, including the cron job at
`apps/web/app/api/cron/calendar-subscriptions/route.ts` and the webhook handler at
`apps/web/app/api/webhooks/calendar-subscription/[provider]/route.ts`, still imports and
instantiates the old, non-existent class name. This will cause a `TypeError:
SelectedCalendarRepository is not a constructor` at runtime, breaking calendar
subscription syncing and webhook processing.

Did we get this right? 👍 / 👎 to inform future reviews.

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.

2 participants