Skip to content

feat: CalendarCache - filter generic calendars from subscription batch#22

Open
tomerqodo wants to merge 2 commits intoqodo_action_req_base_feat_calendarcache_-_filter_generic_calendars_from_subscription_batch_pr7from
qodo_action_req_head_feat_calendarcache_-_filter_generic_calendars_from_subscription_batch_pr7
Open

feat: CalendarCache - filter generic calendars from subscription batch#22
tomerqodo wants to merge 2 commits intoqodo_action_req_base_feat_calendarcache_-_filter_generic_calendars_from_subscription_batch_pr7from
qodo_action_req_head_feat_calendarcache_-_filter_generic_calendars_from_subscription_batch_pr7

Conversation

@tomerqodo
Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#7

devin-ai-integration Bot and others added 2 commits January 25, 2026 12:02
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
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Repository class/file name mismatch 📘 Rule violation ✓ Correctness
Description
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts exports
  PrismaSelectedCalendarRepository, but the filename is not PrismaSelectedCalendarRepository.ts
  (and does not follow the required Prisma<Entity>Repository.ts pattern).
• This violates the repository naming convention requirement and reduces
  discoverability/consistency, and can also break imports expecting an exported class named to match
  the file.
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 export a
matching PascalCase class name. The PR changes the exported class to
PrismaSelectedCalendarRepository while keeping the file named SelectedCalendarRepository.ts, and
other code still imports SelectedCalendarRepository from that path.

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

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 `packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts` exports `PrismaSelectedCalendarRepository`, but the filename does not match the exported class name and does not follow the required `Prisma&lt;Entity&gt;Repository.ts` naming convention.

## Issue Context
Compliance requires repository files to be named `Prisma&lt;Entity&gt;Repository.ts` and export the matching PascalCase class. The current mismatch can also break existing imports that expect `SelectedCalendarRepository` to be exported from this path.

## Fix Focus Areas
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[1-6]
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts[1-5]
- apps/web/app/api/cron/calendar-subscriptions/route.ts[4-13]
- apps/web/app/api/webhooks/calendar-subscription/[provider]/route.ts[5-16]

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


2. Broken repository export 🐞 Bug ✓ Correctness
Description
SelectedCalendarRepository.ts now exports PrismaSelectedCalendarRepository, but existing code
  still imports/instantiates SelectedCalendarRepository from the same module path.
• This will cause a TypeScript compile error (missing named export) and block runtime execution for
  the affected Next routes and unit tests.
• Impact is high because the broken imports occur in production API routes (cron + webhook
  handlers).
Code

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

+export class PrismaSelectedCalendarRepository implements ISelectedCalendarRepository {
Evidence
The module file exports PrismaSelectedCalendarRepository but does not export
SelectedCalendarRepository. Multiple consumers still import and instantiate
SelectedCalendarRepository from that module path, so the named import cannot resolve.

packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[1-6]
apps/web/app/api/cron/calendar-subscriptions/route.ts[4-13]
apps/web/app/api/cron/calendar-subscriptions/route.ts[39-45]
apps/web/app/api/webhooks/calendar-subscription/[provider]/route.ts[12-16]
apps/web/app/api/webhooks/calendar-subscription/[provider]/route.ts[59-65]
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts[1-5]
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts[49-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` now exports `PrismaSelectedCalendarRepository`, but several consumers still import/instantiate `SelectedCalendarRepository` from the same module path. This breaks compilation.

## Issue Context
This repository is used by calendar-subscription cron and webhook routes; compilation failure will block those endpoints.

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

## Suggested approach
Option A (compat/backwards-safe):
- Keep the class name `PrismaSelectedCalendarRepository`.
- Add `export { PrismaSelectedCalendarRepository as SelectedCalendarRepository };` (or re-add a wrapper class) so existing imports keep working.

Option B (explicit rename):
- Update all imports/usages to `PrismaSelectedCalendarRepository` and ensure no code still imports `SelectedCalendarRepository`.

ⓘ 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 {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Repository class/file name mismatch 📘 Rule violation ✓ Correctness

packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts exports
  PrismaSelectedCalendarRepository, but the filename is not PrismaSelectedCalendarRepository.ts
  (and does not follow the required Prisma<Entity>Repository.ts pattern).
• This violates the repository naming convention requirement and reduces
  discoverability/consistency, and can also break imports expecting an exported class named to match
  the file.
Agent prompt
## Issue description
The repository file `packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts` exports `PrismaSelectedCalendarRepository`, but the filename does not match the exported class name and does not follow the required `Prisma<Entity>Repository.ts` naming convention.

## Issue Context
Compliance requires repository files to be named `Prisma<Entity>Repository.ts` and export the matching PascalCase class. The current mismatch can also break existing imports that expect `SelectedCalendarRepository` to be exported from this path.

## Fix Focus Areas
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts[1-6]
- packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts[1-5]
- apps/web/app/api/cron/calendar-subscriptions/route.ts[4-13]
- apps/web/app/api/webhooks/calendar-subscription/[provider]/route.ts[5-16]

ⓘ 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 {
Copy link
Copy Markdown

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

SelectedCalendarRepository.ts now exports PrismaSelectedCalendarRepository, but existing code
  still imports/instantiates SelectedCalendarRepository from the same module path.
• This will cause a TypeScript compile error (missing named export) and block runtime execution for
  the affected Next routes and unit tests.
• Impact is high because the broken imports occur in production API routes (cron + webhook
  handlers).
Agent prompt
## Issue description
`packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts` now exports `PrismaSelectedCalendarRepository`, but several consumers still import/instantiate `SelectedCalendarRepository` from the same module path. This breaks compilation.

## Issue Context
This repository is used by calendar-subscription cron and webhook routes; compilation failure will block those endpoints.

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

## Suggested approach
Option A (compat/backwards-safe):
- Keep the class name `PrismaSelectedCalendarRepository`.
- Add `export { PrismaSelectedCalendarRepository as SelectedCalendarRepository };` (or re-add a wrapper class) so existing imports keep working.

Option B (explicit rename):
- Update all imports/usages to `PrismaSelectedCalendarRepository` and ensure no code still imports `SelectedCalendarRepository`.

ⓘ 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.

1 participant