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>
@qodo-code-review
Copy link

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. PrismaSelectedCalendarRepository file name mismatch 📘 Rule violation ✓ Correctness
Description
• The repository file SelectedCalendarRepository.ts exports the class
  PrismaSelectedCalendarRepository, so the filename does not match the exported class name and does
  not follow the required Prisma<Entity>Repository.ts convention.
• This reduces discoverability and can cause confusion or broken imports when refactoring, violating
  the repository/service naming convention rule.
Code

packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[5]

+export class PrismaSelectedCalendarRepository implements ISelectedCalendarRepository {
Evidence
PR Compliance ID 7 requires repository filenames to be Prisma<Entity>Repository.ts and to match
the exported class name. The code shows PrismaSelectedCalendarRepository exported from
SelectedCalendarRepository.ts, which is a filename/class mismatch.

AGENTS.md
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[1-6]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The repository file name does not match the exported repository class name and does not follow the required `Prisma&lt;Entity&gt;Repository.ts` naming convention.

## Issue Context
`packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts` exports `PrismaSelectedCalendarRepository`, which violates the repository naming rules and can harm discoverability/refactoring safety.

## Fix Focus Areas
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[1-6]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Broken repository export 🐞 Bug ✓ Correctness
Description
• The repository class in
  packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts was renamed to
  PrismaSelectedCalendarRepository without preserving/exporting the old SelectedCalendarRepository
  symbol.
• Multiple runtime entrypoints (cron/webhook routes) and tests still import/instantiate
  SelectedCalendarRepository from that module path, which will fail TypeScript builds and break
  runtime wiring.
Code

packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[5]

+export class PrismaSelectedCalendarRepository implements ISelectedCalendarRepository {
Evidence
The feature repository file now exports PrismaSelectedCalendarRepository, but the web cron route,
webhook route, and the repository test still import and instantiate SelectedCalendarRepository
from the same module path. This will result in missing export/constructor errors.

packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[1-32]
apps/web/app/api/cron/calendar-subscriptions/route.ts[5-46]
apps/web/app/api/webhooks/calendar-subscription/[provider]/route.ts[8-65]
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts[1-55]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts` no longer exports `SelectedCalendarRepository`, but multiple call sites still import and instantiate that symbol.

### Issue Context
This causes build-time failures (missing export) and breaks runtime wiring in cron/webhook endpoints.

### Fix Focus Areas
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[1-10]
- apps/web/app/api/cron/calendar-subscriptions/route.ts[9-45]
- apps/web/app/api/webhooks/calendar-subscription/[provider]/route.ts[10-66]
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts[1-55]

### Suggested change
Either:
1) Re-export an alias:
```ts
export { PrismaSelectedCalendarRepository as SelectedCalendarRepository };
```
(or keep both exports),

or
2) Update all imports/usages to `PrismaSelectedCalendarRepository` consistently.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Optional integrations unsafe 🐞 Bug ⛯ Reliability
Description
• The interface now allows integrations?: string[], but the Prisma repository implementation still
  assumes integrations is always present and uses it in integration: { in: integrations }.
• If a caller omits integrations (per the interface), Prisma will receive { in: undefined },
  which is treated as an error pattern in this codebase and can crash the subscription batching path.
Code

packages/features/selectedCalendar/repositories/SelectedCalendarRepository.interface.ts[R34-35]

    integrations?: string[];
+    genericCalendarSuffixes?: string[];
Evidence
The interface explicitly permits omitting integrations, but the repository implementation requires
and directly uses it in an in clause. The repo also contains a Prisma extension that throws when a
where.<field>.in value is undefined, demonstrating this is an invalid input shape in this
codebase.

packages/features/selectedCalendar/repositories/SelectedCalendarRepository.interface.ts[26-36]
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[18-33]
packages/prisma/extensions/disallow-undefined-delete-update-many.ts[3-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`integrations` is optional in `ISelectedCalendarRepository`, but the Prisma implementation treats it as required and uses it in `integration: { in: integrations }`. If a caller omits it, the query shape becomes `{ in: undefined }` which is considered invalid in this repo.

### Issue Context
Even if current call sites pass `integrations`, the interface now advertises that it can be omitted; a future caller can trigger a runtime failure.

### Fix Focus Areas
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.interface.ts[26-36]
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[18-33]

### Suggested change
Option A (preferable if omission is intended):
- Change implementation signature to `integrations?: string[]` and default:
```ts
async findNextSubscriptionBatch({ integrations = [], ...rest }: { integrations?: string[]; ... }) {
 ...
 integration: { in: integrations },
}
```
(or early-return `[]` if `integrations.length === 0`).

Option B:
- Revert the interface to `integrations: string[]` if it should always be provided.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



ⓘ The new review experience is currently in Beta. Learn more

Qodo Logo

import type { Prisma } from "@calcom/prisma/client";

export class SelectedCalendarRepository implements ISelectedCalendarRepository {
export class PrismaSelectedCalendarRepository implements ISelectedCalendarRepository {

Choose a reason for hiding this comment

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

Action required

1. prismaselectedcalendarrepository file name mismatch 📘 Rule violation ✓ Correctness

• The repository file SelectedCalendarRepository.ts exports the class
  PrismaSelectedCalendarRepository, so the filename does not match the exported class name and does
  not follow the required Prisma<Entity>Repository.ts convention.
• This reduces discoverability and can cause confusion or broken imports when refactoring, violating
  the repository/service naming convention rule.
Agent prompt
## Issue description
The repository file name does not match the exported repository class name and does not follow the required `Prisma<Entity>Repository.ts` naming convention.

## Issue Context
`packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts` exports `PrismaSelectedCalendarRepository`, which violates the repository naming rules and can harm discoverability/refactoring safety.

## Fix Focus Areas
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[1-6]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

import type { Prisma } from "@calcom/prisma/client";

export class SelectedCalendarRepository implements ISelectedCalendarRepository {
export class PrismaSelectedCalendarRepository implements ISelectedCalendarRepository {

Choose a reason for hiding this comment

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

Action required

2. Broken repository export 🐞 Bug ✓ Correctness

• The repository class in
  packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts was renamed to
  PrismaSelectedCalendarRepository without preserving/exporting the old SelectedCalendarRepository
  symbol.
• Multiple runtime entrypoints (cron/webhook routes) and tests still import/instantiate
  SelectedCalendarRepository from that module path, which will fail TypeScript builds and break
  runtime wiring.
Agent prompt
### Issue description
`packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts` no longer exports `SelectedCalendarRepository`, but multiple call sites still import and instantiate that symbol.

### Issue Context
This causes build-time failures (missing export) and breaks runtime wiring in cron/webhook endpoints.

### Fix Focus Areas
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[1-10]
- apps/web/app/api/cron/calendar-subscriptions/route.ts[9-45]
- apps/web/app/api/webhooks/calendar-subscription/[provider]/route.ts[10-66]
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts[1-55]

### Suggested change
Either:
1) Re-export an alias:
```ts
export { PrismaSelectedCalendarRepository as SelectedCalendarRepository };
```
(or keep both exports),

or
2) Update all imports/usages to `PrismaSelectedCalendarRepository` consistently.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 34 to +35
integrations?: string[];
genericCalendarSuffixes?: string[];

Choose a reason for hiding this comment

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

Action required

3. Optional integrations unsafe 🐞 Bug ⛯ Reliability

• The interface now allows integrations?: string[], but the Prisma repository implementation still
  assumes integrations is always present and uses it in integration: { in: integrations }.
• If a caller omits integrations (per the interface), Prisma will receive { in: undefined },
  which is treated as an error pattern in this codebase and can crash the subscription batching path.
Agent prompt
### Issue description
`integrations` is optional in `ISelectedCalendarRepository`, but the Prisma implementation treats it as required and uses it in `integration: { in: integrations }`. If a caller omits it, the query shape becomes `{ in: undefined }` which is considered invalid in this repo.

### Issue Context
Even if current call sites pass `integrations`, the interface now advertises that it can be omitted; a future caller can trigger a runtime failure.

### Fix Focus Areas
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.interface.ts[26-36]
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[18-33]

### Suggested change
Option A (preferable if omission is intended):
- Change implementation signature to `integrations?: string[]` and default:
```ts
async findNextSubscriptionBatch({ integrations = [], ...rest }: { integrations?: string[]; ... }) {
  ...
  integration: { in: integrations },
}
```
(or early-return `[]` if `integrations.length === 0`).

Option B:
- Revert the interface to `integrations: string[]` if it should always be provided.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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