Skip to content

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

Open
tomerqodo wants to merge 2 commits intoaugment_full_base_feat_calendarcache_-_filter_generic_calendars_from_subscription_batch_pr7from
augment_full_head_feat_calendarcache_-_filter_generic_calendars_from_subscription_batch_pr7
Open

feat: CalendarCache - filter generic calendars from subscription batch#7
tomerqodo wants to merge 2 commits intoaugment_full_base_feat_calendarcache_-_filter_generic_calendars_from_subscription_batch_pr7from
augment_full_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>
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Jan 26, 2026

🤖 Augment PR Summary

Summary: This PR prevents “generic” calendars (e.g., holidays/imported/resources) from being included in the subscription batching used by CalendarCache.

Changes:

  • Adds a provider-keyed list of generic calendar ID suffixes and exposes them via `AdapterFactory.getGenericCalendarSuffixes()`.
  • Passes `genericCalendarSuffixes` into `findNextSubscriptionBatch()` during `checkForNewSubscriptions()`.
  • Extends the selected-calendar repository contract and Prisma query to exclude calendars whose `externalId` ends with any of the generic suffixes.
  • Updates unit tests to assert the new query shape and filtering behavior.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

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.

Renaming the exported class to PrismaSelectedCalendarRepository changes the module’s public API; there are still call sites importing/constructing SelectedCalendarRepository, which will break at runtime/build time unless they were updated consistently.

Other Locations
  • apps/web/app/api/cron/calendar-subscriptions/route.ts:41
  • apps/web/app/api/webhooks/calendar-subscription/[provider]/route.ts:61
  • packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts:3

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

}: {
take: number;
teamIds: number[];
integrations?: string[];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

integrations is optional in the interface, but the Prisma implementation assumes it’s always provided (integration: { in: integrations }); if any caller omits it, this will likely produce an invalid query or unexpected results.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

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