Skip to content

Comments

refactor: move @calcom/lib/di folder to @calcom/features#24199

Merged
keithwillcode merged 7 commits intomainfrom
refactor/move-di-folder-to-features
Oct 2, 2025
Merged

refactor: move @calcom/lib/di folder to @calcom/features#24199
keithwillcode merged 7 commits intomainfrom
refactor/move-di-folder-to-features

Conversation

@hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Oct 1, 2025

What does this PR do?

  • This PR migrates packages/lib/di folder to packages/features/di. As a result, we arewe are creating some circular dependencies between @calcom/lib and @calcom/features but it is to be addressed in follow-up PRs.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A - I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Tests passing are sufficient.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Walkthrough

The PR consistently updates import paths to move DI containers, modules, and tokens from the @calcom/lib namespace to @calcom/features (e.g., AvailableSlots, BookingLimits, BusyTimes, Cache, LuckyUser, QualifiedHosts, GetUserAvailability, InsightsBooking, InsightsRouting, NoSlotsNotification, DI_TOKENS). Changes span API routes, tRPC handlers, feature DI modules/containers, bookings logic, Prisma and Redis DI wiring, and tests. No runtime logic, control flow, or public/exported signatures were modified.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly communicates the primary refactor of relocating the DI folder from @calcom/lib/di to @calcom/features and uses the conventional “refactor:” prefix. It is concise, specific, and directly aligns with the changes in the PR. A teammate scanning the history would immediately understand the main objective of the changeset.
Description Check ✅ Passed The PR description clearly explains that the packages/lib/di folder is being migrated to packages/features/di and acknowledges resulting circular dependencies to be resolved later. It accurately describes the change and testing instructions align with the migration. Therefore it is related and sufficiently informative for this refactor.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/move-di-folder-to-features

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@graphite-app graphite-app bot requested review from a team October 1, 2025 09:15
@keithwillcode keithwillcode added core area: core, team members only foundation labels Oct 1, 2025
@hbjORbj hbjORbj requested a review from a team as a code owner October 1, 2025 09:17
@vercel
Copy link

vercel bot commented Oct 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Oct 2, 2025 10:00am
cal-eu Ignored Ignored Oct 2, 2025 10:00am

Copy link
Contributor

@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: 0

🧹 Nitpick comments (2)
packages/trpc/server/routers/viewer/teams/getMemberAvailability.handler.ts (1)

48-48: Consider using named export instead of default export.

The coding guidelines encourage named exports over default exports for better tree-shaking and refactoring. While handlers may be considered primary exports, named exports would provide consistency across the codebase.

Apply this diff:

-export default getMemberAvailabilityHandler;
+export { getMemberAvailabilityHandler as default };

Or better yet, remove the default export entirely if the import side can be updated to use named imports.

packages/trpc/server/routers/viewer/routing-forms/findTeamMembersMatchingAttributeLogicOfRoute.handler.ts (1)

330-330: Consider using named export instead of default export.

Per coding guidelines, named exports are preferred over default exports for better tree-shaking and easier refactoring.

Apply this diff:

-export default findTeamMembersMatchingAttributeLogicOfRouteHandler;
+export { findTeamMembersMatchingAttributeLogicOfRouteHandler as default };

Or remove the default export entirely if the import side can be updated to use named imports.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 43cc40d and ba25a3b.

📒 Files selected for processing (57)
  • apps/api/v1/pages/api/availability/_get.ts (1 hunks)
  • apps/api/v1/pages/api/slots/_get.ts (1 hunks)
  • apps/api/v1/test/lib/bookings/_post.test.ts (1 hunks)
  • apps/web/pages/api/get-inbound-dynamic-variables.ts (1 hunks)
  • apps/web/test/lib/checkBookingLimits.test.ts (1 hunks)
  • apps/web/test/lib/getSchedule.test.ts (1 hunks)
  • apps/web/test/lib/getSchedule/calendarEvents.test.ts (1 hunks)
  • apps/web/test/lib/getSchedule/delegation-credential.test.ts (1 hunks)
  • apps/web/test/lib/getSchedule/futureLimit.timezone.test.ts (1 hunks)
  • apps/web/test/lib/getSchedule/restrictionSchedule.test.ts (1 hunks)
  • apps/web/test/lib/getSchedule/selectedSlots.test.ts (1 hunks)
  • packages/features/bookings/lib/handleNewBooking.ts (1 hunks)
  • packages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.ts (1 hunks)
  • packages/features/bookings/lib/handleNewBooking/loadAndValidateUsers.ts (1 hunks)
  • packages/features/di/bookings/containers/InstantBookingCreateService.container.ts (1 hunks)
  • packages/features/di/bookings/containers/RecurringBookingService.container.ts (1 hunks)
  • packages/features/di/bookings/modules/InstantBookingCreateService.module.ts (1 hunks)
  • packages/features/di/bookings/modules/RecurringBookingService.module.ts (1 hunks)
  • packages/features/di/bookings/modules/RegularBookingService.module.ts (1 hunks)
  • packages/features/di/containers/AvailableSlots.ts (1 hunks)
  • packages/features/di/containers/BookingLimits.ts (1 hunks)
  • packages/features/di/containers/BusyTimes.ts (1 hunks)
  • packages/features/di/containers/Cache.ts (1 hunks)
  • packages/features/di/containers/FilterHosts.ts (1 hunks)
  • packages/features/di/containers/GetUserAvailability.ts (1 hunks)
  • packages/features/di/containers/InsightsBooking.ts (1 hunks)
  • packages/features/di/containers/InsightsRouting.ts (1 hunks)
  • packages/features/di/containers/NoSlotsNotification.ts (1 hunks)
  • packages/features/di/containers/QualifiedHosts.ts (1 hunks)
  • packages/features/di/modules/Attribute.ts (1 hunks)
  • packages/features/di/modules/Booking.ts (1 hunks)
  • packages/features/di/modules/CheckBookingLimits.ts (1 hunks)
  • packages/features/di/modules/EventType.ts (1 hunks)
  • packages/features/di/modules/Features.ts (1 hunks)
  • packages/features/di/modules/Host.ts (1 hunks)
  • packages/features/di/modules/LuckyUser.ts (1 hunks)
  • packages/features/di/modules/Membership.ts (1 hunks)
  • packages/features/di/modules/Ooo.ts (1 hunks)
  • packages/features/di/modules/RoutingFormResponse.ts (1 hunks)
  • packages/features/di/modules/Schedule.ts (1 hunks)
  • packages/features/di/modules/SelectedSlots.ts (1 hunks)
  • packages/features/di/modules/Team.ts (1 hunks)
  • packages/features/di/modules/User.ts (1 hunks)
  • packages/features/ee/round-robin/roundRobinReassignment.ts (1 hunks)
  • packages/features/insights/server/trpc-router.ts (1 hunks)
  • packages/features/redis/di/redisModule.ts (1 hunks)
  • packages/lib/bookings/filterHostsByLeadThreshold.test.ts (1 hunks)
  • packages/lib/intervalLimits/server/getBusyTimesFromLimits.ts (1 hunks)
  • packages/lib/server/getLuckyUser.integration-test.ts (1 hunks)
  • packages/lib/server/getLuckyUser.test.ts (1 hunks)
  • packages/prisma/prisma.module.ts (1 hunks)
  • packages/trpc/server/routers/viewer/availability/user.handler.ts (1 hunks)
  • packages/trpc/server/routers/viewer/routing-forms/findTeamMembersMatchingAttributeLogicOfRoute.handler.ts (1 hunks)
  • packages/trpc/server/routers/viewer/slots/getSchedule.handler.ts (1 hunks)
  • packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.ts (1 hunks)
  • packages/trpc/server/routers/viewer/slots/util.ts (1 hunks)
  • packages/trpc/server/routers/viewer/teams/getMemberAvailability.handler.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/lib/bookings/filterHostsByLeadThreshold.test.ts
  • packages/features/di/bookings/containers/InstantBookingCreateService.container.ts
  • packages/features/di/containers/NoSlotsNotification.ts
  • packages/features/di/containers/BusyTimes.ts
  • packages/features/di/containers/BookingLimits.ts
  • packages/features/di/modules/CheckBookingLimits.ts
  • packages/features/di/containers/GetUserAvailability.ts
  • packages/features/di/modules/Attribute.ts
  • packages/features/di/modules/RoutingFormResponse.ts
  • packages/features/di/bookings/modules/RecurringBookingService.module.ts
  • apps/web/test/lib/getSchedule/calendarEvents.test.ts
  • apps/api/v1/pages/api/availability/_get.ts
  • packages/lib/intervalLimits/server/getBusyTimesFromLimits.ts
  • apps/web/test/lib/getSchedule/selectedSlots.test.ts
  • packages/features/bookings/lib/handleNewBooking/loadAndValidateUsers.ts
  • packages/features/di/modules/Membership.ts
  • packages/features/insights/server/trpc-router.ts
  • packages/lib/server/getLuckyUser.test.ts
  • packages/features/di/containers/AvailableSlots.ts
  • packages/trpc/server/routers/viewer/slots/util.ts
  • apps/api/v1/test/lib/bookings/_post.test.ts
  • packages/lib/server/getLuckyUser.integration-test.ts
  • packages/features/di/bookings/containers/RecurringBookingService.container.ts
  • packages/features/bookings/lib/handleNewBooking.ts
  • apps/web/pages/api/get-inbound-dynamic-variables.ts
  • packages/features/di/modules/LuckyUser.ts
  • packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.ts
  • packages/prisma/prisma.module.ts
  • packages/features/di/modules/Features.ts
  • packages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.ts
  • packages/features/di/modules/Booking.ts
  • packages/features/ee/round-robin/roundRobinReassignment.ts
  • packages/features/di/containers/QualifiedHosts.ts
  • apps/web/test/lib/getSchedule.test.ts
  • packages/trpc/server/routers/viewer/availability/user.handler.ts
  • packages/features/di/modules/Team.ts
  • packages/features/di/modules/Ooo.ts
  • packages/features/redis/di/redisModule.ts
  • packages/features/di/modules/Host.ts
  • packages/trpc/server/routers/viewer/teams/getMemberAvailability.handler.ts
  • packages/trpc/server/routers/viewer/slots/getSchedule.handler.ts
  • apps/web/test/lib/getSchedule/restrictionSchedule.test.ts
  • apps/web/test/lib/getSchedule/delegation-credential.test.ts
  • apps/web/test/lib/checkBookingLimits.test.ts
  • packages/features/di/containers/FilterHosts.ts
  • apps/web/test/lib/getSchedule/futureLimit.timezone.test.ts
  • packages/features/di/bookings/modules/RegularBookingService.module.ts
  • packages/features/di/modules/SelectedSlots.ts
  • apps/api/v1/pages/api/slots/_get.ts
  • packages/features/di/modules/EventType.ts
  • packages/trpc/server/routers/viewer/routing-forms/findTeamMembersMatchingAttributeLogicOfRoute.handler.ts
  • packages/features/di/containers/Cache.ts
  • packages/features/di/containers/InsightsRouting.ts
  • packages/features/di/containers/InsightsBooking.ts
  • packages/features/di/bookings/modules/InstantBookingCreateService.module.ts
  • packages/features/di/modules/User.ts
  • packages/features/di/modules/Schedule.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/lib/bookings/filterHostsByLeadThreshold.test.ts
  • packages/features/di/bookings/containers/InstantBookingCreateService.container.ts
  • packages/features/di/containers/NoSlotsNotification.ts
  • packages/features/di/containers/BusyTimes.ts
  • packages/features/di/containers/BookingLimits.ts
  • packages/features/di/modules/CheckBookingLimits.ts
  • packages/features/di/containers/GetUserAvailability.ts
  • packages/features/di/modules/Attribute.ts
  • packages/features/di/modules/RoutingFormResponse.ts
  • packages/features/di/bookings/modules/RecurringBookingService.module.ts
  • apps/web/test/lib/getSchedule/calendarEvents.test.ts
  • apps/api/v1/pages/api/availability/_get.ts
  • packages/lib/intervalLimits/server/getBusyTimesFromLimits.ts
  • apps/web/test/lib/getSchedule/selectedSlots.test.ts
  • packages/features/bookings/lib/handleNewBooking/loadAndValidateUsers.ts
  • packages/features/di/modules/Membership.ts
  • packages/features/insights/server/trpc-router.ts
  • packages/lib/server/getLuckyUser.test.ts
  • packages/features/di/containers/AvailableSlots.ts
  • packages/trpc/server/routers/viewer/slots/util.ts
  • apps/api/v1/test/lib/bookings/_post.test.ts
  • packages/lib/server/getLuckyUser.integration-test.ts
  • packages/features/di/bookings/containers/RecurringBookingService.container.ts
  • packages/features/bookings/lib/handleNewBooking.ts
  • apps/web/pages/api/get-inbound-dynamic-variables.ts
  • packages/features/di/modules/LuckyUser.ts
  • packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.ts
  • packages/prisma/prisma.module.ts
  • packages/features/di/modules/Features.ts
  • packages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.ts
  • packages/features/di/modules/Booking.ts
  • packages/features/ee/round-robin/roundRobinReassignment.ts
  • packages/features/di/containers/QualifiedHosts.ts
  • apps/web/test/lib/getSchedule.test.ts
  • packages/trpc/server/routers/viewer/availability/user.handler.ts
  • packages/features/di/modules/Team.ts
  • packages/features/di/modules/Ooo.ts
  • packages/features/redis/di/redisModule.ts
  • packages/features/di/modules/Host.ts
  • packages/trpc/server/routers/viewer/teams/getMemberAvailability.handler.ts
  • packages/trpc/server/routers/viewer/slots/getSchedule.handler.ts
  • apps/web/test/lib/getSchedule/restrictionSchedule.test.ts
  • apps/web/test/lib/getSchedule/delegation-credential.test.ts
  • apps/web/test/lib/checkBookingLimits.test.ts
  • packages/features/di/containers/FilterHosts.ts
  • apps/web/test/lib/getSchedule/futureLimit.timezone.test.ts
  • packages/features/di/bookings/modules/RegularBookingService.module.ts
  • packages/features/di/modules/SelectedSlots.ts
  • apps/api/v1/pages/api/slots/_get.ts
  • packages/features/di/modules/EventType.ts
  • packages/trpc/server/routers/viewer/routing-forms/findTeamMembersMatchingAttributeLogicOfRoute.handler.ts
  • packages/features/di/containers/Cache.ts
  • packages/features/di/containers/InsightsRouting.ts
  • packages/features/di/containers/InsightsBooking.ts
  • packages/features/di/bookings/modules/InstantBookingCreateService.module.ts
  • packages/features/di/modules/User.ts
  • packages/features/di/modules/Schedule.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/lib/bookings/filterHostsByLeadThreshold.test.ts
  • packages/features/di/bookings/containers/InstantBookingCreateService.container.ts
  • packages/features/di/containers/NoSlotsNotification.ts
  • packages/features/di/containers/BusyTimes.ts
  • packages/features/di/containers/BookingLimits.ts
  • packages/features/di/modules/CheckBookingLimits.ts
  • packages/features/di/containers/GetUserAvailability.ts
  • packages/features/di/modules/Attribute.ts
  • packages/features/di/modules/RoutingFormResponse.ts
  • packages/features/di/bookings/modules/RecurringBookingService.module.ts
  • apps/web/test/lib/getSchedule/calendarEvents.test.ts
  • apps/api/v1/pages/api/availability/_get.ts
  • packages/lib/intervalLimits/server/getBusyTimesFromLimits.ts
  • apps/web/test/lib/getSchedule/selectedSlots.test.ts
  • packages/features/bookings/lib/handleNewBooking/loadAndValidateUsers.ts
  • packages/features/di/modules/Membership.ts
  • packages/features/insights/server/trpc-router.ts
  • packages/lib/server/getLuckyUser.test.ts
  • packages/features/di/containers/AvailableSlots.ts
  • packages/trpc/server/routers/viewer/slots/util.ts
  • apps/api/v1/test/lib/bookings/_post.test.ts
  • packages/lib/server/getLuckyUser.integration-test.ts
  • packages/features/di/bookings/containers/RecurringBookingService.container.ts
  • packages/features/bookings/lib/handleNewBooking.ts
  • apps/web/pages/api/get-inbound-dynamic-variables.ts
  • packages/features/di/modules/LuckyUser.ts
  • packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.ts
  • packages/prisma/prisma.module.ts
  • packages/features/di/modules/Features.ts
  • packages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.ts
  • packages/features/di/modules/Booking.ts
  • packages/features/ee/round-robin/roundRobinReassignment.ts
  • packages/features/di/containers/QualifiedHosts.ts
  • apps/web/test/lib/getSchedule.test.ts
  • packages/trpc/server/routers/viewer/availability/user.handler.ts
  • packages/features/di/modules/Team.ts
  • packages/features/di/modules/Ooo.ts
  • packages/features/redis/di/redisModule.ts
  • packages/features/di/modules/Host.ts
  • packages/trpc/server/routers/viewer/teams/getMemberAvailability.handler.ts
  • packages/trpc/server/routers/viewer/slots/getSchedule.handler.ts
  • apps/web/test/lib/getSchedule/restrictionSchedule.test.ts
  • apps/web/test/lib/getSchedule/delegation-credential.test.ts
  • apps/web/test/lib/checkBookingLimits.test.ts
  • packages/features/di/containers/FilterHosts.ts
  • apps/web/test/lib/getSchedule/futureLimit.timezone.test.ts
  • packages/features/di/bookings/modules/RegularBookingService.module.ts
  • packages/features/di/modules/SelectedSlots.ts
  • apps/api/v1/pages/api/slots/_get.ts
  • packages/features/di/modules/EventType.ts
  • packages/trpc/server/routers/viewer/routing-forms/findTeamMembersMatchingAttributeLogicOfRoute.handler.ts
  • packages/features/di/containers/Cache.ts
  • packages/features/di/containers/InsightsRouting.ts
  • packages/features/di/containers/InsightsBooking.ts
  • packages/features/di/bookings/modules/InstantBookingCreateService.module.ts
  • packages/features/di/modules/User.ts
  • packages/features/di/modules/Schedule.ts
🧠 Learnings (2)
📚 Learning: 2025-09-03T09:52:51.182Z
Learnt from: hariombalhara
PR: calcom/cal.com#23541
File: packages/features/bookings/lib/di/modules/RegularBookingServiceModule.ts:22-28
Timestamp: 2025-09-03T09:52:51.182Z
Learning: The IBookingServiceDependencies interface in packages/features/bookings/lib/handleNewBooking.ts contains 6 properties: cacheService, checkBookingAndDurationLimitsService, prismaClient, bookingRepository, featuresRepository, and checkBookingLimitsService. This interface is used by RegularBookingService and matches the depsMap structure in RegularBookingServiceModule.

Applied to files:

  • packages/features/di/containers/BookingLimits.ts
  • packages/features/di/bookings/containers/RecurringBookingService.container.ts
  • packages/features/bookings/lib/handleNewBooking.ts
  • packages/features/di/bookings/modules/RegularBookingService.module.ts
📚 Learning: 2025-09-23T08:00:07.619Z
Learnt from: hariombalhara
PR: calcom/cal.com#23918
File: packages/features/schedules/lib/use-schedule/useTimesForSchedule.test.ts:16-23
Timestamp: 2025-09-23T08:00:07.619Z
Learning: In calcom/cal.com test files, particularly packages/features/schedules/lib/use-schedule/useTimesForSchedule.test.ts, the TIMEZONE_OFFSETS mapping is intentionally limited to only UTC variants and Asia/Kolkata. This is by design and should not be flagged as incomplete in future reviews (confirmed by maintainer hariombalhara).

Applied to files:

  • apps/web/test/lib/getSchedule/futureLimit.timezone.test.ts
🔇 Additional comments (57)
packages/features/di/modules/EventType.ts (1)

1-1: Import path update looks correct. The token import relocation aligns with the new features/di structure and keeps module wiring intact.

packages/features/di/modules/RoutingFormResponse.ts (1)

1-1: Import path update verified

No remaining references to @calcom/lib/di/ found; DI_TOKENS export confirmed in packages/features/di/tokens.ts.

packages/features/di/modules/Team.ts (1)

1-1: LGTM! Import path correctly updated.

The DI_TOKENS import path has been successfully migrated from the lib namespace to the features namespace, aligning with the PR's refactoring objective.

packages/features/di/containers/QualifiedHosts.ts (1)

1-1: LGTM! Import path correctly updated.

The DI_TOKENS import has been properly migrated to the features namespace, maintaining consistency with the repository-wide refactor.

packages/features/di/modules/Ooo.ts (1)

1-1: LGTM! Import path correctly updated.

The DI_TOKENS import has been successfully migrated to the features namespace, consistent with the broader refactoring effort.

packages/features/di/modules/Schedule.ts (1)

1-1: LGTM! Import path correctly updated.

The DI_TOKENS import path has been properly migrated to the features namespace, aligning with the PR's refactoring objective.

packages/features/di/modules/Host.ts (1)

1-1: LGTM! Import path correctly updated.

The DI_TOKENS import has been successfully migrated to the features namespace, maintaining consistency with the repository-wide refactor.

packages/features/di/containers/Cache.ts (1)

1-1: LGTM! Import path updated correctly.

The import path has been successfully updated from the lib namespace to the features namespace, aligning with the PR's refactoring objective.

packages/features/di/bookings/containers/InstantBookingCreateService.container.ts (1)

1-1: LGTM! Import path updated correctly.

The import path has been successfully updated to the features namespace, consistent with the refactoring objective.

packages/features/di/containers/FilterHosts.ts (1)

1-1: LGTM! Import path updated correctly.

The import path change aligns with the PR's refactoring goal.

packages/features/di/modules/CheckBookingLimits.ts (1)

1-1: LGTM! Import path updated correctly.

The import path has been properly updated to the features namespace.

packages/features/di/modules/Attribute.ts (1)

1-1: LGTM — import path updated correctly
Please verify no old paths remain and the new path is in use:

rg -n "@calcom/lib/di/tokens" -g '*.ts' -g '*.tsx'
rg -n "from ['\"]@calcom/lib/di/" -g '*.ts' -g '*.tsx'
rg -l "@calcom/features/di/tokens" -g '*.ts' -g '*.tsx' | head -20
packages/lib/bookings/filterHostsByLeadThreshold.test.ts (1)

6-6: LGTM! Import path successfully updated.

The import path has been correctly updated to reflect the new location of the DI container in the features namespace.

apps/api/v1/test/lib/bookings/_post.test.ts (1)

79-79: LGTM! Mock path correctly updated.

The mock path has been updated to align with the new DI container location.

packages/features/di/modules/User.ts (1)

1-1: LGTM! DI_TOKENS import path updated correctly.

The import has been successfully migrated to the features namespace.

packages/features/bookings/lib/handleNewBooking/loadAndValidateUsers.ts (1)

5-5: LGTM! Service import path updated correctly.

The import path has been properly updated to reference the DI container from the features namespace.

packages/features/di/modules/SelectedSlots.ts (1)

1-1: LGTM! DI_TOKENS import path updated correctly.

The import has been successfully migrated to the features namespace, consistent with the refactoring objective.

packages/features/bookings/lib/handleNewBooking.ts (1)

50-52: LGTM! Clean refactor of DI container imports.

The import paths have been correctly updated from @calcom/lib/di/containers/... to @calcom/features/di/containers/... for the three services. This aligns with the PR objective to move the DI folder to the features namespace. No functional changes are introduced.

packages/features/di/containers/InsightsRouting.ts (1)

1-1: LGTM! DI_TOKENS import path correctly updated.

The import path for DI_TOKENS has been updated from @calcom/lib/di/tokens to @calcom/features/di/tokens, consistent with the PR's refactoring objective.

packages/features/di/containers/InsightsBooking.ts (1)

1-1: LGTM! DI_TOKENS import path correctly updated.

The import path for DI_TOKENS has been updated from @calcom/lib/di/tokens to @calcom/features/di/tokens, aligning with the PR's goal to relocate DI components to the features namespace.

packages/lib/server/getLuckyUser.test.ts (1)

8-8: LGTM! Test import updated to match refactored DI container location.

The import path for getLuckyUserService has been correctly updated from @calcom/lib/di/containers/LuckyUser to @calcom/features/di/containers/LuckyUser. This ensures the test suite aligns with the new DI container location.

apps/web/test/lib/checkBookingLimits.test.ts (1)

4-4: LGTM! Test import updated to match refactored DI container location.

The import path for getCheckBookingLimitsService has been correctly updated from @calcom/lib/di/containers/BookingLimits to @calcom/features/di/containers/BookingLimits, ensuring the test suite is consistent with the new DI namespace.

packages/features/di/containers/BusyTimes.ts (1)

1-1: LGTM! Import path updated correctly.

The DI_TOKENS import path has been successfully updated to reflect the new features namespace location.

packages/features/di/containers/NoSlotsNotification.ts (1)

2-2: LGTM! Import path updated correctly.

The DI_TOKENS import path has been successfully updated to the features namespace.

apps/web/test/lib/getSchedule/delegation-credential.test.ts (1)

15-15: LGTM! Test import updated correctly.

The import path for getAvailableSlotsService has been successfully updated to reflect the new features namespace location. The test logic remains unchanged.

packages/lib/intervalLimits/server/getBusyTimesFromLimits.ts (1)

3-4: LGTM! Service imports updated correctly.

Both getCheckBookingLimitsService and getBusyTimesService import paths have been successfully updated to the features namespace. The services are used correctly throughout the file.

packages/features/di/modules/Booking.ts (1)

1-1: LGTM! Import path updated correctly.

The DI_TOKENS import has been successfully moved to the features namespace, maintaining consistency with the refactor objective.

packages/features/insights/server/trpc-router.ts (1)

16-17: LGTM! Import path updates are correct.

The migration from @calcom/lib/di/containers to @calcom/features/di/containers is consistent with the PR objectives.

packages/features/di/modules/LuckyUser.ts (1)

1-1: LGTM! Token import path correctly updated.

The DI_TOKENS import now references the features namespace, aligning with the refactor objectives.

packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.ts (1)

9-9: LGTM! Test import correctly updated.

The import path for getNoSlotsNotificationService now correctly points to the features DI container.

packages/trpc/server/routers/viewer/teams/getMemberAvailability.handler.ts (1)

2-2: LGTM! Import path correctly updated.

The import for getUserAvailabilityService now references the features DI container.

packages/trpc/server/routers/viewer/routing-forms/findTeamMembersMatchingAttributeLogicOfRoute.handler.ts (1)

12-12: LGTM! Import path correctly updated.

The import for getLuckyUserService now references the features DI container.

packages/features/di/bookings/modules/RecurringBookingService.module.ts (1)

2-2: LGTM! Import path correctly updated.

The DI_TOKENS import path has been correctly migrated from the lib namespace to the features namespace, consistent with the PR's refactoring objective.

packages/features/di/containers/AvailableSlots.ts (1)

2-2: LGTM! DI_TOKENS import path correctly updated.

The import path migration from lib to features namespace is consistent with the refactoring objective, and all container configuration remains unchanged.

apps/web/test/lib/getSchedule/selectedSlots.test.ts (1)

14-14: LGTM! Test import path correctly updated.

The getAvailableSlotsService import has been properly migrated to the features namespace. Test logic remains unchanged and should continue to function correctly.

packages/prisma/prisma.module.ts (1)

1-2: LGTM! DI imports correctly migrated.

Both the Container/createModule and DI_TOKENS imports have been properly updated to reference the features namespace. Module binding logic remains unchanged.

apps/web/test/lib/getSchedule/calendarEvents.test.ts (1)

12-12: LGTM! Test import path correctly updated.

The getAvailableSlotsService import has been properly migrated to the features namespace, consistent with the refactoring. Test implementation remains unchanged.

packages/lib/server/getLuckyUser.integration-test.ts (1)

3-3: LGTM! Clean refactor of import path.

The import path has been correctly updated to reflect the new location of the DI container in the features namespace.

packages/features/ee/round-robin/roundRobinReassignment.ts (1)

27-27: LGTM! Import path correctly updated.

The import has been successfully migrated to the features DI container location.

packages/trpc/server/routers/viewer/slots/getSchedule.handler.ts (1)

1-1: LGTM! Clean refactor of import path.

The import path has been correctly updated to the features namespace.

apps/web/test/lib/getSchedule.test.ts (1)

20-20: LGTM! Import path correctly updated.

The test file import has been successfully migrated to the features DI container location.

apps/api/v1/pages/api/availability/_get.ts (1)

4-4: LGTM! Import path correctly updated.

The import has been successfully migrated to the features DI container namespace.

packages/trpc/server/routers/viewer/availability/user.handler.ts (1)

1-1: LGTM! Clean import path migration.

The import path has been correctly updated to reference the new features namespace for DI containers.

apps/web/pages/api/get-inbound-dynamic-variables.ts (1)

8-8: LGTM! Import path correctly updated.

The AvailableSlots service import has been properly migrated to the features namespace.

apps/web/test/lib/getSchedule/restrictionSchedule.test.ts (1)

13-13: LGTM! Test import updated correctly.

The test file import path has been properly updated to the features namespace.

packages/trpc/server/routers/viewer/slots/util.ts (1)

19-19: LGTM! Type import path correctly migrated.

The type-only import for getBusyTimesService has been properly updated to reference the features namespace.

packages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.ts (1)

7-8: LGTM! Both service imports correctly migrated.

Both BusyTimes and GetUserAvailability service imports have been properly updated to the features namespace, maintaining consistency across the codebase.

apps/web/test/lib/getSchedule/futureLimit.timezone.test.ts (1)

11-11: LGTM! Import path updated correctly.

The import path has been successfully updated from the lib namespace to the features namespace. The service usage throughout the test remains unchanged, preserving all test behavior.

packages/features/di/containers/GetUserAvailability.ts (1)

2-2: LGTM! DI_TOKENS import path updated correctly.

The import has been successfully migrated to the features namespace, maintaining all container configuration and service resolution logic.

packages/features/di/bookings/containers/RecurringBookingService.container.ts (1)

1-6: LGTM! All DI module imports migrated correctly.

All DI-related imports have been consistently updated to the features namespace while preserving the container configuration logic. The prismaModule import correctly remains in its original location.

apps/api/v1/pages/api/slots/_get.ts (1)

7-7: LGTM! Service import path updated correctly.

The import path has been migrated to the features namespace. Service instantiation and usage remain unchanged, preserving the endpoint's functionality.

packages/features/di/containers/BookingLimits.ts (1)

1-1: LGTM! DI_TOKENS import path updated correctly.

The import has been successfully migrated to the features namespace. All container configuration and service exports remain unchanged.

packages/features/di/bookings/modules/InstantBookingCreateService.module.ts (1)

2-2: LGTM — DI_TOKENS export and import path verified.

Confirmed that DI_TOKENS is exported from @calcom/features/di/tokens and no remaining @calcom/lib/di imports exist.

packages/features/redis/di/redisModule.ts (1)

1-2: Approve DI import path refactor

All old @calcom/lib/di imports have been replaced with @calcom/features/di across the repository.

packages/features/di/bookings/modules/RegularBookingService.module.ts (1)

2-7: DI import paths fully updated and verified
No remaining @calcom/lib/di/ imports were found; all DI modules now consistently reference @calcom/features/di/.

packages/features/di/modules/Membership.ts (1)

1-1: LGTM — refactor complete, no remaining old imports.

All modules now import DI_TOKENS from @calcom/features/di/tokens, and no @calcom/lib/di references remain.

packages/features/di/modules/Features.ts (1)

2-2: Approve import path update

The module @calcom/features/di/tokens exists (packages/features/di/tokens.ts exports DI_TOKENS), and no remaining @calcom/lib/di/ imports were found. LGTM.

@hbjORbj hbjORbj marked this pull request as draft October 1, 2025 10:02
@hbjORbj hbjORbj changed the title refactor: move di folder to features refactor: move @calcom/lib/di folder to @calcom/features Oct 1, 2025
Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
packages/features/di/modules/GetUserAvailability.ts (1)

1-3: Import path update looks correct.

The change from relative imports to @calcom/lib/getUserAvailability aligns with the refactor objective of moving DI infrastructure to @calcom/features while keeping service implementations in @calcom/lib.

Minor formatting note: Line 3 has an extra trailing blank line that could be removed for consistency.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba25a3b and 3a7c27e.

📒 Files selected for processing (13)
  • packages/features/bookings/lib/handleNewBooking.ts (1 hunks)
  • packages/features/di/containers/BookingLimits.ts (1 hunks)
  • packages/features/di/containers/BusyTimes.ts (1 hunks)
  • packages/features/di/containers/GetUserAvailability.ts (1 hunks)
  • packages/features/di/containers/QualifiedHosts.ts (1 hunks)
  • packages/features/di/modules/BusyTimes.ts (1 hunks)
  • packages/features/di/modules/FilterHosts.ts (1 hunks)
  • packages/features/di/modules/GetUserAvailability.ts (1 hunks)
  • packages/features/di/modules/QualifiedHosts.ts (1 hunks)
  • packages/lib/bookings/filterHostsByLeadThreshold.ts (1 hunks)
  • packages/lib/bookings/findQualifiedHostsWithDelegationCredentials.test.ts (1 hunks)
  • packages/lib/getBusyTimes.test.ts (1 hunks)
  • packages/lib/getUserAvailability.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/lib/bookings/findQualifiedHostsWithDelegationCredentials.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/features/di/containers/GetUserAvailability.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/features/di/modules/BusyTimes.ts
  • packages/lib/bookings/filterHostsByLeadThreshold.ts
  • packages/features/di/containers/BookingLimits.ts
  • packages/features/di/containers/BusyTimes.ts
  • packages/features/di/modules/FilterHosts.ts
  • packages/features/di/containers/QualifiedHosts.ts
  • packages/lib/getUserAvailability.ts
  • packages/features/di/modules/QualifiedHosts.ts
  • packages/lib/getBusyTimes.test.ts
  • packages/features/di/modules/GetUserAvailability.ts
  • packages/features/bookings/lib/handleNewBooking.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/features/di/modules/BusyTimes.ts
  • packages/lib/bookings/filterHostsByLeadThreshold.ts
  • packages/features/di/containers/BookingLimits.ts
  • packages/features/di/containers/BusyTimes.ts
  • packages/features/di/modules/FilterHosts.ts
  • packages/features/di/containers/QualifiedHosts.ts
  • packages/lib/getUserAvailability.ts
  • packages/features/di/modules/QualifiedHosts.ts
  • packages/lib/getBusyTimes.test.ts
  • packages/features/di/modules/GetUserAvailability.ts
  • packages/features/bookings/lib/handleNewBooking.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/features/di/modules/BusyTimes.ts
  • packages/lib/bookings/filterHostsByLeadThreshold.ts
  • packages/features/di/containers/BookingLimits.ts
  • packages/features/di/containers/BusyTimes.ts
  • packages/features/di/modules/FilterHosts.ts
  • packages/features/di/containers/QualifiedHosts.ts
  • packages/lib/getUserAvailability.ts
  • packages/features/di/modules/QualifiedHosts.ts
  • packages/lib/getBusyTimes.test.ts
  • packages/features/di/modules/GetUserAvailability.ts
  • packages/features/bookings/lib/handleNewBooking.ts
