Skip to content

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 29, 2026

Benchmark PR from agentic-review-benchmarks#7

Summary by CodeRabbit

  • New Features
    • Added automatic filtering for generic calendar types during subscription operations. The system now identifies and excludes specific calendar suffixes, including Google Calendar group calendars, from being subscribed to. This prevents unwanted group calendar subscriptions, improves overall subscription accuracy and reliability, and ensures better calendar subscription management across all supported calendar providers.

✏️ Tip: You can customize this high-level summary in your review settings.

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 <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Walkthrough

This PR adds calendar suffix-based filtering to exclude generic/system calendars from subscriptions. It introduces provider-specific suffixes via a new constant and factory method, threads this configuration through the service layer, and applies filtering in the repository using a NOT-ENDS-WITH query condition.

Changes

Cohort / File(s) Summary
Adapter Factory Configuration
packages/features/calendar-subscription/adapters/AdaptersFactory.ts
Introduced GENERIC_CALENDAR_SUFFIXES constant mapping providers to suffix exclusion lists. Extended AdapterFactory interface and DefaultAdapterFactory class with getGenericCalendarSuffixes() method to retrieve flattened suffix array.
Service Layer Integration
packages/features/calendar-subscription/lib/CalendarSubscriptionService.ts
packages/features/calendar-subscription/lib/__tests__/CalendarSubscriptionService.test.ts
Service now fetches generic calendar suffixes from adapter factory and passes them to findNextSubscriptionBatch. Updated mock and test expectations to propagate genericCalendarSuffixes parameter.
Repository Layer
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.interface.ts
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts
Added optional genericCalendarSuffixes parameter to findNextSubscriptionBatch. Renamed class to PrismaSelectedCalendarRepository. Implemented suffix-based filtering using NOT-ENDS-WITH logic when suffixes provided. Updated tests with new filter assertions and explicit AND conditions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hops through calendars, quick and sly,
Filtering noise that clutters by,
Google's ghosts and Office fare,
Vanish now—only true ones stay there!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: filtering generic calendars from subscription batches, which is the central objective of this changeset across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In
`@packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts`:
- Around line 23-27: The implementation in SelectedCalendarRepository has a
parameter typed as integrations: string[] while the corresponding interface
marks integrations as optional; update the method signature in
SelectedCalendarRepository to integrations?: string[] (or if integrations must
be required, update the interface instead) and inside the method (e.g., where
integrations is used) handle the undefined case (e.g., default to an empty array
or guard before iterating) so usage is safe; reference the parameter group
containing take, teamIds, integrations, genericCalendarSuffixes in the
SelectedCalendarRepository method.
- Around line 5-6: The exported class name PrismaSelectedCalendarRepository no
longer matches the name imported by the tests (SelectedCalendarRepository),
causing an import error; fix by either renaming the class back to
SelectedCalendarRepository in the file (change PrismaSelectedCalendarRepository
→ SelectedCalendarRepository) or update the test import to use
PrismaSelectedCalendarRepository so both sides reference the same class name
(adjust the import statement in the test that currently imports
SelectedCalendarRepository).
🧹 Nitpick comments (1)
packages/features/calendar-subscription/adapters/AdaptersFactory.ts (1)

67-71: Consider using Object.values() for cleaner code.

The current implementation works correctly, but using Object.values() avoids the need for type casting.

♻️ Suggested refactor
   getGenericCalendarSuffixes(): string[] {
-    return Object.keys(GENERIC_CALENDAR_SUFFIXES).flatMap(
-      (provider) => GENERIC_CALENDAR_SUFFIXES[provider as CalendarSubscriptionProvider]
-    );
+    return Object.values(GENERIC_CALENDAR_SUFFIXES).flat();
   }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec77423 and 41aeb83.

📒 Files selected for processing (6)
  • packages/features/calendar-subscription/adapters/AdaptersFactory.ts
  • packages/features/calendar-subscription/lib/CalendarSubscriptionService.ts
  • packages/features/calendar-subscription/lib/__tests__/CalendarSubscriptionService.test.ts
  • packages/features/selectedCalendar/repositories/SelectedCalendarRepository.interface.ts
  • packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts
  • packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts (1)
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.interface.ts (1)
  • ISelectedCalendarRepository (3-67)
🔇 Additional comments (7)
packages/features/selectedCalendar/repositories/SelectedCalendarRepository.interface.ts (1)

24-35: LGTM!

The interface update is well-documented with JSDoc and correctly types genericCalendarSuffixes as optional. The signature aligns with the implementation.

packages/features/calendar-subscription/adapters/AdaptersFactory.ts (1)

7-20: LGTM!

The GENERIC_CALENDAR_SUFFIXES constant is well-documented and provides a clear mapping of provider-specific suffixes to exclude. This is a clean way to centralize the configuration.

packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts (1)

41-45: LGTM!

The suffix filtering logic correctly uses an array of NOT conditions combined with AND to exclude all calendars matching any of the provided suffixes. When no suffixes are provided, undefined is correctly passed which Prisma will ignore.

packages/features/calendar-subscription/lib/CalendarSubscriptionService.ts (1)

391-396: LGTM!

Clean integration of the generic calendar suffix filtering. The suffixes are correctly retrieved from the adapter factory and passed to the repository method.

packages/features/calendar-subscription/lib/__tests__/CalendarSubscriptionService.test.ts (1)

115-121: LGTM!

The mock correctly returns the same suffixes defined in GENERIC_CALENDAR_SUFFIXES for Google Calendar. The test expectations are consistent throughout all checkForNewSubscriptions test cases.

packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts (2)

202-236: LGTM!

Excellent test coverage for the new filtering logic. The test properly validates that:

  1. The AND clause is constructed with NOT conditions for each suffix
  2. The externalId endsWith filter is correctly applied

134-134: Good practice: explicitly testing the AND: undefined case.

These tests properly verify that when genericCalendarSuffixes is not provided, the AND clause is undefined, ensuring no unintended filtering occurs.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +5 to 6
export class PrismaSelectedCalendarRepository implements ISelectedCalendarRepository {
constructor(private prismaClient: PrismaClient) {}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check all exports and re-exports of SelectedCalendarRepository in the selectedCalendar directory
echo "=== Searching for SelectedCalendarRepository in the selectedCalendar directory ==="
rg -n "SelectedCalendarRepository|PrismaSelectedCalendarRepository" packages/features/selectedCalendar/ --type ts

echo ""
echo "=== Checking for index/barrel exports ==="
find packages/features/selectedCalendar -name "index.ts" -o -name "*.test.ts" | head -20

Repository: qodo-benchmark/cal.com-combined-coderabbit

Length of output: 1437


Fix class name mismatch between export and test imports.

The class was renamed to PrismaSelectedCalendarRepository but the test file imports the old name SelectedCalendarRepository (line 3 of the test). This will cause an import error. Either rename the class back to SelectedCalendarRepository or update the test imports to use PrismaSelectedCalendarRepository.

🤖 Prompt for AI Agents
In
`@packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts`
around lines 5 - 6, The exported class name PrismaSelectedCalendarRepository no
longer matches the name imported by the tests (SelectedCalendarRepository),
causing an import error; fix by either renaming the class back to
SelectedCalendarRepository in the file (change PrismaSelectedCalendarRepository
→ SelectedCalendarRepository) or update the test import to use
PrismaSelectedCalendarRepository so both sides reference the same class name
(adjust the import statement in the test that currently imports
SelectedCalendarRepository).

Comment on lines 23 to +27
}: {
take: number;
teamIds: number[];
integrations: string[];
genericCalendarSuffixes?: string[];
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Type mismatch: integrations is required here but optional in interface.

The interface declares integrations?: string[] (optional), but this implementation declares integrations: string[] (required). This inconsistency could cause TypeScript errors when calling the method without the integrations parameter.

🔧 Proposed fix
   }: {
     take: number;
     teamIds: number[];
-    integrations: string[];
+    integrations?: string[];
     genericCalendarSuffixes?: string[];
   }) {

Note: If integrations should remain required, update the interface instead.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
}: {
take: number;
teamIds: number[];
integrations: string[];
genericCalendarSuffixes?: string[];
}: {
take: number;
teamIds: number[];
integrations?: string[];
genericCalendarSuffixes?: string[];
🤖 Prompt for AI Agents
In
`@packages/features/selectedCalendar/repositories/SelectedCalendarRepository.ts`
around lines 23 - 27, The implementation in SelectedCalendarRepository has a
parameter typed as integrations: string[] while the corresponding interface
marks integrations as optional; update the method signature in
SelectedCalendarRepository to integrations?: string[] (or if integrations must
be required, update the interface instead) and inside the method (e.g., where
integrations is used) handle the undefined case (e.g., default to an empty array
or guard before iterating) so usage is safe; reference the parameter group
containing take, teamIds, integrations, genericCalendarSuffixes in the
SelectedCalendarRepository method.

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