Skip to content

refactor: convert findQualifiedHostsWithDelegationCredentials to service class with DI #22974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Aug 11, 2025

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Aug 8, 2025

refactor: rename DI files to CamelCase and update imports

Summary

Renamed all 29 files in packages/lib/di from kebab-case to CamelCase naming convention and updated corresponding import statements throughout the codebase. This change improves consistency with TypeScript naming conventions.

Key changes:

  • Containers: available-slots.tsAvailableSlots.ts, booking-limits.tsBookingLimits.ts, etc. (9 files)
  • Modules: busy-times.tsBusyTimes.ts, check-booking-limits.tsCheckBookingLimits.ts, etc. (20 files)
  • Import updates: Updated import statements in ~25+ files across apps, packages, and tests

During implementation, resolved merge conflicts particularly around calAIPhone imports and trpc utility files.

Review & Testing Checklist for Human

  • Verify import completeness: Search codebase for any remaining references to old kebab-case DI file names (e.g., grep -r "di/containers/[a-z-]" packages/ apps/ and grep -r "di/modules/[a-z-]" packages/ apps/)
  • Run type checking: Execute yarn type-check:ci --force to ensure no TypeScript compilation errors were introduced by the import changes
  • Test DI functionality: Verify that key features using the DI system (booking flows, availability checking, qualified hosts) work correctly in a local environment
  • Review merge conflict resolution: Check that the resolution of conflicts in get-inbound-dynamic-variables.ts and slots/util.ts preserved both remote changes and CamelCase naming correctly

Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    subgraph "packages/lib/di"
        DC["containers/<br/>AvailableSlots.ts<br/>BookingLimits.ts<br/>QualifiedHosts.ts<br/>etc. (9 files)"]:::major-edit
        DM["modules/<br/>BusyTimes.ts<br/>CheckBookingLimits.ts<br/>FilterHosts.ts<br/>etc. (20 files)"]:::major-edit
    end
    
    subgraph "Import References"
        T1["test/lib/<br/>getSchedule.test.ts<br/>checkBookingLimits.test.ts"]:::minor-edit
        F1["features/bookings/<br/>handleNewBooking/loadUsers.ts"]:::minor-edit
        T2["trpc/server/routers/<br/>viewer/slots/util.ts"]:::minor-edit
        I1["features/insights/<br/>server/trpc-router.ts"]:::minor-edit
    end
    
    subgraph "Merge Conflicts"
        MC1["apps/web/pages/api/<br/>get-inbound-dynamic-variables.ts"]:::minor-edit
        MC2["packages/trpc/server/<br/>routers/viewer/slots/util.ts"]:::minor-edit
    end
    
    DC --> T1
    DC --> F1
    DM --> T2
    DM --> I1
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit
        L3[Context/No Edit]:::context
    end

classDef major-edit fill:#90EE90
classDef minor-edit fill:#87CEEB  
classDef context fill:#FFFFFF
Loading

Notes

  • This refactoring maintains all existing functionality while improving code consistency
  • Merge conflicts were resolved to preserve both remote changes (like calAIPhone imports) and the new CamelCase file naming
  • The change affects the dependency injection system but should be transparent to end users
  • Session requested by morgan@cal.com: https://app.devin.ai/sessions/49006f9b898d4b1db012bfb2e3ee3a60

…ice class with DI

- Create QualifiedHostsService class following UserAvailabilityService pattern
- Add IQualifiedHostsService interface with prisma and bookingRepo dependencies
- Create DI module and container for qualified hosts service
- Update filterHostsBySameRoundRobinHost to accept prisma as parameter
- Update all usage sites to use the new service:
  - loadAndValidateUsers.ts
  - slots/util.ts
  - test mocks in _post.test.ts
- Maintain backward compatibility with original function export
- Fix type issues in team properties (rrResetInterval, rrTimestampBasis)

Co-Authored-By: morgan@cal.com <morgan@cal.com>
Copy link
Contributor Author

🤖 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'.
  • 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

Copy link
Contributor

coderabbitai bot commented Aug 8, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Join our Discord community for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

…rameter

- Add missing prisma parameter to all test function calls
- Resolves unit test failure caused by function signature change

Co-Authored-By: morgan@cal.com <morgan@cal.com>
Copy link

vercel bot commented Aug 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Aug 11, 2025 11:46am
cal-eu ⬜️ Ignored (Inspect) Aug 11, 2025 11:46am

- Import PrismaClient type instead of using unknown
- Fix type compatibility for BookingRepository constructor
- Update test mocks to use proper BookingRepository type
- Ensure all DI dependencies are properly typed

Co-Authored-By: morgan@cal.com <morgan@cal.com>
@ThyMinimalDev ThyMinimalDev marked this pull request as ready for review August 8, 2025 12:10
@ThyMinimalDev ThyMinimalDev requested review from a team as code owners August 8, 2025 12:10
@graphite-app graphite-app bot requested a review from a team August 8, 2025 12:10
@dosubot dosubot bot added api area: API, enterprise API, access token, OAuth platform Anything related to our platform plan 💻 refactor labels Aug 8, 2025
Copy link

graphite-app bot commented Aug 8, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (08/08/25)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link
Contributor

github-actions bot commented Aug 8, 2025

E2E results are ready!

Comment on lines 12 to 13
filterHostsService: new FilterHostsService(bookingRepository),
});
Copy link
Contributor

Choose a reason for hiding this comment

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

need to fix this

@ThyMinimalDev ThyMinimalDev marked this pull request as draft August 8, 2025 19:20
- Rename all files in packages/lib/di from kebab-case to CamelCase
- Update 22 external files with import statements to use new file names
- Update internal DI module files with corrected imports
- Maintain consistency with TypeScript naming conventions

Co-Authored-By: morgan@cal.com <morgan@cal.com>
@devin-ai-integration devin-ai-integration bot force-pushed the devin/qualified-hosts-service-1754645117 branch from d655aa2 to c3d360e Compare August 11, 2025 07:37
devin-ai-integration bot and others added 2 commits August 11, 2025 08:49
- Remove obsolete mock for old function module
- Keep correct mock for new DI container
- Resolves CI unit test failures

Co-Authored-By: morgan@cal.com <morgan@cal.com>
Co-Authored-By: morgan@cal.com <morgan@cal.com>
anikdhabal and others added 9 commits August 11, 2025 14:41
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
* --init

* address change requests

* adding further changes

* address feedback

* further changes

* further clean-up

* clean up

* fix module import and others

* add guards

* remove unnecessary comments

* remove unnecessary comments

* cleanup

* sort coderabbig suggestions

* improve check

* chore: bump platform libraries

---------

Co-authored-by: Lauris Skraucis <lauris.skraucis@gmail.com>
Co-authored-by: supalarry <laurisskraucis@gmail.com>
@CLAassistant
Copy link

CLAassistant commented Aug 11, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
5 out of 6 committers have signed the CLA.

✅ sahitya-chandra
✅ ThyMinimalDev
✅ anikdhabal
✅ hbjORbj
✅ emrysal
❌ kumarayushkumar
You have signed the CLA already but the status is still pending? Let us recheck it.

@ThyMinimalDev ThyMinimalDev marked this pull request as ready for review August 11, 2025 11:46
@ThyMinimalDev ThyMinimalDev enabled auto-merge (squash) August 11, 2025 12:11
@ThyMinimalDev ThyMinimalDev merged commit ebeb008 into main Aug 11, 2025
57 of 62 checks passed
@ThyMinimalDev ThyMinimalDev deleted the devin/qualified-hosts-service-1754645117 branch August 11, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api area: API, enterprise API, access token, OAuth platform Anything related to our platform plan ready-for-e2e 💻 refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants