Skip to content

fix(condo): reduce Message.processingMeta size#7815

Open
YEgorLu wants to merge 2 commits into
mainfrom
fix/condo/reduce-message-processing-meta-size-a-little
Open

fix(condo): reduce Message.processingMeta size#7815
YEgorLu wants to merge 2 commits into
mainfrom
fix/condo/reduce-message-processing-meta-size-a-little

Conversation

@YEgorLu

@YEgorLu YEgorLu commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

So there is some duplicates in Message.processingMeta json. Here I am removing them:

  1. { messageContext } is useless, as it is duplicate of latest { transportsMeta: [{ messageContext }] }
  2. push adapter pasted whole current Message in messageContext, which at least duplicates big { meta: { data } } (useless)

So this should reduce Message.processingMeta's size for something like 50% based on what I tested -> reduce size of Message / MessageHistoryRecord

Summary by CodeRabbit

  • Bug Fixes
    • Improved notification delivery handling so sensitive message context is no longer included in processing metadata.
    • Updated push notification handling to keep internal message details out of stored delivery data while preserving delivery behavior.

@YEgorLu YEgorLu added the 👶 small Easy to review changes up to 50 lines of code label Jul 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d84ffb189

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

* @returns {Promise<[boolean, {error: string}]|(boolean|{})[]>}
*/
async function send ({ notification, message, data, user, remoteClient } = {}, isVoIP = false) {
async function send ({ notification, omitFromProcessingMeta: { message }, data, user, remoteClient } = {}, isVoIP = false) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the existing push send argument shape

When send is called directly with the documented/current context shape, including existing tests that pass { message, data, remoteClient }, this nested destructuring tries to read message from an absent omitFromProcessingMeta object and throws before any push logic runs. This blocks the push transport tests and any direct adapter callers that still use the public shape; keep a fallback to the top-level message or update all callers together.

Useful? React with 👍 / 👎.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

A new constant NOT_LOGGABLE_MESSAGE_CONTEXT_KEY is added to notification constants and used to nest sensitive message data separately from processing metadata. The push transport and message delivery task are updated to store and consume this data via the new key, omitting it from persisted logs.

Changes

Non-loggable message context handling

Layer / File(s) Summary
Constant definition and export
apps/condo/domains/notification/constants/constants.js
Adds and exports NOT_LOGGABLE_MESSAGE_CONTEXT_KEY = 'omitFromProcessingMeta'.
Push transport contract update
apps/condo/domains/notification/transports/push.js
prepareMessageToSend nests message under the new key instead of returning it as a plain field; send now destructures message from omitFromProcessingMeta.message.
Delivery task metadata omission
apps/condo/domains/notification/tasks/deliverMessage.js
Imports omit and the new constant, no longer stores raw messageContext on processingMeta, and stores transportMeta.messageContext with the non-loggable key omitted.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DeliverMessageTask
  participant PushTransport
  participant ProcessingMeta

  DeliverMessageTask->>PushTransport: prepareMessageToSend()
  PushTransport-->>DeliverMessageTask: { omitFromProcessingMeta: { message } }
  DeliverMessageTask->>PushTransport: send({ omitFromProcessingMeta: { message } })
  PushTransport->>PushTransport: read message from omitFromProcessingMeta
  DeliverMessageTask->>ProcessingMeta: store transportMeta.messageContext (key omitted)
Loading

Suggested reviewers: toplenboren, Alllex202

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: reducing Message.processingMeta size by removing duplicated data.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/condo/reduce-message-processing-meta-size-a-little

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/condo/domains/notification/transports/push.js`:
- Line 323: The send() function in push.js destructures message from
omitFromProcessingMeta without a default, so it throws when that nested object
is missing. Update the send() parameter handling to give omitFromProcessingMeta
its own default object before extracting message, while keeping the existing
notification, data, user, remoteClient, and isVoIP behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c9977db3-98e8-4620-9258-4947de5e1346

📥 Commits

Reviewing files that changed from the base of the PR and between c8e46aa and 3d84ffb.

📒 Files selected for processing (3)
  • apps/condo/domains/notification/constants/constants.js
  • apps/condo/domains/notification/tasks/deliverMessage.js
  • apps/condo/domains/notification/transports/push.js

* @returns {Promise<[boolean, {error: string}]|(boolean|{})[]>}
*/
async function send ({ notification, message, data, user, remoteClient } = {}, isVoIP = false) {
async function send ({ notification, omitFromProcessingMeta: { message }, data, user, remoteClient } = {}, isVoIP = false) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify send() is always invoked with a fully-populated first argument.
rg -nP -C3 '\bsend\s*\(' apps/condo/domains/notification/transports/push.js apps/condo/domains/notification/transports/push.spec.js

Repository: open-condo-software/condo

Length of output: 8497


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- push.js around send/prepareMessageToSend ---'
sed -n '250,420p' apps/condo/domains/notification/transports/push.js

echo
echo '--- all send() call sites in push.js and nearby transport files ---'
rg -n -C 2 '\bsend\s*\(' apps/condo/domains/notification/transports/push.js apps/condo/domains/notification/transports/*.js

echo
echo '--- omitFromProcessingMeta references in push transport ---'
rg -n -C 2 'omitFromProcessingMeta|prepareMessageToSend' apps/condo/domains/notification/transports/push.js apps/condo/domains/notification/transports/*.js

Repository: open-condo-software/condo

Length of output: 20494


Default omitFromProcessingMeta before destructuring message. send() will throw a TypeError whenever that field is missing; the nested object needs its own default.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/condo/domains/notification/transports/push.js` at line 323, The send()
function in push.js destructures message from omitFromProcessingMeta without a
default, so it throws when that nested object is missing. Update the send()
parameter handling to give omitFromProcessingMeta its own default object before
extracting message, while keeping the existing notification, data, user,
remoteClient, and isVoIP behavior unchanged.

Source: Learnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👶 small Easy to review changes up to 50 lines of code

Development

Successfully merging this pull request may close these issues.

1 participant