Skip to content

Conversation

@d-gubert
Copy link
Member

@d-gubert d-gubert commented Nov 4, 2025

Proposed changes (including videos or screenshots)

Issue(s)

ARCH-1870

Steps to test or reproduce

Further comments

Example logline:

2025-11-06T23:58:12.653Z appsEngine:runtime:deno:54588e04-e779-45b4-85de-eb6d186fc859 Received message from subprocess { jsonrpc: '2.0', id: 'v6oghc7u9u', result: { value: { status: 200, content: null }, logs: { appId: '54588e04-e779-45b4-85de-eb6d186fc859', method: 'api:simple:get', entries: [ { caller: 'anonymous OR constructor -> apiHandler', severity: 'debug', method: 'api:simple:get', timestamp: 2025-11-06T23:58:12.653Z, args: [ "simple's api:simple:get is being executed...", { method: 'get', headers: { 'x-forwarded-host': 'localhost:3000', 'x-forwarded-proto': 'http', 'x-forwarded-port': '3000', 'x-forwarded-for': '127.0.0.1', accept: '*/*', 'user-agent': 'curl/8.11.1', host: 'localhost:3000', connection: 'keep-alive' }, query: { alo: 'marciano', count: [ '1', '2' ] }, params: {}, content: {}, privateHash: null, user: null } ] }, { caller: 'anonymous OR constructor -> apiHandler', severity: 'debug', method: 'api:simple:get', timestamp: 2025-11-06T23:58:12.653Z, args: [ "simple's api:simple:get was successfully executed." ] } ], startTime: 2025-11-06T23:58:12.652Z, endTime: 2025-11-06T23:58:12.653Z, totalTime: 1, _createdAt: 2025-11-06T23:58:12.653Z } } }

Summary by CodeRabbit

Summary by CodeRabbit

Release Notes

  • Chores
    • Improved internal debug logging to show deeper, more readable representations of complex values across the runtime.
    • Standardized logging for subprocess communication and bridge/message handling for clearer diagnostics.
  • Bug Fixes
    • Fixed truncated object inspection in debug output so nested data is visible for troubleshooting.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Nov 4, 2025

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 Nov 4, 2025

🦋 Changeset detected

Latest commit: 3f60aee

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

This PR includes changesets to release 42 packages
Name Type
@rocket.chat/apps-engine Patch
@rocket.chat/meteor Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/core-typings Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/rest-typings Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core 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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

Added deeper object inspection for debug logs in the Deno runtime and removed the debug parameter from ProcessMessenger's constructor; several debug statements now log inspected string outputs instead of using object format specifiers.

Changes

Cohort / File(s) Change Summary
Deno runtime logging
packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts
Imported util.inspect, added a local inspect helper (depth 5), and replaced %O object format specifiers with %s plus inspect(...) across debug logs (subprocess start, send/receive messages, accessor/bridge handling, error reporting, stderr metrics parsing).
Process messenger constructor
packages/apps-engine/src/server/runtime/deno/ProcessMessenger.ts
Removed debug parameter from ProcessMessenger constructor (constructor(private readonly debug: debug.Debugger)constructor()); removed debug usage in strategySend so sending no longer requires a debug logger.
Changeset
.changeset/real-hotels-sniff.md
Added a changeset entry describing the apps-engine debug logging depth fix (patch-level updates).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Runtime as AppsEngineDenoRuntime
  participant Messenger as ProcessMessenger
  participant Subproc as Subprocess

  Note over Runtime,Messenger `#D3E4CD`: Initialization (constructor change)
  Runtime->>Messenger: new ProcessMessenger()  -- no debug arg
  Messenger-->>Runtime: initialized

  Note over Runtime,Subproc `#F7F3D7`: Sending a message
  Runtime->>Runtime: inspect(payload) (depth=5)
  Runtime->>Messenger: send(inspectedString)
  Messenger->>Subproc: write(message)

  Note over Subproc,Runtime `#F3DDE6`: Receiving a message
  Subproc-->>Messenger: message
  Messenger-->>Runtime: message
  Runtime->>Runtime: inspect(received) and debug(...)  -- logs use inspected strings
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify all replaced debug statements use inspect(...) consistently and the depth=5 helper is applied uniformly.
  • Confirm ProcessMessenger behavior remains correct without the debug dependency (ensure no required side effects were removed).
  • Check tests and compilation for the updated constructor signature and any callers.

Suggested reviewers

  • ggazzo
  • scuciatto

Poem

🐰 I hopped through logs with shining eyes,
Dug five-deep roots where object truth lies,
Turned opaque blobs into strings that gleam,
Now debug carrots sparkle in a stream —
Hooray, inspected crumbs for the dream! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive The PR includes a constructor signature change to ProcessMessenger that removes the debug parameter, which is not directly mentioned in the linked issue objective but supports the logging improvement goal. Clarify whether removing the debug parameter from ProcessMessenger's constructor and eliminating logging from strategySend aligns with the intended scope of improving debug depth, or if this represents unintended refactoring.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly describes the main fix: improving debug log expansion depth for objects in apps-engine, which directly matches the changeset's focus on enhancing object inspection depth in logging.
Linked Issues check ✅ Passed The code changes directly implement the linked issue ARCH-1870 by using util.inspect with deeper inspection settings to expand nested objects in debug logs, replacing the previous shallow %O format specifiers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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/improve-apps-engine-debug-logs

📜 Recent review details

Configuration used: CodeRabbit 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 ea34a95 and 3f60aee.

📒 Files selected for processing (3)
  • .changeset/real-hotels-sniff.md (1 hunks)
  • packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts (10 hunks)
  • packages/apps-engine/src/server/runtime/deno/ProcessMessenger.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/real-hotels-sniff.md
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: UserBridge.doGetUserRoomIds in packages/apps-engine/src/server/bridges/UserBridge.ts has a bug where it implicitly returns undefined when the app lacks read permission (missing return statement in the else case of the permission check).

Applied to files:

  • packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings (mapping subscription documents to room IDs), never undefined, even when user has no room subscriptions.

Applied to files:

  • packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings by mapping subscription documents to room IDs, never undefined, even when user has no room subscriptions.

Applied to files:

  • packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts
🧬 Code graph analysis (1)
packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts (1)
packages/apps-engine/src/server/runtime/deno/ProcessMessenger.ts (1)
  • ProcessMessenger (8-54)
🔇 Additional comments (5)
packages/apps-engine/src/server/runtime/deno/ProcessMessenger.ts (1)

15-17: LGTM! Simplified constructor removes debug dependency.

The removal of the debug parameter simplifies the class and is well-coordinated with the caller in AppsEngineDenoRuntime.ts (line 127).

packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts (4)

4-4: LGTM! Standard util.inspect import.

The import is properly aliased to avoid naming conflicts with the local helper function.


25-26: LGTM! Well-configured inspect helper for deeper object expansion.

The configuration with depth: 10 addresses the PR objective by providing much deeper object inspection than the default depth of 2. The breakLength: Infinity setting ensures debug logs remain on single lines for easier grepping and filtering.


127-127: LGTM! ProcessMessenger instantiation updated correctly.

The instantiation correctly reflects the updated constructor signature in ProcessMessenger.ts.


184-184: LGTM! Debug statements consistently use the inspect helper.

All debug statements now use the inspect() helper to provide deeper object expansion, directly addressing the PR objective. The changes maintain the existing debug log structure while significantly improving the visibility of nested objects like headers, query params, and request content.

Also applies to: 330-330, 431-431, 529-529, 649-649, 698-698


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.

KevLehman
KevLehman previously approved these changes Nov 4, 2025
@d-gubert
Copy link
Member Author

d-gubert commented Nov 4, 2025

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts (1)

232-232: Consider using inspect for consistency.

For consistency with the new logging approach, consider using format specifiers and inspect() for the args parameter.

Apply this diff:

-		this.debug('Emitted but no one listened: ', eventName, args);
+		this.debug('Emitted but no one listened: %s %s', eventName, inspect(args));
📜 Review details

Configuration used: CodeRabbit 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 31ab78f and 5ad457a.

📒 Files selected for processing (1)
  • packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts (9 hunks)
⏰ 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). (1)
  • GitHub Check: 📦 Build Packages
🔇 Additional comments (1)
packages/apps-engine/src/server/runtime/deno/AppsEngineDenoRuntime.ts (1)

4-4: LGTM! Good approach to centralizing inspect configuration.

The import and helper function are well-implemented. Using depth: 5 provides a good balance between visibility into nested structures and avoiding excessive verbosity.

Also applies to: 25-26

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.13%. Comparing base (d7a3875) to head (3f60aee).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37384      +/-   ##
===========================================
+ Coverage    68.12%   68.13%   +0.01%     
===========================================
  Files         3364     3364              
  Lines       115814   115814              
  Branches     20909    20909              
===========================================
+ Hits         78901    78914      +13     
+ Misses       34216    34208       -8     
+ Partials      2697     2692       -5     
Flag Coverage Δ
e2e 57.51% <ø> (+0.03%) ⬆️
unit 72.13% <ø> (ø)

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.

@d-gubert d-gubert force-pushed the chore/improve-apps-engine-debug-logs branch from 5ad457a to 3ead8b2 Compare November 6, 2025 20:59
@d-gubert d-gubert force-pushed the chore/improve-apps-engine-debug-logs branch from 046570b to 9c45aa9 Compare November 6, 2025 23:57
@d-gubert d-gubert force-pushed the chore/improve-apps-engine-debug-logs branch from 6e0515d to 66b29e4 Compare November 7, 2025 00:02
@d-gubert d-gubert changed the title chore: improve logging of deeper objects fix(apps): debug logs on apps-engine doesn't expand objects enough Nov 7, 2025
@d-gubert d-gubert marked this pull request as ready for review November 7, 2025 00:10
@d-gubert d-gubert requested a review from a team as a code owner November 7, 2025 00:10
@d-gubert d-gubert added this to the 7.13.0 milestone Nov 7, 2025
@d-gubert d-gubert added the stat: QA assured Means it has been tested and approved by a company insider label Nov 7, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Nov 7, 2025
@d-gubert d-gubert force-pushed the chore/improve-apps-engine-debug-logs branch from ea34a95 to 3f60aee Compare November 7, 2025 12:25
@kodiakhq kodiakhq bot merged commit cd0f72f into develop Nov 7, 2025
64 checks passed
@kodiakhq kodiakhq bot deleted the chore/improve-apps-engine-debug-logs branch November 7, 2025 13:22
@scuciatto
Copy link
Member

/patch

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Nov 7, 2025

Pull request #37440 added to Project: "Patch 7.12.1"

@scuciatto
Copy link
Member

/backport 7.11.1

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Nov 7, 2025

Pull request #37441 added to Project: "Patch 7.11.1"

@scuciatto
Copy link
Member

/backport 7.10.4

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Nov 7, 2025

Pull request #37442 added to Project: "Patch 7.10.4"

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.

5 participants