Skip to content

Conversation

@rocketchat-github-ci
Copy link
Collaborator

@rocketchat-github-ci rocketchat-github-ci commented Nov 14, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Prevented GUI crashes from favicon badge rendering; rendering failures and init errors are now logged without aborting UI.
    • Fixed user-agent extraction so device/session information is read and parsed correctly.
  • Improvements

    • More accurate and efficient unread tracking and badge behavior; reduces client slowdown for users with many channels.
  • Chores

    • Patch version bumps recorded for affected packages.

You can see below a preview of the release change log:

7.12.2

Engine versions

  • Node: 22.16.0
  • Deno: 1.43.5
  • MongoDB: 5.0, 6.0, 7.0
  • Apps-Engine: 1.57.1

Patch Changes

@changeset-bot
Copy link

changeset-bot bot commented Nov 14, 2025

🦋 Changeset detected

Latest commit: 424f3a4

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

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

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Nov 14, 2025

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
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Walkthrough

Adds three changeset files; fixes favicon package to catch and log render/init errors; simplifies extraction of user-agent in device session code; removes a runtime warning from the deprecated /health route; implements per-subscription unread tracking and aggregation in the client unread hook.

Changes

Cohort / File(s) Summary
Changesets
/.changeset/bump-patch-1763145619666.md, /.changeset/cuddly-toys-pay.md, /.changeset/healthy-rabbits-sip.md
Add three changeset metadata files specifying patch releases (including patch for @rocket.chat/meteor and a patch for @rocket.chat/favicon documenting a favicon crash fix and UA extraction fix).
Favicon package
packages/favicon/src/index.ts
Make init() return a Promise and attach .catch to log initialization errors; wrap renderAndUpdate in updateOrCollect with try/catch to log render errors and continue without throwing.
Device session UA extraction
apps/meteor/ee/server/lib/deviceManagement/session.ts
Replace casted Headers access with safe optional access connection?.httpHeaders?.['user-agent'] ?? '' and pass the raw UA string to uaParser.
Deprecated health route
apps/meteor/server/routes/health.ts
Remove SystemLogger.warn call from the deprecated /health endpoint; response headers/body/status unchanged.
Client unread hook
apps/meteor/client/views/root/hooks/loggedIn/useUnread.ts
Replace global unread processing with per-subscription UnreadData snapshot (Map/prevSubsRef), emit unread-changed-by-subscription only on per-sub changes, compute aggregated unread count/badgeIndicator, cap numeric unread at 999, and adjust effect dependencies.

Sequence Diagram(s)

sequenceDiagram
  participant App as App / Service
  participant Favicon as packages/favicon/src/index.ts

  rect rgba(230,247,255,0.4)
    Note right of Favicon: Async initialization (now returns Promise)
    App->>Favicon: init()
    Favicon->>Favicon: perform init tasks
    alt init succeeds
      Favicon-->>App: resolved
    else init fails
      Favicon-->>Favicon: log error
      Favicon-->>App: resolved (no throw)
    end
  end

  rect rgba(255,245,230,0.25)
    Note right of Favicon: Per-badge update (protected)
    App->>Favicon: updateOrCollect(badge)
    Favicon->>Favicon: try renderAndUpdate(badge)
    alt render succeeds
      Favicon-->>App: update applied
    else render throws
      Favicon-->>Favicon: log error and continue
      Favicon-->>App: continue without crash
    end
  end
Loading
sequenceDiagram
  participant Client as Client Hook
  participant Subs as Subscriptions (list)

  rect rgba(230,255,240,0.35)
    Client->>Subs: iterate subscriptions
    loop per-subscription
      Subs-->>Client: unread, alert, unreadAlert
      alt values changed vs prevSubsRef
        Client->>Client: emit unread-changed-by-subscription
      else unchanged
        Client-->>Client: no event
      end
      Client->>Client: accumulate unreadCount and badgeIndicator
    end
    Client-->>Client: set unread display (number/bullet/empty)
    Client-->>Other: trigger favicon update if unread changed
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas to focus:
    • apps/meteor/client/views/root/hooks/loggedIn/useUnread.ts — per-subscription snapshot logic, event emission conditions, dependency list correctness, and UI value setting (edge cases around badge vs numeric).
    • packages/favicon/src/index.ts — promise flow for init(), logging behavior, and ensuring no silent failures hide regressions.
    • apps/meteor/ee/server/lib/deviceManagement/session.ts — UA extraction behavior when headers are absent and effects on downstream uaParser.
    • Quick check: removal of SystemLogger.warn in apps/meteor/server/routes/health.ts for intended telemetry implications.

Possibly related PRs

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • ggazzo
  • tassoevan

Poem

🐰 I hopped through diffs and mended frayed threads,
Wrapped renders in safety, so badges rest their heads,
UA trimmed with care, health warnings set aside,
Subscriptions counted softly, no noisy update tide,
A tiny rabbit nod — the code now sleeps with pride. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Release 7.12.2' accurately reflects the main purpose of the pull request, which is a release merge that bumps version numbers and includes multiple patch fixes and dependency updates.
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 release-7.12.2

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.55%. Comparing base (5f1f831) to head (c6b2e7e).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #37519   +/-   ##
=======================================
  Coverage   66.55%   66.55%           
=======================================
  Files        3392     3392           
  Lines      115843   115843           
  Branches    21393    21394    +1     
=======================================
+ Hits        77097    77104    +7     
+ Misses      36069    36061    -8     
- Partials     2677     2678    +1     
Flag Coverage Δ
unit 71.59% <ø> (+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.

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: 0

🧹 Nitpick comments (1)
packages/favicon/src/index.ts (1)

98-102: Good defensive error handling for render failures.

The try-catch prevents rendering errors (e.g., cross-origin issues during canvas operations) from crashing the application. Logging to console is appropriate for debugging.

If favicon rendering errors become frequent in production, consider adding telemetry/metrics to track the error rate, which would help identify systemic issues (e.g., misconfigured CORS headers on favicon endpoints).

📜 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 7366e8d and fadc449.

📒 Files selected for processing (2)
  • .changeset/cuddly-toys-pay.md (1 hunks)
  • packages/favicon/src/index.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/cuddly-toys-pay.md
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: cardoso
Repo: RocketChat/Rocket.Chat PR: 36942
File: apps/meteor/client/lib/e2ee/keychain.ts:148-156
Timestamp: 2025-10-16T21:09:51.816Z
Learning: In the RocketChat/Rocket.Chat repository, only platforms with native crypto.randomUUID() support are targeted, so fallback implementations for crypto.randomUUID() are not required in E2EE or cryptographic code.
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37408
File: apps/meteor/client/views/admin/ABAC/useRoomAttributeOptions.tsx:53-69
Timestamp: 2025-11-10T19:06:20.146Z
Learning: In the Rocket.Chat repository, do not provide suggestions or recommendations about code sections marked with TODO comments. The maintainers have already identified these as future work and external reviewers lack the full context about implementation plans and timing.
⏰ 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). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: update-pr
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (1)
packages/favicon/src/index.ts (1)

111-113: Appropriate error handling for initialization failures.

The catch handler prevents unhandled promise rejections while allowing the manager to continue operating in a degraded mode. If initialization fails, the returned function will accumulate badge updates without rendering them—an acceptable trade-off for preventing crashes in a non-critical UI feature.

@kodiakhq kodiakhq bot requested a review from a team as a code owner November 18, 2025 20:01
@kodiakhq kodiakhq bot requested a review from a team as a code owner November 18, 2025 21:05
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: 0

🧹 Nitpick comments (2)
apps/meteor/client/views/root/hooks/loggedIn/useUnread.ts (2)

3-3: Per‑subscription snapshot approach looks solid; consider minor type tightening

The UnreadData + prevSubsRef snapshot pattern is a good way to avoid emitting per‑subscription events when nothing relevant changed, and using a Map keyed by rid keeps lookups cheap even with many subscriptions.

If you want to reduce the risk of future drift, you could consider deriving UnreadData from the subscription type (e.g., Pick<ISubscription, 'unread' | 'alert' | 'unreadAlert'>) instead of re‑declaring it with string | undefined, but this is a nice‑to‑have rather than required.

Also applies to: 11-12, 23-28


30-33: Unread aggregation and badge logic seem correct; you might gate some work on value changes

The per‑subscription loop and aggregation look consistent with the intended behavior: you sum unread only for subscriptions that should contribute, and fall back from a numeric total to a single when there are only “alert without unread” cases (e.g., mentions), which keeps the UI semantics clear.

Two small points you may want to consider:

  1. Gating global event / session update (optional):
    fireEventUnreadChanged(unreadCount) and setUnread(...) run on every effect execution, even when unreadCount and the derived display value are unchanged. If this ends up hot in practice, you could track the previous aggregate in a useRef and only emit/update when the value actually changes, while still keeping the per‑subscription snapshot logic as‑is.

  2. Confirm unreadAlert override semantics:
    The condition

    if (alert === true && subscriptionUnreadAlert !== 'nothing') {
      if (subscriptionUnreadAlert === 'all' || unreadAlertEnabled !== false) {
        badgeIndicator = '•';
      }
    }

    effectively treats any non‑'nothing' global preference the same (unreadAlertEnabled !== false), and only lets a per‑subscription override of 'all' bypass a global false. That’s probably intentional, but it does bake in specific override semantics; worth double‑checking against the previous implementation / product expectations to ensure there’s no behavioral regression for combinations like global “nothing” with per‑room “mentions”.

Also applies to: 34-52, 53-53, 55-58, 62-64

📜 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 c6b2e7e and 424f3a4.

📒 Files selected for processing (2)
  • .changeset/quiet-cars-smile.md (1 hunks)
  • apps/meteor/client/views/root/hooks/loggedIn/useUnread.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/quiet-cars-smile.md
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: cardoso
Repo: RocketChat/Rocket.Chat PR: 36942
File: apps/meteor/client/lib/e2ee/keychain.ts:148-156
Timestamp: 2025-10-16T21:09:51.816Z
Learning: In the RocketChat/Rocket.Chat repository, only platforms with native crypto.randomUUID() support are targeted, so fallback implementations for crypto.randomUUID() are not required in E2EE or cryptographic code.
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37408
File: apps/meteor/client/views/admin/ABAC/useRoomAttributeOptions.tsx:53-69
Timestamp: 2025-11-10T19:06:20.146Z
Learning: In the Rocket.Chat repository, do not provide suggestions or recommendations about code sections marked with TODO comments. The maintainers have already identified these as future work and external reviewers lack the full context about implementation plans and timing.

@rocketchat-github-ci rocketchat-github-ci merged commit 424f3a4 into master Nov 21, 2025
27 of 33 checks passed
@rocketchat-github-ci rocketchat-github-ci deleted the release-7.12.2 branch November 21, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants