Skip to content

Conversation

@KevLehman
Copy link
Member

@KevLehman KevLehman commented Jan 15, 2026

Proposed changes (including videos or screenshots)

https://rocketchat.atlassian.net/browse/CORE-1715

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Chores
    • Standardized logging across federation and enterprise components to use structured messages with consistent fields.
    • Unified error-variable naming and improved contextual details in error logs for better observability.
    • Minor wording fixes in logged messages for consistency.
    • Added a small validation that tightens room-creation checks to surface errors earlier.

✏️ Tip: You can customize this high-level summary in your review settings.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jan 15, 2026

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

@changeset-bot
Copy link

changeset-bot bot commented Jan 15, 2026

⚠️ No Changeset found

Latest commit: 2da7be0

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

@KevLehman KevLehman added this to the 8.1.0 milestone Jan 15, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 15, 2026

Walkthrough

This PR standardizes logger usage across the codebase by converting plain string/positional logger calls to structured object logs (with msg and contextual fields) and renames catch variables from error to err for consistency; one assertion was added in federation DM room creation.

Changes

Cohort / File(s) Summary
Livechat & priorities
apps/meteor/ee/app/livechat-enterprise/server/api/lib/priorities.ts
Replaced string logger with structured object { msg, priorityId, result } on Mongo update failure.
LDAP manager
apps/meteor/ee/server/lib/ldap/Manager.ts
Converted multiple logger calls to structured { msg, ...context } payloads (channel, username, roomIds, etc.).
Merge contacts & startup
apps/meteor/ee/server/patches/mergeContacts.ts, apps/meteor/ee/server/startup/federation.ts
Switched debug/error logs to structured objects; renamed catch variable to err.
Email IMAP interceptor
apps/meteor/server/email/IMAPInterceptor.ts
Replaced string template logs with structured { msg, user, inboxId, err } across ready/error/retry paths.
Message hooks
apps/meteor/server/services/messages/hooks/BeforeSaveBadWords.ts
Renamed catch var to err, fixed typo ("Erorr" → "Error"), and moved logs to structured { msg, err }.
Settings / fingerprint
apps/meteor/server/settings/misc.ts
Converted two-argument logger calls to single structured object with msg and fingerprint.
Federation — core & events
ee/packages/federation-matrix/src/FederationMatrix.ts, .../events/edu.ts, .../events/member.ts, .../events/message.ts, .../events/reaction.ts
Standardized debug/warn/error logs to structured objects, renamed catch vars to err; added assertion in createDirectMessageRoom for creator presence.
Federation API & media service
ee/packages/federation-matrix/src/api/_matrix/invite.ts, ee/packages/federation-matrix/src/services/MatrixMediaService.ts
Converted error logs to structured objects { msg, err } and normalized catch variable naming.
License emitter
ee/packages/license/src/events/emitter.ts
Renamed catch vars to err and enhanced error logs to include contextual fields (module, behavior, limit) in structured payloads.

Sequence Diagram(s)

(omitted — changes are logging-format and minor assertion; no multi-component control-flow modifications requiring visualization)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • sampaiodiego
  • ggazzo
  • ricardogarim

Poem

🐰 I hopped through logs to make them bright,
Swapping strings for objects, tidy and light,
"msg" leads the chorus, context in tow,
Errors now whisper the things we should know.
Hooray — the rabbit leaves cleaner trails tonight! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: Adapt logs to new object format' accurately summarizes the main change—converting logging calls from string-based to structured object payloads across multiple files.
Linked Issues check ✅ Passed The PR addresses the core objective of CORE-1715 to adapt server logs to a new structured object format. All changes consistently convert logging calls to include msg fields and contextual data.
Out of Scope Changes check ✅ Passed Changes are tightly scoped to logging format updates. Minor additions like variable renames (error to err) and one new assertion in FederationMatrix are consistent with standardizing the logging pattern.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/logs-to-new-format

🧹 Recent nitpick comments
apps/meteor/ee/server/lib/ldap/Manager.ts (1)

225-226: Optional: Consider converting remaining string-interpolated logs for consistency.

Several other log statements in this file still use string interpolation (e.g., lines 225, 267-269, 468) while this PR converts only some logs to structured format. For full consistency, these could be addressed in a follow-up.

Example for this line:

-			logger.debug(`Advanced Sync failed for user: ${dn}`);
+			logger.debug({ msg: 'Advanced Sync failed for user', dn });

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira 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 fe50926 and 35a7cb9.

📒 Files selected for processing (1)
  • apps/meteor/ee/server/lib/ldap/Manager.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

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

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/ee/server/lib/ldap/Manager.ts
🧠 Learnings (1)
📚 Learning: 2025-10-28T16:53:42.761Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.

Applied to files:

  • apps/meteor/ee/server/lib/ldap/Manager.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (4)
apps/meteor/ee/server/lib/ldap/Manager.ts (4)

362-383: LGTM!

The structured logging changes in createRoomForSync are well-formed and include appropriate contextual properties (channel, roomOwner) for debugging LDAP channel synchronization issues.


440-450: LGTM!

The structured logging changes provide useful context for debugging channel sync operations, including roomId, username, and userChannelName where appropriate.


542-542: LGTM!

The structured log appropriately includes the unmappedLdapGroups array, which will be valuable for administrators troubleshooting LDAP group mapping issues.


703-703: LGTM!

The structured log includes the user count which provides useful metrics for LDAP synchronization monitoring.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 56.00000% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.63%. Comparing base (a9bbb5e) to head (2da7be0).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #38207      +/-   ##
===========================================
- Coverage    70.64%   70.63%   -0.01%     
===========================================
  Files         3136     3136              
  Lines       108638   108638              
  Branches     19538    19558      +20     
===========================================
- Hits         76743    76739       -4     
- Misses       29887    29891       +4     
  Partials      2008     2008              
Flag Coverage Δ
e2e 60.31% <ø> (+0.02%) ⬆️
e2e-api 47.97% <16.66%> (-1.08%) ⬇️
unit 71.70% <85.71%> (+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.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

📦 Docker Image Size Report

➡️ Changes

Service Current Baseline Change Percent
sum of all images 0B 0B 0B
account-service 0B 0B 0B
authorization-service 0B 0B 0B
ddp-streamer-service 0B 0B 0B
omnichannel-transcript-service 0B 0B 0B
presence-service 0B 0B 0B
queue-worker-service 0B 0B 0B
rocketchat 0B 0B 0B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 21:56", "12/08 20:15", "12/09 22:17", "12/10 23:26", "12/11 21:56", "12/12 22:45", "12/13 01:34", "12/15 22:31", "12/16 22:18", "12/17 21:04", "12/18 23:12", "12/19 23:27", "12/20 21:03", "12/22 18:54", "12/23 16:16", "12/24 19:38", "12/25 17:51", "12/26 13:18", "12/29 19:01", "12/30 20:52", "01/17 12:03 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.00]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "queue-worker-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "rocketchat" [0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.00]
Loading

Statistics (last 30 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.4GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 0B
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-38207
  • Baseline: develop
  • Timestamp: 2026-01-17 12:03:46 UTC
  • Historical data points: 30

Updated: Sat, 17 Jan 2026 12:03:46 GMT

@KevLehman KevLehman marked this pull request as ready for review January 15, 2026 19:41
@KevLehman KevLehman requested review from a team as code owners January 15, 2026 19:41
@KevLehman KevLehman added the stat: QA assured Means it has been tested and approved by a company insider label Jan 15, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Jan 15, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 15 files

@kodiakhq kodiakhq bot merged commit a7b87fe into develop Jan 17, 2026
76 of 78 checks passed
@kodiakhq kodiakhq bot deleted the chore/logs-to-new-format branch January 17, 2026 15:02
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.

3 participants