Skip to content

chore: Remove some omnichannel tech debt -2 #35854

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 22 commits into from
May 7, 2025
Merged

chore: Remove some omnichannel tech debt -2 #35854

merged 22 commits into from
May 7, 2025

Conversation

KevLehman
Copy link
Member

@KevLehman KevLehman commented Apr 22, 2025

Proposed changes (including videos or screenshots)

Removes 2 callbacks and replace them with patchfunctions

Use promise.all where applicable

Moved check calls to the meteor method calling the function, which should make easier to remove the meteor method at some point

Removed duplicated db calls for validation of data

Attempting new strategy: instead of find-check-delete, delete and then check. This reduces one DB call (no check) and uses the result from the delete call to check if the value was valid

Projections & types for projections

Removed unused file

Use ajv for department/id/agents endpoint

Issue(s)

https://rocketchat.atlassian.net/browse/CTZ-87

Steps to test or reproduce

Further comments


This pull request focuses on removing technical debt within the omnichannel components of the Rocket.Chat project. Key changes include:

  1. Type Safety and Validation Enhancements:

    • Added type validation for department agents endpoints and refined type definitions for department agent operations, improving type safety and removing redundant parameter checks.
    • Updated various Meteor methods (livechat:saveAgentInfo, livechat:addMonitor, livechat:removeMonitor, livechat:removeTag, livechat:removeUnit, livechat:saveTag) to include input validation using Meteor's check package, enhancing robustness against invalid inputs.
  2. Performance Improvements:

    • Refactored asynchronous operations in several files (livechat.ts, config.ts) to run concurrently using Promise.all, improving performance and code structure.
  3. Code Refactoring and Simplification:

    • Modified the LivechatDepartmentEE model to make the businessUnit parameter optional and extracted core query logic into a helper method, improving maintainability.
    • Refactored the findEnabledWithAgentsAndBusinessUnit method to reuse existing logic, reducing code duplication.
    • Updated REST API typings and validation schemas for Livechat department agents, introducing pagination support and correcting schema mismatches.
  4. Type Definitions and Static Analysis:

    • Enhanced type safety by adding explicit TypeScript types to database query results and modifying type definitions in various methods and models, aligning with TypeScript best practices.

These changes collectively aim to improve the performance, maintainability, and type safety of the omnichannel components in the Rocket.Chat codebase.

Copy link
Contributor

dionisio-bot bot commented Apr 22, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented Apr 22, 2025

⚠️ No Changeset found

Latest commit: 37c9f22

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Apr 22, 2025

PR Preview Action v1.6.1

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-35854/

Built to branch gh-pages at 2025-05-07 14:57 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link

codecov bot commented Apr 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.76%. Comparing base (af86fce) to head (37c9f22).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #35854      +/-   ##
===========================================
+ Coverage    64.59%   64.76%   +0.17%     
===========================================
  Files         3223     3072     -151     
  Lines        95227    91973    -3254     
  Branches     17845    17512     -333     
===========================================
- Hits         61511    59566    -1945     
+ Misses       30821    29659    -1162     
+ Partials      2895     2748     -147     
Flag Coverage Δ
e2e 58.10% <ø> (+<0.01%) ⬆️
unit 71.94% <ø> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@KevLehman KevLehman added this to the 7.7.0 milestone Apr 23, 2025
Base automatically changed from chore/todo to develop April 23, 2025 22:03
Copy link

kodus-ai bot commented Apr 24, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

Copy link

kodus-ai bot commented Apr 24, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

Copy link

kodus-ai bot commented Apr 24, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

Copy link

kodus-ai bot commented Apr 24, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

Copy link

kodus-ai bot commented Apr 24, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

Copy link

kodus-ai bot commented Apr 24, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@KevLehman KevLehman marked this pull request as ready for review April 24, 2025 21:36
@KevLehman KevLehman requested review from a team as code owners April 24, 2025 21:36
@KevLehman KevLehman added the stat: QA assured Means it has been tested and approved by a company insider label Apr 29, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Apr 29, 2025
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label May 7, 2025
@KevLehman KevLehman added the stat: ready to merge PR tested and approved waiting for merge label May 7, 2025
@kodiakhq kodiakhq bot merged commit 2f23765 into develop May 7, 2025
53 checks passed
@kodiakhq kodiakhq bot deleted the chore/todo-2 branch May 7, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants