Skip to content

feat: history manager for real time composer - #41412

Merged
MartinSchoeler merged 11 commits into
poc/real-time-composerfrom
chore/real-time-composer-history
Jul 24, 2026
Merged

feat: history manager for real time composer#41412
MartinSchoeler merged 11 commits into
poc/real-time-composerfrom
chore/real-time-composer-history

Conversation

@MartinSchoeler

@MartinSchoeler MartinSchoeler commented Jul 16, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Issue(s)

RTC-11

Steps to test or reproduce

Further comments

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added undo and redo support to the rich-text message composer, preserving selection and formatting across edits.
    • Supports keyboard shortcuts, paste-like updates, IME composition, and programmatic changes.
    • Clears composer history when switching rooms.
  • Bug Fixes
    • Improved reply text insertion to preserve existing selection behavior.
    • Refined caret handling for empty blocks and line breaks.
    • Prevents unintended re-rendering from untrusted composer events.
  • Tests
    • Added unit and end-to-end coverage for undo/redo, trusted-event handling, and room switching.

@dionisio-bot

dionisio-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds contenteditable composer undo/redo history with coalescing, keyboard shortcuts, IME handling, bounded stacks, and cleanup. Integrates history with rich-text rendering, selection restoration, reply text updates, room wiring, and unit/end-to-end coverage.

Changes

Composer behavior and architecture

Layer / File(s) Summary
Composer history engine and validation
apps/meteor/app/ui-message/client/messageBox/composerHistory.ts, apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
Adds snapshot-based undo/redo with edit classification, coalescing, selection boundaries, IME handling, keyboard shortcuts, stack limits, and lifecycle cleanup, with Jest coverage.
Rich-text rendering and selection integration
apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts, apps/meteor/app/ui-message/client/messageBox/selectionRange.ts, apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
Extracts content rendering with explicit selection restoration, updates empty-block <br> offset handling, and tests ignored untrusted events.
Composer history hook and API wiring
apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts, apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx, apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
Connects history restoration to rendering and draft events, wires the hook into merged composer refs, and routes replyWith through setText.
Composer behavior end-to-end coverage
apps/meteor/tests/e2e/message-composer-history.spec.ts
Covers typed undo/redo, formatting undo, sent-message restoration, and history reset when switching rooms.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ComposerInput
  participant ComposerHistory
  participant useComposerHistory
  participant renderComposerContent
  ComposerInput->>ComposerHistory: dispatch input or keyboard event
  ComposerHistory->>useComposerHistory: apply stored text and selection
  useComposerHistory->>renderComposerContent: render content and restore caret
  renderComposerContent->>ComposerInput: update HTML and selection
Loading

Suggested labels: type: feature

Suggested reviewers: cardoso

🚥 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: adding history management for the real-time composer.
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.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • RTC-11: Request failed with status code 401

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.

@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4b76049

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

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.36482% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.34%. Comparing base (076b5b4) to head (4b76049).

Additional details and impacted files

Impacted file tree graph

@@                    Coverage Diff                     @@
##           poc/real-time-composer   #41412      +/-   ##
==========================================================
+ Coverage                   68.32%   68.34%   +0.01%     
==========================================================
  Files                        4149     4151       +2     
  Lines                      159851   160202     +351     
  Branches                    28062    28123      +61     
==========================================================
+ Hits                       109225   109495     +270     
- Misses                      45475    45559      +84     
+ Partials                     5151     5148       -3     
Flag Coverage Δ
e2e 57.90% <3.70%> (-0.23%) ⬇️
e2e-api 45.36% <ø> (-0.01%) ⬇️
unit 70.40% <87.75%> (+0.01%) ⬆️

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.

@MartinSchoeler
MartinSchoeler force-pushed the chore/real-time-composer-msgbox-split branch from 76e90ff to 77135a1 Compare July 16, 2026 19:24
@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label Jul 16, 2026

@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: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts (1)

84-95: 🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

Escape restored link text before innerHTML (apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts:84-95)

restoreLinks puts raw user text back into the rendered HTML, so a Slack-style input like <img src=x onerror=alert(1)|x> can reach target.innerHTML as live markup.

🤖 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/meteor/app/ui-message/client/messageBox/messageStateHandler.ts` around
lines 84 - 95, Escape or otherwise safely encode the user-controlled link text
restored by restoreLinks before assigning the result to target.innerHTML. Update
the restoreLinks/finalHtml rendering flow while preserving the heading newline
cleanup, ensuring inputs such as HTML tags and event-handler attributes render
as text rather than executable markup.
🧹 Nitpick comments (1)
apps/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts (1)

9-10: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Type the empty formatter snapshot.

any[] removes validation at the useSyncExternalStore boundary.

Proposed fix
-const a: any[] = [];
-export const getEmptyArray = () => a;
+const emptyFormattingButtons: FormattingButton[] = [];
+export const getEmptyArray = (): FormattingButton[] => emptyFormattingButtons;
🤖 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/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts`
around lines 9 - 10, Update the module-level empty snapshot array used by
getEmptyArray to use the specific formatter snapshot element type instead of
any[]. Preserve the shared stable array instance and ensure the type matches the
value expected at the useSyncExternalStore boundary.
🤖 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/meteor/app/ui-message/client/messageBox/composerHistory.ts`:
- Around line 126-141: Update the composer history logic around the beforeinput
coalescing flow to capture the current selection and force commit when it
differs from the selection stored with current. Preserve existing kind, pause,
paste, newline, and whitespace boundaries, and add a regression test covering
typing, moving the caret, then making a noncontiguous edit so undo separates the
edits.

In `@apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts`:
- Around line 136-141: Update the replyWith function to set the composer text
through the existing setText helper instead of directly assigning input.value,
while preserving the current focus behavior after updating the text.

In `@apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts`:
- Around line 95-101: The selected-text insertion behavior must be consistent
across both composer implementations: in
apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts lines
95-101, update insertText so both resulting selection offsets collapse to start
+ text.length; in
apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts lines 19-34,
preserve the original suffix by slicing from selectionEnd rather than
selectionStart.

In `@apps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts`:
- Around line 177-182: Update replyWith to set the composer text through the
existing setText helper instead of assigning input.innerText directly,
preserving the subsequent focus behavior. This ensures the associated
input/change events and composer state updates are triggered.

In `@apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts`:
- Around line 97-98: Update setSelectionRange in selectionRange.ts to account
for ordinary <br> nodes using the same offset behavior as getSelectionRange,
keeping cursor restoration symmetric for multiline content. Add a regression
test covering selection restoration across multiple lines.

In `@apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx`:
- Line 47: Update the upload handling in MessageBox, including the onUploadFiles
usage and the paste flow, to retain handleUploadFiles from useFileUpload as the
fallback whenever onUploadFiles is undefined. Ensure pasted or otherwise
uploaded files are still processed internally instead of being dropped, while
preserving the caller-provided onUploadFiles behavior when available.
- Around line 401-405: Update the Join button wiring in MessageBox.tsx (401-405)
and RichTextMessageBox.tsx (509-513) to pass a callback invoking
joinMutation.mutateAsync() instead of raw onJoin, so joinMutation.isPending
controls loading and prevents repeated clicks.

In `@apps/meteor/tests/e2e/message-composer-history.spec.ts`:
- Line 16: Update the message composer history suite to capture the existing
Accounts_AllowFeaturePreview value before setSettingValueById changes it, then
restore that captured value in afterAll alongside the existing user preference
and channel cleanup. Ensure teardown runs even when the suite changes the
setting to true, preserving clean state for subsequent Playwright executions.

---

Outside diff comments:
In `@apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts`:
- Around line 84-95: Escape or otherwise safely encode the user-controlled link
text restored by restoreLinks before assigning the result to target.innerHTML.
Update the restoreLinks/finalHtml rendering flow while preserving the heading
newline cleanup, ensuring inputs such as HTML tags and event-handler attributes
render as text rather than executable markup.

---

Nitpick comments:
In `@apps/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts`:
- Around line 9-10: Update the module-level empty snapshot array used by
getEmptyArray to use the specific formatter snapshot element type instead of
any[]. Preserve the shared stable array instance and ensure the type matches the
value expected at the useSyncExternalStore boundary.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 04d753c5-3f05-4fa5-b802-9970df27c336

📥 Commits

Reviewing files that changed from the base of the PR and between 77135a1 and 6917970.

📒 Files selected for processing (14)
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts
  • apps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • apps/meteor/client/views/room/composer/messageBox/MessageBoxBase.tsx
  • apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx
  • apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts
  • apps/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts
  • apps/meteor/client/views/room/composer/messageBox/wrapSelection.ts
  • apps/meteor/tests/e2e/message-composer-history.spec.ts
📜 Review details
⚠️ CI failures not shown inline (6)

GitHub Actions: CI / 0_✅ Tests Done.txt: feat: history manager for real time composer

Conclusion: failure

View job details

##[group]Run if [[ 'success' != 'success' ]]; then
 �[36;1mif [[ 'success' != 'success' ]]; then�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mif [[ 'success' != 'success' ]]; then�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mif [[ 'success' != 'success' ]]; then�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mif [[ 'failure' != 'success' ]]; then�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mif [[ 'success' != 'success' ]]; then�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mif [[ 'failure' != 'success' ]]; then�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mif [[ 'success' != 'success' ]]; then�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mif [[ 'success' != 'success' ]]; then�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mif [[ 'success' != 'success' ]]; then�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mecho finished�[0m
 shell: /usr/bin/bash -e {0}
 env:
   TOOL_NODE_FLAGS: --max_old_space_size=4096
 ##[endgroup]
 ##[error]Process completed with exit code 1.

GitHub Actions: CI / 2_📦 Track Image Sizes.txt: feat: history manager for real time composer

Conclusion: failure

View job details

##[group]Run current_total=$(jq -r '.total' current-sizes.json)
 �[36;1mcurrent_total=$(jq -r '.total' current-sizes.json)�[0m
 �[36;1m�[0m
 �[36;1mif [[ ! -f baseline-sizes.json ]]; then�[0m
 �[36;1m  echo "No baseline available"�[0m
 �[36;1m  echo "size-diff=0" >> $GITHUB_OUTPUT�[0m
 �[36;1m  echo "size-diff-percent=0" >> $GITHUB_OUTPUT�[0m
 �[36;1m  echo "comment-triggered=false" >> $GITHUB_OUTPUT�[0m
 �[36;1m�[0m
 �[36;1m  cat > report.md << 'EOF'�[0m
 �[36;1m# 📦 Docker Image Size Report�[0m
 �[36;1m�[0m
 �[36;1m**Status:** First measurement - no baseline for comparison�[0m
 �[36;1m�[0m
 �[36;1m**Total Size:** $(numfmt --to=iec-i --suffix=B $current_total)�[0m
 �[36;1mEOF�[0m
 �[36;1m  exit 0�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mbaseline_total=$(jq -r '.total' baseline-sizes.json)�[0m
 �[36;1mdiff=$((current_total - baseline_total))�[0m
 �[36;1m�[0m
 �[36;1mif [[ $baseline_total -gt 0 ]]; then�[0m
 �[36;1m  percent=$(awk "BEGIN {printf \"%.2f\", ($diff / $baseline_total) * 100}")�[0m
 �[36;1melse�[0m
 �[36;1m  percent=0�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mecho "size-diff=$diff" >> $GITHUB_OUTPUT�[0m
 �[36;1mecho "size-diff-percent=$percent" >> $GITHUB_OUTPUT�[0m
 �[36;1m�[0m
 �[36;1m# Only comment when size is bigger than baseline; optionally require per-image thresholds�[0m
 �[36;1mTHRESHOLDS="$SIZE_THRESHOLDS"�[0m
 �[36;1mFAIL_THRESHOLDS="$FAIL_THRESHOLDS"�[0m
 �[36;1mcomment_triggered=false�[0m
 �[36;1mfail_triggered=false�[0m
 �[36;1mif [[ $diff -gt 0 ]]; then�[0m
 �[36;1m  if [[ -z "$THRESHOLDS" ]] || [[ "$THRESHOLDS" == "{}" ]]; then�[0m
 �[36;1m    comment_triggered=true�[0m
 �[36;1m  fi�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mcolor="gray"�[0m
 �[36;1mif (( $(awk "BEGIN {print ($percent > 0.01)}") )); then�[0m
 �[36;1m  color="red"�[0m
 �[36;1melif (( $(awk "BEGIN {print ($percent < -0.01)}") )); then�[0m
 �[36;1m  color="green"�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1m# Generate report�[0m
 �[36;1mif [[ $diff -gt 0 ]]; then�[0m
 �[36;1m  emoji=...

GitHub Actions: CI / 16_🔨 Test UI (CE) _ MongoDB 8.0 (2_4).txt: feat: history manager for real time composer

Conclusion: failure

View job details

##[group]Run set -o xtrace
 �[36;1mset -o xtrace�[0m
 �[36;1m�[0m
 �[36;1myarn prepare�[0m
 �[36;1myarn test:e2e --shard="$E2E_SHARD/$E2E_TOTAL_SHARD"�[0m
 shell: /usr/bin/bash -e {0}
 env:
   MONGO_URL: mongodb://localhost:27017/rocketchat?replicaSet=rs0&directConnection=true
   TOOL_NODE_FLAGS: --max_old_space_size=4096
   LOWERCASE_REPOSITORY: rocketchat
   DOCKER_TAG: pr-41412-amd64
   DOCKER_TAG_SUFFIX_ROCKETCHAT:
   MONGODB_VERSION: 8.0
   COVERAGE_DIR: /tmp/coverage/ui
   COVERAGE_FILE_NAME: ui-2.json
   COVERAGE_REPORTER:
   NODE_VERSION: 22.22.3
   DENO_VERSION: 2.3.1
   MONGOMS_DOWNLOAD_DIR: /home/runner/work/_temp/mongodb-memory-server
   MONGOMS_PREFER_GLOBAL_PATH: false
   TURBOGHA_PORT: 41230
   TURBO_API: http://localhost:41230
   TURBO_***REDACTED***
   TURBO_TEAM: turbogha
   E2E_COVERAGE:
   IS_EE:
   REPORTER_ROCKETCHAT_***REDACTED***
   REPORTER_ROCKETCHAT_URL: ***
   REPORTER_JIRA_ROCKETCHAT_***REDACTED***
   REPORTER_ROCKETCHAT_REPORT: true
   REPORTER_ROCKETCHAT_RUN: 64940
   REPORTER_ROCKETCHAT_BRANCH: refs/pull/41412/merge
   REPORTER_ROCKETCHAT_DRAFT: true
   REPORTER_ROCKETCHAT_HEAD_SHA: 69179704723273f82dc08b5ed465b46aeff6a595
   REPORTER_ROCKETCHAT_AUTHOR: MartinSchoeler
   REPORTER_ROCKETCHAT_RUN_URL: https://github.com/RocketChat/Rocket.Chat/actions/runs/29498427372
   REPORTER_ROCKETCHAT_PR: 41412
   QASE_API_***REDACTED***
   QASE_REPORT:
   CI: true
   PLAYWRIGHT_RETRIES: 0
   E2E_SHARD: 2
   E2E_TOTAL_SHARD: 4
 ##[endgroup]
 + yarn prepare
 + yarn test:e2e --shard=2/4
 GitCommitInfo: timeout of 3000ms exceeded while running "git fetch origin 76e90ff5b08bbd0cae56711831ca466e633203eb"
 Running 187 tests using 1 worker, shard 2 of 4
   ✓  1 tests/e2e/feature-preview.spec.ts:62:6 › feature preview › should show "Navigation" feature section (4.9s)
 [INFO] qase: Test should show "Navigation" feature section passed
   ✓  2 tests/e2e/feature-preview.spec.ts:106:7 › feature preview › Sidepanel › should display new channel from team on th...

GitHub Actions: CI / 6_🔨 Test UI (EE) _ MongoDB 8.0 coverage (4_5).txt: feat: history manager for real time composer

Conclusion: failure

View job details

##[group]Run set -o xtrace
 �[36;1mset -o xtrace�[0m
 �[36;1m�[0m
 �[36;1myarn prepare�[0m
 �[36;1myarn test:e2e --shard="$E2E_SHARD/$E2E_TOTAL_SHARD"�[0m
 shell: /usr/bin/bash -e {0}
 env:
   MONGO_URL: mongodb://localhost:27017/rocketchat?replicaSet=rs0&directConnection=true
   TOOL_NODE_FLAGS: --max_old_space_size=4096
   LOWERCASE_REPOSITORY: rocketchat
   DOCKER_TAG: pr-41412-amd64
   DOCKER_TAG_SUFFIX_ROCKETCHAT:
   MONGODB_VERSION: 8.0
   COVERAGE_DIR: /tmp/coverage/ui
   COVERAGE_FILE_NAME: ui-4.json
   COVERAGE_REPORTER: json
   NODE_VERSION: 22.22.3
   DENO_VERSION: 2.3.1
   MONGOMS_DOWNLOAD_DIR: /home/runner/work/_temp/mongodb-memory-server
   MONGOMS_PREFER_GLOBAL_PATH: false
   TURBOGHA_PORT: 41230
   TURBO_API: http://localhost:41230
   TURBO_***REDACTED***
   TURBO_TEAM: turbogha
   E2E_COVERAGE: true
   IS_EE: true
   REPORTER_ROCKETCHAT_***REDACTED***
   REPORTER_ROCKETCHAT_URL: ***
   REPORTER_JIRA_ROCKETCHAT_***REDACTED***
   REPORTER_ROCKETCHAT_REPORT: true
   REPORTER_ROCKETCHAT_RUN: 64940
   REPORTER_ROCKETCHAT_BRANCH: refs/pull/41412/merge
   REPORTER_ROCKETCHAT_DRAFT: true
   REPORTER_ROCKETCHAT_HEAD_SHA: 69179704723273f82dc08b5ed465b46aeff6a595
   REPORTER_ROCKETCHAT_AUTHOR: MartinSchoeler
   REPORTER_ROCKETCHAT_RUN_URL: https://github.com/RocketChat/Rocket.Chat/actions/runs/29498427372
   REPORTER_ROCKETCHAT_PR: 41412
   QASE_API_***REDACTED***
   QASE_REPORT:
   CI: true
   PLAYWRIGHT_RETRIES: 0
   E2E_SHARD: 4
   E2E_TOTAL_SHARD: 5
 ##[endgroup]
 + yarn prepare
 + yarn test:e2e --shard=4/5
 GitCommitInfo: timeout of 3000ms exceeded while running "git fetch origin 76e90ff5b08bbd0cae56711831ca466e633203eb"
 Running 155 tests using 1 worker, shard 4 of 5
   ✓  1 tests/e2e/omnichannel/omnichannel-livechat-logo.spec.ts:38:6 › OC - Livechat - Widget logo › OC - Livechat - Change widget logo (8.4s)
 [INFO] qase: Test OC - Livechat - Change widget logo passed
   ✓  2 tests/e2e/omnichannel/omnichannel-livechat-message-bubble-color.spec.ts:56:6 ...

GitHub Actions: CI / 29_🔨 Test Unit _ Unit Tests.txt: feat: history manager for real time composer

Conclusion: failure

View job details

 DENO_VERSION: 2.3.1
   MONGOMS_DOWNLOAD_DIR: /home/runner/work/_temp/mongodb-memory-server
   MONGOMS_PREFER_GLOBAL_PATH: false
   TURBOGHA_PORT: 41230
   TURBO_API: http://localhost:41230
   TURBO_***REDACTED***
   TURBO_TEAM: turbogha
 ##[endgroup]
 ##[group]Run missing_deps=""
 �[36;1mmissing_deps=""�[0m
 �[36;1m�[0m
 �[36;1m# Check for always-required commands�[0m
 �[36;1mfor cmd in bash git curl; do�[0m
 �[36;1m  if ! command -v "$cmd" >/dev/null 2>&1; then�[0m
 �[36;1m    missing_deps="$missing_deps $cmd"�[0m
 �[36;1m  fi�[0m
 �[36;1mdone�[0m
 �[36;1m�[0m
 �[36;1m# Check for gpg only if validation is not being skipped�[0m
 �[36;1mif [ "$INPUT_SKIP_VALIDATION" != "true" ]; then�[0m
 �[36;1m  if ! command -v gpg >/dev/null 2>&1; then�[0m
 �[36;1m    missing_deps="$missing_deps gpg"�[0m
 �[36;1m  fi�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1m# Report missing required dependencies�[0m
 �[36;1mif [ -n "$missing_deps" ]; then�[0m
 �[36;1m  echo "Error: The following required dependencies are missing:$missing_deps"�[0m
 �[36;1m  echo "Please install these dependencies before using this action."�[0m
 �[36;1m  exit 1�[0m
 �[36;1mfi�[0m
 �[36;1m�[0m
 �[36;1mecho "All required system dependencies are available."�[0m
 shell: /usr/bin/sh -e {0}
 env:
   MONGO_URL: mongodb://localhost:27017/rocketchat?replicaSet=rs0&directConnection=true
   TOOL_NODE_FLAGS: --max_old_space_size=4096
   ENTERPRISE_LICENSE: MK+bpK5NveUuNlWGaQXGoy+8b74Luet82M3ZGcBB8b5P9Y+m67NEtpW64dc1d5lEWi6d0nFjCjtCMneVD7bKxodz/Cml8URKEo5P7cQb/9wmeT0MzAhYNaRFZlIGkZ3ITF59pDV2u4HZuosEDJikVRwnaJ5ZoU/pOsHSPUPhTyGNIqLeKynODtUpfwDdIKEmHxpf2yVkKjgRiIJmbWjM6A4k+MNNYXWVXHzye7GggqWVg/ZcT7nKU1CCadpLhTJiIrgrrPzil1G5DQ4xnLs3Q2tu2dILSDiW5OYw/ywu2yCMicTjMq4MLL5SXDQJj6WoJzZ54HosbvsDzOXvsdC9gI1CjhPL2uRuvC8XLrzn3vL2UgXnifzD1VrLTtdZ+aSADveqtlzYlRWtqoUFBbNw8o+YVHdhbZGR0beMoAyRbHi5EMpxpad3L+NyztUIT/Uh/IjQ/C2SQZ6jB0GKPBOPxFLN56FNhTGrffLFR++TVoBu0Iquc7kajWkNit3bVbZvbx+oFcVW2PcjQ/+i2jpJjbgtUFUKrTKxGMAXTWoDzIQQ35zNzGAy268IM4Ymp5JmsV...

GitHub Actions: CI / 8_🔨 Test UI (EE) _ MongoDB 8.0 coverage (2_5).txt: feat: history manager for real time composer

Conclusion: failure

View job details

##[group]Run set -o xtrace
 �[36;1mset -o xtrace�[0m
 �[36;1m�[0m
 �[36;1myarn prepare�[0m
 �[36;1myarn test:e2e --shard="$E2E_SHARD/$E2E_TOTAL_SHARD"�[0m
 shell: /usr/bin/bash -e {0}
 env:
   MONGO_URL: mongodb://localhost:27017/rocketchat?replicaSet=rs0&directConnection=true
   TOOL_NODE_FLAGS: --max_old_space_size=4096
   LOWERCASE_REPOSITORY: rocketchat
   DOCKER_TAG: pr-41412-amd64
   DOCKER_TAG_SUFFIX_ROCKETCHAT:
   MONGODB_VERSION: 8.0
   COVERAGE_DIR: /tmp/coverage/ui
   COVERAGE_FILE_NAME: ui-2.json
   COVERAGE_REPORTER: json
   NODE_VERSION: 22.22.3
   DENO_VERSION: 2.3.1
   MONGOMS_DOWNLOAD_DIR: /home/runner/work/_temp/mongodb-memory-server
   MONGOMS_PREFER_GLOBAL_PATH: false
   TURBOGHA_PORT: 41230
   TURBO_API: http://localhost:41230
   TURBO_***REDACTED***
   TURBO_TEAM: turbogha
   E2E_COVERAGE: true
   IS_EE: true
   REPORTER_ROCKETCHAT_***REDACTED***
   REPORTER_ROCKETCHAT_URL: ***
   REPORTER_JIRA_ROCKETCHAT_***REDACTED***
   REPORTER_ROCKETCHAT_REPORT: true
   REPORTER_ROCKETCHAT_RUN: 64940
   REPORTER_ROCKETCHAT_BRANCH: refs/pull/41412/merge
   REPORTER_ROCKETCHAT_DRAFT: true
   REPORTER_ROCKETCHAT_HEAD_SHA: 69179704723273f82dc08b5ed465b46aeff6a595
   REPORTER_ROCKETCHAT_AUTHOR: MartinSchoeler
   REPORTER_ROCKETCHAT_RUN_URL: https://github.com/RocketChat/Rocket.Chat/actions/runs/29498427372
   REPORTER_ROCKETCHAT_PR: 41412
   QASE_API_***REDACTED***
   QASE_REPORT:
   CI: true
   PLAYWRIGHT_RETRIES: 0
   E2E_SHARD: 2
   E2E_TOTAL_SHARD: 5
 ##[endgroup]
 + yarn prepare
 + yarn test:e2e --shard=2/5
 GitCommitInfo: timeout of 3000ms exceeded while running "git fetch origin 76e90ff5b08bbd0cae56711831ca466e633203eb"
 Running 152 tests using 1 worker, shard 2 of 5
   ✓  1 tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts:59:6 › E2EE File Encryption › should edit encrypted message with file (10.1s)
 [INFO] qase: Test should edit encrypted message with file passed
   ✓  2 tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts:99:6 › E2EE File Encr...
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{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/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts
  • apps/meteor/tests/e2e/message-composer-history.spec.ts
  • apps/meteor/client/views/room/composer/messageBox/wrapSelection.ts
  • apps/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts
  • apps/meteor/client/views/room/composer/messageBox/MessageBoxBase.tsx
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts
  • apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx
**/*.spec.ts

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

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/tests/e2e/message-composer-history.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts

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

apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created in apps/meteor/tests/e2e/ directory
Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole(), page.getByLabel(), page.getByText(), or page.getByTitle()
Use test.beforeAll() and test.afterAll() for setup/teardown in Playwright tests
Use test.step() for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) for consistency in test files
Prefer web-first assertions (toBeVisible, toHaveText, etc.) in Playwright tests
Use expect matchers for assertions (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements in Playwright tests
Use page.waitFor() with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts

Files:

  • apps/meteor/tests/e2e/message-composer-history.spec.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}

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

apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests

Files:

  • apps/meteor/tests/e2e/message-composer-history.spec.ts
🧠 Learnings (9)
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/tests/e2e/message-composer-history.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts
  • apps/meteor/tests/e2e/message-composer-history.spec.ts
  • apps/meteor/client/views/room/composer/messageBox/wrapSelection.ts
  • apps/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts
  • apps/meteor/tests/e2e/message-composer-history.spec.ts
  • apps/meteor/client/views/room/composer/messageBox/wrapSelection.ts
  • apps/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/tests/e2e/message-composer-history.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts
  • apps/meteor/tests/e2e/message-composer-history.spec.ts
  • apps/meteor/client/views/room/composer/messageBox/wrapSelection.ts
  • apps/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts
  • apps/meteor/client/views/room/composer/messageBox/MessageBoxBase.tsx
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts
  • apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts
  • apps/meteor/client/views/room/composer/messageBox/wrapSelection.ts
  • apps/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.

Applied to files:

  • apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts
  • apps/meteor/client/views/room/composer/messageBox/wrapSelection.ts
  • apps/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts
📚 Learning: 2026-02-24T19:39:42.247Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/message.ts:7-7
Timestamp: 2026-02-24T19:39:42.247Z
Learning: In RocketChat e2e tests, avoid using data-qa attributes to locate elements. Prefer semantic locators such as getByRole, getByLabel, getByText, getByTitle and ARIA-based selectors. Apply this rule to all TypeScript files under apps/meteor/tests/e2e to improve test reliability, accessibility, and maintainability.

Applied to files:

  • apps/meteor/tests/e2e/message-composer-history.spec.ts
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/views/room/composer/messageBox/MessageBoxBase.tsx
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx
🪛 ast-grep (0.44.1)
apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts

[warning] 8-8: Direct modification of innerHTML or outerHTML properties detected. Modifying these properties with unsanitized user input can lead to XSS vulnerabilities. Use safe alternatives or sanitize content first.
Context: document.body.innerHTML = ''
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(dom-content-modification)


[warning] 13-13: Direct modification of innerHTML or outerHTML properties detected. Modifying these properties with unsanitized user input can lead to XSS vulnerabilities. Use safe alternatives or sanitize content first.
Context: input.innerHTML = '

original

'
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(dom-content-modification)


[warning] 13-13: Direct HTML content assignment detected. Modifying innerHTML, outerHTML, or using document.write with unsanitized content can lead to XSS vulnerabilities. Use secure alternatives like textContent or sanitize HTML with libraries like DOMPurify.
Context: input.innerHTML = '

original

'
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(unsafe-html-content-assignment)

apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts

[warning] 35-35: Direct modification of innerHTML or outerHTML properties detected. Modifying these properties with unsanitized user input can lead to XSS vulnerabilities. Use safe alternatives or sanitize content first.
Context: document.body.innerHTML = ''
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(dom-content-modification)

🪛 GitHub Actions: CI / 16_🔨 Test UI (CE) _ MongoDB 8.0 (2_4).txt
apps/meteor/tests/e2e/message-composer-history.spec.ts

[error] 35-35: E2E failed in step yarn test:e2e --shard=2/4 (1 failed). Timed out after 5000ms waiting for expect(locator('footer[aria-label="Room composer"]').locator('[name="msg"]')).toBeEnabled(). Received disabled textarea: locator('footer[aria-label="Room composer"]').locator('[name="msg"]').

🪛 GitHub Actions: CI / 8_🔨 Test UI (EE) _ MongoDB 8.0 coverage (2_5).txt
apps/meteor/tests/e2e/message-composer-history.spec.ts

[error] 39-39: Playwright test failed (Timed out 5000ms waiting for expect(locator).toBeEnabled()). Expected Room composer textarea '[name="msg"]' to be enabled but it was disabled. Failing assertion at line 35:53: expect(poHomeChannel.composer.inputMessage).toBeEnabled(). Trace saved to tests/e2e/.playwright/message-composer-history-m-01c27-ld-undo-and-redo-typed-text/trace.zip.

🔇 Additional comments (16)
apps/meteor/app/ui-message/client/messageBox/composerHistory.ts (1)

1-125: LGTM!

Also applies to: 142-215

apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts (1)

1-250: LGTM!

apps/meteor/tests/e2e/message-composer-history.spec.ts (2)

1-15: LGTM!

Also applies to: 17-23, 31-31, 37-97


32-36: 🩺 Stability & Availability

[name="msg"] is already the active composer target — it’s used by both the classic textarea and the realtime composer, so this isn’t a locator bug.

			> Likely an incorrect or invalid review comment.
apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts (1)

1-94: LGTM!

Also applies to: 102-253

apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts (1)

3-3: LGTM!

Also applies to: 15-18, 35-58, 143-174

apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts (1)

66-83: LGTM!

Also applies to: 99-111

apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts (1)

1-35: LGTM!

apps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts (1)

5-19: LGTM!

Also applies to: 54-69, 184-193

apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts (1)

1-25: LGTM!

apps/meteor/client/views/room/composer/messageBox/wrapSelection.ts (2)

1-1: LGTM!


70-103: 🎯 Functional Correctness

Verify wrapping during IME composition.

The textarea path restores the wrapped value when event.isComposing, but this contenteditable path immediately wraps and prevents default. Add coverage for a composing beforeinput followed by input; otherwise the browser’s composition update may overwrite the wrapper.

apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx (1)

4-108: LGTM!

Also applies to: 162-268, 270-483, 487-508, 514-537

apps/meteor/client/views/room/composer/messageBox/messageBoxHelpers.ts (1)

1-8: LGTM!

Also applies to: 12-75

apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx (1)

4-46: LGTM!

Also applies to: 48-131, 133-295, 334-400, 406-421

apps/meteor/client/views/room/composer/messageBox/MessageBoxBase.tsx (1)

1-184: LGTM!

Comment thread apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
Comment thread apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
Comment thread apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
Comment thread apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
Comment thread apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
Comment thread apps/meteor/tests/e2e/message-composer-history.spec.ts
@MartinSchoeler
MartinSchoeler force-pushed the chore/real-time-composer-history branch from 6917970 to 129d100 Compare July 16, 2026 19:46
Base automatically changed from chore/real-time-composer-msgbox-split to poc/real-time-composer July 20, 2026 15:23
@MartinSchoeler
MartinSchoeler force-pushed the chore/real-time-composer-history branch from ac883e0 to d3d4ebb Compare July 21, 2026 18:02
@MartinSchoeler
MartinSchoeler marked this pull request as ready for review July 21, 2026 18:07
@MartinSchoeler
MartinSchoeler requested a review from a team as a code owner July 21, 2026 18:07

@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: 2

🤖 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/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts`:
- Around line 260-271: Extend the “stops recording after release” test to
dispatch an input event after history.release(), then assert the
input/selection-reading mock is not called and no history snapshot is recorded.
Keep the existing undo-handler assertion, covering both keyboard and input
listener cleanup.

In `@apps/meteor/app/ui-message/client/messageBox/selectionRange.ts`:
- Around line 138-143: Remove the newly added implementation comments at
selectionRange.ts lines 138-143 and RichTextMessageBox.tsx lines 165, 250-252,
282, and 291, while leaving the surrounding logic 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 88705a4e-5742-4af5-ba38-514f623ac2f8

📥 Commits

Reviewing files that changed from the base of the PR and between 6917970 and d3d4ebb.

📒 Files selected for processing (10)
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
  • apps/meteor/app/ui-message/client/messageBox/selectionRange.ts
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx
  • apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts
  • apps/meteor/tests/e2e/message-composer-history.spec.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/meteor/client/views/room/composer/messageBox/hooks/useComposerHistory.ts
  • apps/meteor/tests/e2e/message-composer-history.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (6)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
  • GitHub Check: 🔎 Code Check / TypeScript
  • GitHub Check: 🔎 Code Check / Code Lint
  • GitHub Check: 🔨 Test Unit / Unit Tests
  • GitHub Check: 📦 Meteor Build (coverage)
⚠️ CI failures not shown inline (4)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/selectionRange.ts
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
**/*.spec.ts

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

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
🧠 Learnings (6)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/selectionRange.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/selectionRange.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/selectionRange.ts
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.

Applied to files:

  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
🪛 ast-grep (0.44.1)
apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts

[warning] 35-35: Direct modification of innerHTML or outerHTML properties detected. Modifying these properties with unsanitized user input can lead to XSS vulnerabilities. Use safe alternatives or sanitize content first.
Context: document.body.innerHTML = ''
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(dom-content-modification)

apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts

[warning] 13-13: Direct HTML content assignment detected. Modifying innerHTML, outerHTML, or using document.write with unsanitized content can lead to XSS vulnerabilities. Use secure alternatives like textContent or sanitize HTML with libraries like DOMPurify.
Context: input.innerHTML = '

original

'
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(unsafe-html-content-assignment)


[warning] 8-8: Direct modification of innerHTML or outerHTML properties detected. Modifying these properties with unsanitized user input can lead to XSS vulnerabilities. Use safe alternatives or sanitize content first.
Context: document.body.innerHTML = ''
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(dom-content-modification)


[warning] 13-13: Direct modification of innerHTML or outerHTML properties detected. Modifying these properties with unsanitized user input can lead to XSS vulnerabilities. Use safe alternatives or sanitize content first.
Context: input.innerHTML = '

original

'
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(dom-content-modification)

🔇 Additional comments (6)
apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx (1)

132-132: Previously raised: preserve pasted-image uploads without a callback.

onUploadFiles is optional, but this path prevents the native paste and does nothing when it is absent. Restore handleUploadFiles as the fallback.

Also applies to: 330-333

apps/meteor/app/ui-message/client/messageBox/selectionRange.ts (1)

49-49: LGTM!

Also applies to: 122-122

apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts (1)

3-3: LGTM!

Also applies to: 15-58, 136-145

apps/meteor/client/views/room/composer/messageBox/RichTextMessageBox.tsx (1)

14-14: LGTM!

Also applies to: 473-483

apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts (1)

1-258: LGTM!

apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts (1)

1-25: LGTM!

Comment thread apps/meteor/app/ui-message/client/messageBox/selectionRange.ts Outdated

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 10 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx Outdated
Comment thread apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
Comment thread apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
Comment thread apps/meteor/app/ui-message/client/messageBox/composerHistory.ts Outdated
Comment thread apps/meteor/tests/e2e/message-composer-history.spec.ts

@hacktron-app hacktron-app 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.

1 issue found across 1 file

Severity Count
HIGH 1

View full scan results

Comment thread apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts (2)

29-30: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Resolve the known Slack-style-link failure before release.

These lines acknowledge broken user-facing composer behavior. Add a failing regression test and fix it, or explicitly remove unsupported handling. I can help prepare the test or an issue.

🤖 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/meteor/app/ui-message/client/messageBox/messageStateHandler.ts` around
lines 29 - 30, Resolve the Slack-style link handling issue associated with the
TODO in messageStateHandler.ts before release. Add a regression test that
reproduces the failure and update the relevant composer/message parsing logic so
Slack-style links with angle brackets work correctly; if this syntax is
intentionally unsupported, remove the misleading TODO and explicitly disable or
reject that handling instead.

12-19: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Handle empty and multi-character delimiters.

Line 12 loops forever for delimiter === '', and Line 18 only recognizes one-character trailing delimiters. Reject empty delimiters and use str.endsWith(delimiter); add a multi-character delimiter regression test.

Proposed fix
 export const getTextLines = (str: string, delimiter: string): string[] => {
+	if (!delimiter) {
+		throw new TypeError('delimiter must not be empty');
+	}
+
 	const result = [];
 	let start = 0;
 	let index;
@@
-	if (!(start === str.length && delimiter === str[str.length - 1])) {
+	if (!str.endsWith(delimiter)) {
 		result.push(str.slice(start));
 	}
🤖 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/meteor/app/ui-message/client/messageBox/messageStateHandler.ts` around
lines 12 - 19, Update the delimiter-processing logic around the loop to reject
or otherwise handle an empty delimiter before calling indexOf, preventing an
infinite loop. Replace the single-character trailing-delimiter check with
str.endsWith(delimiter) so the final empty segment is omitted for any
multi-character delimiter, and add a regression test covering a trailing
multi-character delimiter.
🧹 Nitpick comments (1)
apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts (1)

6-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove implementation comments.

Keep intent in names and structure; resolve the Slack-link TODO separately rather than retaining implementation prose. As per coding guidelines, “Avoid code comments in the implementation.”

Also applies to: 17-17, 66-67, 75-75, 78-78, 81-81, 84-84, 87-87, 94-94, 97-97, 101-101, 107-109

🤖 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/meteor/app/ui-message/client/messageBox/messageStateHandler.ts` around
lines 6 - 7, Remove the implementation comments in and around getTextLines and
the other referenced code locations in messageStateHandler.ts, including the
Slack-link TODO; preserve the existing behavior and rely on descriptive names
and structure instead of explanatory prose.

Source: Coding guidelines

🤖 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.

Outside diff comments:
In `@apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts`:
- Around line 29-30: Resolve the Slack-style link handling issue associated with
the TODO in messageStateHandler.ts before release. Add a regression test that
reproduces the failure and update the relevant composer/message parsing logic so
Slack-style links with angle brackets work correctly; if this syntax is
intentionally unsupported, remove the misleading TODO and explicitly disable or
reject that handling instead.
- Around line 12-19: Update the delimiter-processing logic around the loop to
reject or otherwise handle an empty delimiter before calling indexOf, preventing
an infinite loop. Replace the single-character trailing-delimiter check with
str.endsWith(delimiter) so the final empty segment is omitted for any
multi-character delimiter, and add a regression test covering a trailing
multi-character delimiter.

---

Nitpick comments:
In `@apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts`:
- Around line 6-7: Remove the implementation comments in and around getTextLines
and the other referenced code locations in messageStateHandler.ts, including the
Slack-link TODO; preserve the existing behavior and rely on descriptive names
and structure instead of explanatory prose.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cb832a31-7dcc-424e-b137-4ca9dfc609a9

📥 Commits

Reviewing files that changed from the base of the PR and between efce301 and 22c0b8f.

📒 Files selected for processing (6)
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
  • apps/meteor/app/ui-message/client/messageBox/selectionRange.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/app/ui-message/client/messageBox/selectionRange.ts
  • apps/meteor/app/ui-message/client/messageBox/composerHistory.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Hacktron Security Check
  • GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (5)

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ❌ **No merge conflicts** — This PR has conflicts, please resolve them before merging
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ❌ **Mergeable** — This PR is not mergeable
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**

GitHub Check: Dionisio QA: Some checks did not pass

Conclusion: failure

View job details

**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
**/*.spec.ts

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

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
🧠 Learnings (5)
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts
  • apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts
🪛 ast-grep (0.44.1)
apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts

[warning] 35-35: Direct modification of innerHTML or outerHTML properties detected. Modifying these properties with unsanitized user input can lead to XSS vulnerabilities. Use safe alternatives or sanitize content first.
Context: document.body.innerHTML = ''
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(dom-content-modification)

apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts

[warning] 13-13: Direct HTML content assignment detected. Modifying innerHTML, outerHTML, or using document.write with unsanitized content can lead to XSS vulnerabilities. Use secure alternatives like textContent or sanitize HTML with libraries like DOMPurify.
Context: input.innerHTML = '

original

'
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(unsafe-html-content-assignment)


[warning] 8-8: Direct modification of innerHTML or outerHTML properties detected. Modifying these properties with unsanitized user input can lead to XSS vulnerabilities. Use safe alternatives or sanitize content first.
Context: document.body.innerHTML = ''
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(dom-content-modification)


[warning] 13-13: Direct modification of innerHTML or outerHTML properties detected. Modifying these properties with unsanitized user input can lead to XSS vulnerabilities. Use safe alternatives or sanitize content first.
Context: input.innerHTML = '

original

'
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(dom-content-modification)

apps/meteor/app/ui-message/client/messageBox/messageStateHandler.ts

[warning] 94-94: Direct modification of innerHTML or outerHTML properties detected. Modifying these properties with unsanitized user input can lead to XSS vulnerabilities. Use safe alternatives or sanitize content first.
Context: target.innerHTML = finalHtml
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(dom-content-modification)


[warning] 94-94: Direct HTML content assignment detected. Modifying innerHTML, outerHTML, or using document.write with unsanitized content can lead to XSS vulnerabilities. Use secure alternatives like textContent or sanitize HTML with libraries like DOMPurify.
Context: target.innerHTML = finalHtml
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation

(unsafe-html-content-assignment)

🔇 Additional comments (2)
apps/meteor/app/ui-message/client/messageBox/composerHistory.spec.ts (1)

1-297: LGTM!

apps/meteor/app/ui-message/client/messageBox/messageStateHandler.spec.ts (1)

1-25: LGTM!

@MartinSchoeler
MartinSchoeler force-pushed the poc/real-time-composer branch from 5c9e250 to 21feab1 Compare July 22, 2026 18:04
@MartinSchoeler
MartinSchoeler force-pushed the chore/real-time-composer-history branch from 22c0b8f to 96b2604 Compare July 22, 2026 18:04
@MartinSchoeler
MartinSchoeler force-pushed the chore/real-time-composer-history branch from 32403eb to a631f13 Compare July 23, 2026 15:04

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/meteor/tests/e2e/message-composer-history.spec.ts Outdated
@MartinSchoeler
MartinSchoeler force-pushed the chore/real-time-composer-history branch from de5d971 to 065c329 Compare July 24, 2026 14:46
test: fix test

Revert "test: fix test"

This reverts commit de5d971.

skip test
@MartinSchoeler
MartinSchoeler force-pushed the chore/real-time-composer-history branch from 065c329 to 4b76049 Compare July 24, 2026 15:08
@MartinSchoeler
MartinSchoeler merged commit be5156e into poc/real-time-composer Jul 24, 2026
55 of 56 checks passed
@MartinSchoeler
MartinSchoeler deleted the chore/real-time-composer-history branch July 24, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants