Skip to content

chore: deprecates dbWatchers and set default value to false #35981

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 5 commits into from
May 14, 2025

Conversation

ggazzo
Copy link
Member

@ggazzo ggazzo commented May 13, 2025

https://rocketchat.atlassian.net/browse/ARCH-1602

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments


This pull request updates the Rocket.Chat repository by modifying the default behavior of database watchers. The changes are made in the packages/models/src/index.ts file. The logic is adjusted so that database watchers are now disabled by default in more scenarios, particularly in production environments where the DISABLE_DB_WATCHERS environment variable is not set or is not explicitly set to 'no' or 'false'. Additionally, a console warning is introduced to alert users when watchers are active, highlighting their deprecation. The source branch for this change is chore/deprecate-streamhub-oplog-changestreams, and it targets the develop branch.

Copy link
Contributor

dionisio-bot bot commented May 13, 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 May 13, 2025

🦋 Changeset detected

Latest commit: 93dcbbd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/models Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/instance-status Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/network-broker Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/license Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

kodus-ai bot commented May 13, 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.

export const dbWatchersDisabled =
(process.env.NODE_ENV === 'production' && ['yes', 'true'].includes(disabledEnvVar)) ||
(process.env.NODE_ENV !== 'production' && !['no', 'false'].includes(disabledEnvVar));
export const dbWatchersDisabled = !['no', 'false'].includes(disabledEnvVar);
Copy link

Choose a reason for hiding this comment

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

kody code-review Potential Issues high

// By default, DB watchers are disabled unless DISABLE_DB_WATCHERS is 'no' or 'false'.
// Note: This changes previous behavior where, in production, watchers could be enabled
// by default if DISABLE_DB_WATCHERS was not 'yes' or 'true'.
export const dbWatchersDisabled = !['no', 'false'].includes(disabledEnvVar);

The updated logic for dbWatchersDisabled changes the default behavior in production environments. Previously, if DISABLE_DB_WATCHERS was unset or not 'yes'/'true', watchers were enabled in production. With the new logic, if DISABLE_DB_WATCHERS is not 'no' or 'false' (e.g., it's unset), watchers will be disabled. This shift to 'disabled by default' in such production scenarios could lead to unexpected behavior if parts of the system rely on the old default. Please verify this change is intended and its impact is fully understood. Consider adding a comment to clarify the new default behavior and its difference from the past.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

@ggazzo ggazzo force-pushed the chore/deprecate-streamhub-oplog-changestreams branch from 9332fbf to 3cc40ed Compare May 13, 2025 12:48
@ggazzo ggazzo added this to the 7.7.0 milestone May 13, 2025
Copy link

kodus-ai bot commented May 13, 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.

@@ -531,7 +531,7 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
REPORTER_JIRA_ROCKETCHAT_API_KEY: ${{ secrets.REPORTER_JIRA_ROCKETCHAT_API_KEY }}

test-ui-ee-no-watcher:
test-ui-ee-watcher:
Copy link

Choose a reason for hiding this comment

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

kody code-review Potential Issues critical

  test-ui-ee-watcher:

The job test-ui-ee-no-watcher has been renamed to test-ui-ee-watcher on line 534. This requires updating all references to this job's results throughout the workflow. Specifically, the tests-done job's script (around line 600 in the full file, not shown in the provided diff) appears to still reference ${{ needs.test-ui-ee-no-watcher.result }}. This reference must be changed to ${{ needs.test-ui-ee-watcher.result }} to prevent runtime errors when the workflow attempts to access the result of a dependency that no longer exists under that name in its needs context.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

Copy link
Contributor

github-actions bot commented May 13, 2025

PR Preview Action v1.6.1

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

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

Copy link

kodus-ai bot commented May 13, 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.

@ggazzo ggazzo changed the title chore: invert dbWatchersDisabled default value chore: deprecates dbWatchers and set default value to false May 13, 2025
@ggazzo ggazzo marked this pull request as ready for review May 13, 2025 13:00
@ggazzo ggazzo requested a review from a team as a code owner May 13, 2025 13:00
Copy link

codecov bot commented May 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.72%. Comparing base (3382ed8) to head (93dcbbd).
Report is 14 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #35981      +/-   ##
===========================================
+ Coverage    64.66%   64.72%   +0.06%     
===========================================
  Files         3244     3247       +3     
  Lines        95397    95433      +36     
  Branches     17852    17904      +52     
===========================================
+ Hits         61684    61768      +84     
+ Misses       30819    30762      -57     
- Partials      2894     2903       +9     
Flag Coverage Δ
e2e 58.42% <ø> (+0.21%) ⬆️
unit 71.92% <ø> (-0.02%) ⬇️

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.

Copy link

kodus-ai bot commented May 13, 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 May 14, 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.

@sampaiodiego sampaiodiego added the stat: QA assured Means it has been tested and approved by a company insider label May 14, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label May 14, 2025
@ggazzo ggazzo merged commit 0c3ac1f into develop May 14, 2025
53 of 55 checks passed
@ggazzo ggazzo deleted the chore/deprecate-streamhub-oplog-changestreams branch May 14, 2025 19:13
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