Skip to content

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

Merged
volnei merged 1 commit intomainfrom
devin/filter-generic-calendars-1768255103
Jan 13, 2026
Merged

feat: CalendarCache - filter generic calendars from subscription batch#26774
volnei merged 1 commit intomainfrom
devin/filter-generic-calendars-1768255103

Conversation

@volnei
Copy link
Contributor

@volnei volnei commented Jan 12, 2026

What does this PR do?

Configures SelectedCalendarRepository.findNextSubscriptionBatch to ignore generic calendars (holidays, contacts, shared, imported, resource calendars) by filtering based on their externalId suffixes.

Generic calendars are special calendars that shouldn't be subscribed to for sync because they're not user's personal calendars. For Google Calendar, these include calendars with suffixes like @group.v.calendar.google.com, @group.calendar.google.com, @import.calendar.google.com, and @resource.calendar.google.com.

Changes:

  • Add GENERIC_CALENDAR_SUFFIXES constant in AdaptersFactory mapping providers to their generic calendar suffixes
  • Add getGenericCalendarSuffixes() method to AdapterFactory interface
  • Update findNextSubscriptionBatch to accept and use genericCalendarSuffixes parameter to filter out calendars with matching externalId suffixes using Prisma's NOT + endsWith
  • Update CalendarSubscriptionService.checkForNewSubscriptions to pass generic calendar suffixes from the adapter factory

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.
  • N/A - No documentation changes required.

How should this be tested?

  1. Unit tests have been added/updated for both SelectedCalendarRepository and CalendarSubscriptionService
  2. Run tests: TZ=UTC yarn test packages/features/selectedCalendar/repositories/SelectedCalendarRepository.test.ts packages/features/calendar-subscription/lib/__tests__/CalendarSubscriptionService.test.ts
  3. To verify in production: Check that calendars with generic suffixes (e.g., holiday calendars ending in @group.v.calendar.google.com) are not being pulled for subscription

Human Review Checklist

  • Verify the Prisma query handles AND: undefined correctly (should be ignored when no suffixes provided)
  • Verify the list of Google Calendar generic suffixes is complete for your use case
  • Consider if Office 365 calendars need similar suffix filtering (currently empty array)

Link to Devin run: https://app.devin.ai/sessions/fbf759af4f2242afb079020f2ff63245
Requested by: Volnei Munhoz (@volnei)

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>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@volnei volnei changed the title feat: filter generic calendars from subscription batch feat: CalendarCache - filter generic calendars from subscription batch Jan 12, 2026
@volnei volnei marked this pull request as ready for review January 12, 2026 22:09
@volnei volnei enabled auto-merge (squash) January 12, 2026 22:09
@graphite-app graphite-app bot added core area: core, team members only foundation labels Jan 12, 2026
@graphite-app graphite-app bot requested a review from a team January 12, 2026 22:09
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 6 files

},
},
},
AND: undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Here too

@github-actions github-actions bot marked this pull request as draft January 12, 2026 22:19
auto-merge was automatically disabled January 12, 2026 22:19

Pull request was converted to draft

@volnei volnei marked this pull request as ready for review January 12, 2026 22:25
@volnei volnei requested a review from keithwillcode January 12, 2026 22:30
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 6 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants