refactor: move @calcom/lib/di folder to @calcom/features#24199
refactor: move @calcom/lib/di folder to @calcom/features#24199keithwillcode merged 7 commits intomainfrom
Conversation
WalkthroughThe 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)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
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.
📒 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 useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
packages/lib/bookings/filterHostsByLeadThreshold.test.tspackages/features/di/bookings/containers/InstantBookingCreateService.container.tspackages/features/di/containers/NoSlotsNotification.tspackages/features/di/containers/BusyTimes.tspackages/features/di/containers/BookingLimits.tspackages/features/di/modules/CheckBookingLimits.tspackages/features/di/containers/GetUserAvailability.tspackages/features/di/modules/Attribute.tspackages/features/di/modules/RoutingFormResponse.tspackages/features/di/bookings/modules/RecurringBookingService.module.tsapps/web/test/lib/getSchedule/calendarEvents.test.tsapps/api/v1/pages/api/availability/_get.tspackages/lib/intervalLimits/server/getBusyTimesFromLimits.tsapps/web/test/lib/getSchedule/selectedSlots.test.tspackages/features/bookings/lib/handleNewBooking/loadAndValidateUsers.tspackages/features/di/modules/Membership.tspackages/features/insights/server/trpc-router.tspackages/lib/server/getLuckyUser.test.tspackages/features/di/containers/AvailableSlots.tspackages/trpc/server/routers/viewer/slots/util.tsapps/api/v1/test/lib/bookings/_post.test.tspackages/lib/server/getLuckyUser.integration-test.tspackages/features/di/bookings/containers/RecurringBookingService.container.tspackages/features/bookings/lib/handleNewBooking.tsapps/web/pages/api/get-inbound-dynamic-variables.tspackages/features/di/modules/LuckyUser.tspackages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.tspackages/prisma/prisma.module.tspackages/features/di/modules/Features.tspackages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.tspackages/features/di/modules/Booking.tspackages/features/ee/round-robin/roundRobinReassignment.tspackages/features/di/containers/QualifiedHosts.tsapps/web/test/lib/getSchedule.test.tspackages/trpc/server/routers/viewer/availability/user.handler.tspackages/features/di/modules/Team.tspackages/features/di/modules/Ooo.tspackages/features/redis/di/redisModule.tspackages/features/di/modules/Host.tspackages/trpc/server/routers/viewer/teams/getMemberAvailability.handler.tspackages/trpc/server/routers/viewer/slots/getSchedule.handler.tsapps/web/test/lib/getSchedule/restrictionSchedule.test.tsapps/web/test/lib/getSchedule/delegation-credential.test.tsapps/web/test/lib/checkBookingLimits.test.tspackages/features/di/containers/FilterHosts.tsapps/web/test/lib/getSchedule/futureLimit.timezone.test.tspackages/features/di/bookings/modules/RegularBookingService.module.tspackages/features/di/modules/SelectedSlots.tsapps/api/v1/pages/api/slots/_get.tspackages/features/di/modules/EventType.tspackages/trpc/server/routers/viewer/routing-forms/findTeamMembersMatchingAttributeLogicOfRoute.handler.tspackages/features/di/containers/Cache.tspackages/features/di/containers/InsightsRouting.tspackages/features/di/containers/InsightsBooking.tspackages/features/di/bookings/modules/InstantBookingCreateService.module.tspackages/features/di/modules/User.tspackages/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.tspackages/features/di/bookings/containers/InstantBookingCreateService.container.tspackages/features/di/containers/NoSlotsNotification.tspackages/features/di/containers/BusyTimes.tspackages/features/di/containers/BookingLimits.tspackages/features/di/modules/CheckBookingLimits.tspackages/features/di/containers/GetUserAvailability.tspackages/features/di/modules/Attribute.tspackages/features/di/modules/RoutingFormResponse.tspackages/features/di/bookings/modules/RecurringBookingService.module.tsapps/web/test/lib/getSchedule/calendarEvents.test.tsapps/api/v1/pages/api/availability/_get.tspackages/lib/intervalLimits/server/getBusyTimesFromLimits.tsapps/web/test/lib/getSchedule/selectedSlots.test.tspackages/features/bookings/lib/handleNewBooking/loadAndValidateUsers.tspackages/features/di/modules/Membership.tspackages/features/insights/server/trpc-router.tspackages/lib/server/getLuckyUser.test.tspackages/features/di/containers/AvailableSlots.tspackages/trpc/server/routers/viewer/slots/util.tsapps/api/v1/test/lib/bookings/_post.test.tspackages/lib/server/getLuckyUser.integration-test.tspackages/features/di/bookings/containers/RecurringBookingService.container.tspackages/features/bookings/lib/handleNewBooking.tsapps/web/pages/api/get-inbound-dynamic-variables.tspackages/features/di/modules/LuckyUser.tspackages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.tspackages/prisma/prisma.module.tspackages/features/di/modules/Features.tspackages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.tspackages/features/di/modules/Booking.tspackages/features/ee/round-robin/roundRobinReassignment.tspackages/features/di/containers/QualifiedHosts.tsapps/web/test/lib/getSchedule.test.tspackages/trpc/server/routers/viewer/availability/user.handler.tspackages/features/di/modules/Team.tspackages/features/di/modules/Ooo.tspackages/features/redis/di/redisModule.tspackages/features/di/modules/Host.tspackages/trpc/server/routers/viewer/teams/getMemberAvailability.handler.tspackages/trpc/server/routers/viewer/slots/getSchedule.handler.tsapps/web/test/lib/getSchedule/restrictionSchedule.test.tsapps/web/test/lib/getSchedule/delegation-credential.test.tsapps/web/test/lib/checkBookingLimits.test.tspackages/features/di/containers/FilterHosts.tsapps/web/test/lib/getSchedule/futureLimit.timezone.test.tspackages/features/di/bookings/modules/RegularBookingService.module.tspackages/features/di/modules/SelectedSlots.tsapps/api/v1/pages/api/slots/_get.tspackages/features/di/modules/EventType.tspackages/trpc/server/routers/viewer/routing-forms/findTeamMembersMatchingAttributeLogicOfRoute.handler.tspackages/features/di/containers/Cache.tspackages/features/di/containers/InsightsRouting.tspackages/features/di/containers/InsightsBooking.tspackages/features/di/bookings/modules/InstantBookingCreateService.module.tspackages/features/di/modules/User.tspackages/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.tspackages/features/di/bookings/containers/InstantBookingCreateService.container.tspackages/features/di/containers/NoSlotsNotification.tspackages/features/di/containers/BusyTimes.tspackages/features/di/containers/BookingLimits.tspackages/features/di/modules/CheckBookingLimits.tspackages/features/di/containers/GetUserAvailability.tspackages/features/di/modules/Attribute.tspackages/features/di/modules/RoutingFormResponse.tspackages/features/di/bookings/modules/RecurringBookingService.module.tsapps/web/test/lib/getSchedule/calendarEvents.test.tsapps/api/v1/pages/api/availability/_get.tspackages/lib/intervalLimits/server/getBusyTimesFromLimits.tsapps/web/test/lib/getSchedule/selectedSlots.test.tspackages/features/bookings/lib/handleNewBooking/loadAndValidateUsers.tspackages/features/di/modules/Membership.tspackages/features/insights/server/trpc-router.tspackages/lib/server/getLuckyUser.test.tspackages/features/di/containers/AvailableSlots.tspackages/trpc/server/routers/viewer/slots/util.tsapps/api/v1/test/lib/bookings/_post.test.tspackages/lib/server/getLuckyUser.integration-test.tspackages/features/di/bookings/containers/RecurringBookingService.container.tspackages/features/bookings/lib/handleNewBooking.tsapps/web/pages/api/get-inbound-dynamic-variables.tspackages/features/di/modules/LuckyUser.tspackages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.tspackages/prisma/prisma.module.tspackages/features/di/modules/Features.tspackages/features/bookings/lib/handleNewBooking/ensureAvailableUsers.tspackages/features/di/modules/Booking.tspackages/features/ee/round-robin/roundRobinReassignment.tspackages/features/di/containers/QualifiedHosts.tsapps/web/test/lib/getSchedule.test.tspackages/trpc/server/routers/viewer/availability/user.handler.tspackages/features/di/modules/Team.tspackages/features/di/modules/Ooo.tspackages/features/redis/di/redisModule.tspackages/features/di/modules/Host.tspackages/trpc/server/routers/viewer/teams/getMemberAvailability.handler.tspackages/trpc/server/routers/viewer/slots/getSchedule.handler.tsapps/web/test/lib/getSchedule/restrictionSchedule.test.tsapps/web/test/lib/getSchedule/delegation-credential.test.tsapps/web/test/lib/checkBookingLimits.test.tspackages/features/di/containers/FilterHosts.tsapps/web/test/lib/getSchedule/futureLimit.timezone.test.tspackages/features/di/bookings/modules/RegularBookingService.module.tspackages/features/di/modules/SelectedSlots.tsapps/api/v1/pages/api/slots/_get.tspackages/features/di/modules/EventType.tspackages/trpc/server/routers/viewer/routing-forms/findTeamMembersMatchingAttributeLogicOfRoute.handler.tspackages/features/di/containers/Cache.tspackages/features/di/containers/InsightsRouting.tspackages/features/di/containers/InsightsBooking.tspackages/features/di/bookings/modules/InstantBookingCreateService.module.tspackages/features/di/modules/User.tspackages/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.tspackages/features/di/bookings/containers/RecurringBookingService.container.tspackages/features/bookings/lib/handleNewBooking.tspackages/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 newfeatures/distructure and keeps module wiring intact.packages/features/di/modules/RoutingFormResponse.ts (1)
1-1: Import path update verifiedNo remaining references to
@calcom/lib/di/found;DI_TOKENSexport confirmed inpackages/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 -20packages/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_TOKENShas been updated from@calcom/lib/di/tokensto@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_TOKENShas been updated from@calcom/lib/di/tokensto@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
getLuckyUserServicehas been correctly updated from@calcom/lib/di/containers/LuckyUserto@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
getCheckBookingLimitsServicehas been correctly updated from@calcom/lib/di/containers/BookingLimitsto@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
getAvailableSlotsServicehas 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
getCheckBookingLimitsServiceandgetBusyTimesServiceimport 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/containersto@calcom/features/di/containersis 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
getNoSlotsNotificationServicenow 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
getUserAvailabilityServicenow 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
getLuckyUserServicenow 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_TOKENSis exported from@calcom/features/di/tokensand no remaining@calcom/lib/diimports exist.packages/features/redis/di/redisModule.ts (1)
1-2: Approve DI import path refactorAll old
@calcom/lib/diimports have been replaced with@calcom/features/diacross 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_TOKENSfrom@calcom/features/di/tokens, and no@calcom/lib/direferences remain.packages/features/di/modules/Features.ts (1)
2-2: Approve import path updateThe module
@calcom/features/di/tokensexists (packages/features/di/tokens.tsexportsDI_TOKENS), and no remaining@calcom/lib/di/imports were found. LGTM.
There was a problem hiding this comment.
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/getUserAvailabilityaligns with the refactor objective of moving DI infrastructure to@calcom/featureswhile 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.
📒 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 useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
packages/features/di/modules/BusyTimes.tspackages/lib/bookings/filterHostsByLeadThreshold.tspackages/features/di/containers/BookingLimits.tspackages/features/di/containers/BusyTimes.tspackages/features/di/modules/FilterHosts.tspackages/features/di/containers/QualifiedHosts.tspackages/lib/getUserAvailability.tspackages/features/di/modules/QualifiedHosts.tspackages/lib/getBusyTimes.test.tspackages/features/di/modules/GetUserAvailability.tspackages/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.tspackages/lib/bookings/filterHostsByLeadThreshold.tspackages/features/di/containers/BookingLimits.tspackages/features/di/containers/BusyTimes.tspackages/features/di/modules/FilterHosts.tspackages/features/di/containers/QualifiedHosts.tspackages/lib/getUserAvailability.tspackages/features/di/modules/QualifiedHosts.tspackages/lib/getBusyTimes.test.tspackages/features/di/modules/GetUserAvailability.tspackages/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.tspackages/lib/bookings/filterHostsByLeadThreshold.tspackages/features/di/containers/BookingLimits.tspackages/features/di/containers/BusyTimes.tspackages/features/di/modules/FilterHosts.tspackages/features/di/containers/QualifiedHosts.tspackages/lib/getUserAvailability.tspackages/features/di/modules/QualifiedHosts.tspackages/lib/getBusyTimes.test.tspackages/features/di/modules/GetUserAvailability.tspackages/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.tspackages/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/libto@calcom/features, and the type import forCheckBookingLimitsServiceis 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/featuresnamespace.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/libto@calcom/featuresnamespace:
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/libto@calcom/features. The service implementations correctly remain in@calcom/lib/bookings/while the DI infrastructure uses relative imports within the newfeatures/dilocation.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 forQualifiedHostsServicenow 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_TOKENSnow imported from@calcom/features/di/tokens(moved location)BusyTimesServicetype 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/getBusyTimesaligns 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/BusyTimesto@calcom/features/di/containers/BusyTimesproperly 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/BusyTimesto@calcom/features/di/containers/BusyTimesaligns 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/LuckyUserexists and exportsgetLuckyUserService.
E2E results are ready! |
What does this PR do?
packages/lib/difolder topackages/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)
How should this be tested?