-
Notifications
You must be signed in to change notification settings - Fork 0
feat: CalendarCache - filter generic calendars from subscription batch #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: qodo_combined_20260121_qodo_grep_cursor_copilot_1_base_feat_calendarcache_-_filter_generic_calendars_from_subscription_batch_pr702
Are you sure you want to change the base?
feat: CalendarCache - filter generic calendars from subscription batch #86
Conversation
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>
Code Review by Qodo
1. PrismaSelectedCalendarRepository file name mismatch
|
| import type { Prisma } from "@calcom/prisma/client"; | ||
|
|
||
| export class SelectedCalendarRepository implements ISelectedCalendarRepository { | ||
| export class PrismaSelectedCalendarRepository implements ISelectedCalendarRepository { |
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.
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 { |
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.
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
| integrations?: string[]; | ||
| genericCalendarSuffixes?: string[]; |
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.
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
Benchmark PR from qodo-benchmark#702