🧠 Learnings (2)
📚 Learning: 2025-09-03T09:52:51.182Z
Learnt from: hariombalhara
PR: calcom/cal.com#23541
File: packages/features/bookings/lib/di/modules/RegularBookingServiceModule.ts:22-28
Timestamp: 2025-09-03T09:52:51.182Z
Learning: The IBookingServiceDependencies interface in packages/features/bookings/lib/handleNewBooking.ts contains 6 properties: cacheService, checkBookingAndDurationLimitsService, prismaClient, bookingRepository, featuresRepository, and checkBookingLimitsService. This interface is used by RegularBookingService and matches the depsMap structure in RegularBookingServiceModule.

Applied to files:

  • packages/features/di/containers/BookingLimits.ts
  • packages/features/bookings/lib/handleNewBooking.ts
📚 Learning: 2025-07-22T11:42:47.623Z
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.

Applied to files:

  • packages/features/di/modules/FilterHosts.ts
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Tests / Unit
  • GitHub Check: Type check / check-types
  • GitHub Check: Linters / lint
🔇 Additional comments (11)
packages/features/di/modules/FilterHosts.ts (1)

1-2: LGTM! Import paths correctly updated for the DI migration.

The import paths have been correctly updated from relative to package-scoped paths, reflecting the new location of this DI module in @calcom/features/di/modules/. The imported service remains in @calcom/lib/bookings/ as intended, with only the DI wiring moving to the features package.

packages/features/di/containers/BookingLimits.ts (2)

1-2: LGTM! Import paths updated correctly.

The DI_TOKENS import has been successfully moved from @calcom/lib to @calcom/features, and the type import for CheckBookingLimitsService is properly added. These changes align with the PR's objective of relocating the DI folder.


5-5: LGTM! Relative import path simplified.

The relative path has been correctly shortened to reflect the new location within the @calcom/features namespace.

packages/features/bookings/lib/handleNewBooking.ts (1)

50-52: LGTM! DI container imports updated consistently.

All three DI container imports have been correctly updated from @calcom/lib to @calcom/features namespace:

  • getCheckBookingAndDurationLimitsService (used at line 729)
  • getCacheService (used at line 616)
  • getLuckyUserService (used at line 946)

These changes align with the PR's objective of relocating the DI infrastructure to the features package.

packages/features/di/modules/QualifiedHosts.ts (1)

1-11: LGTM! Import paths correctly updated for the refactor.

The import paths have been properly updated to reflect the DI module migration from @calcom/lib to @calcom/features. The service implementations correctly remain in @calcom/lib/bookings/ while the DI infrastructure uses relative imports within the new features/di location.

packages/features/di/containers/QualifiedHosts.ts (1)

1-18: LGTM! Container imports correctly migrated.

The DI_TOKENS import has been properly updated to reference @calcom/features/di/tokens, and the type import for QualifiedHostsService now uses an absolute path to @calcom/lib/bookings/, maintaining consistency with the module file. The container logic remains unchanged and correct.

packages/features/di/containers/BusyTimes.ts (1)

1-4: Import path updates are correct.

The changes properly reflect the refactor:

  • DI_TOKENS now imported from @calcom/features/di/tokens (moved location)
  • BusyTimesService type imported from @calcom/lib/getBusyTimes (service implementation remains in lib)
packages/features/di/modules/BusyTimes.ts (1)

1-2: Import path updates are correct.

The migration from relative imports to @calcom/lib/getBusyTimes aligns with the refactor objective. Service implementations remain in the lib package while DI wiring moves to features.

packages/lib/getUserAvailability.ts (1)

7-7: BusyTimes container import correctly updated.

The import path change from ./di/containers/BusyTimes to @calcom/features/di/containers/BusyTimes properly reflects the container's new location. The usage at line 446 remains unchanged, ensuring no functional impact.

packages/lib/getBusyTimes.test.ts (1)

6-6: Test import correctly updated to new container location.

The import path change from ./di/containers/BusyTimes to @calcom/features/di/containers/BusyTimes aligns with the refactor. Test logic and assertions remain unchanged, ensuring the tests continue to validate the same behavior.

packages/lib/bookings/filterHostsByLeadThreshold.ts (1)

1-1: Import path resolves correctly The module @calcom/features/di/containers/LuckyUser exists and exports getLuckyUserService.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2025

E2E results are ready!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants