chore: improve voip enums definitions - #41045
Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📜 Recent review details⏰ Context from checks skipped due to timeout. (5)
WalkthroughFive files in Changesas-const list refactor for call and client types
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
packages/media-signaling/src/definition/call/IClientMediaCall.ts (1)
18-23: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winRemove inline implementation comments from list items.
Please move these inline comments to external docs/types if needed; the current style conflicts with the repository guideline.
As per coding guidelines,
**/*.{ts,tsx,js}requires: “Avoid code comments in the implementation.”Also applies to: 29-47, 61-64, 70-79
🤖 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 `@packages/media-signaling/src/definition/call/IClientMediaCall.ts` around lines 18 - 23, Remove all inline comments from the enum or type definition in IClientMediaCall that currently explain each state value. The inline comments like "trying to call with no idea if it'll reach anyone" next to 'none', and similar comments for 'ringing', 'accepted', 'active', 'renegotiating', and 'hangup' should be deleted. If these descriptions are necessary for documentation purposes, convert them to JSDoc comments above the enum/type declaration instead of keeping them as inline implementation comments. Apply this change across all affected sections mentioned in the review (lines 18-23, 29-47, 61-64, 70-79).Source: Coding guidelines
packages/media-signaling/src/definition/client.ts (1)
2-13: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winDrop inline comments inside enum value arrays.
This implementation style conflicts with the repository TS/JS guideline; move rationale to docs/types instead.
As per coding guidelines,
**/*.{ts,tsx,js}requires: “Avoid code comments in the implementation.”Also applies to: 19-23
🤖 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 `@packages/media-signaling/src/definition/client.ts` around lines 2 - 13, Remove all inline comments that appear after each string value in the enum or array definition in the client.ts file (such as the comments following 'none', 'pending', 'accepting', 'waiting-for-track', etc., both in the lines 2-13 range and the also-applies-to lines 19-23). Instead, move the documentation and rationale for each state value to a JSDoc comment block at the top of the enum or type definition to document the entire type, which aligns with the repository's TS/JS guideline against inline code comments in implementations.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.
Inline comments:
In `@packages/media-signaling/src/definition/call/IClientMediaCall.ts`:
- Around line 17-27: Add the `as const` assertion to the end of all five array
declarations (callStateList, callHangupReasonList, callNotificationList,
callRejectedReasonList, callFlagList) to ensure their derived types are literal
unions instead of widening to string. Additionally, remove all inline comments
from the array elements as they violate the coding guideline against code
comments in TypeScript implementations, keeping only the array values
themselves.
In `@packages/media-signaling/src/definition/client.ts`:
- Around line 1-16: Add `as const` assertion to the end of the `clientStateList`
array declaration to ensure the derived `ClientState` type becomes a union of
literal string types rather than a generic string type. This will preserve
compile-time validation for state values and prevent the type from widening to
string.
---
Nitpick comments:
In `@packages/media-signaling/src/definition/call/IClientMediaCall.ts`:
- Around line 18-23: Remove all inline comments from the enum or type definition
in IClientMediaCall that currently explain each state value. The inline comments
like "trying to call with no idea if it'll reach anyone" next to 'none', and
similar comments for 'ringing', 'accepted', 'active', 'renegotiating', and
'hangup' should be deleted. If these descriptions are necessary for
documentation purposes, convert them to JSDoc comments above the enum/type
declaration instead of keeping them as inline implementation comments. Apply
this change across all affected sections mentioned in the review (lines 18-23,
29-47, 61-64, 70-79).
In `@packages/media-signaling/src/definition/client.ts`:
- Around line 2-13: Remove all inline comments that appear after each string
value in the enum or array definition in the client.ts file (such as the
comments following 'none', 'pending', 'accepting', 'waiting-for-track', etc.,
both in the lines 2-13 range and the also-applies-to lines 19-23). Instead, move
the documentation and rationale for each state value to a JSDoc comment block at
the top of the enum or type definition to document the entire type, which aligns
with the repository's TS/JS guideline against inline code comments in
implementations.
🪄 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: 56ccfcca-a26b-4b04-8be7-5d053d06c9ff
📒 Files selected for processing (5)
packages/media-signaling/src/definition/call/IClientMediaCall.tspackages/media-signaling/src/definition/client.tspackages/media-signaling/src/definition/index.tspackages/media-signaling/src/definition/signals/client/hangup.tspackages/media-signaling/src/definition/signals/client/local-state.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
- GitHub Check: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
packages/media-signaling/src/definition/signals/client/hangup.tspackages/media-signaling/src/definition/index.tspackages/media-signaling/src/definition/client.tspackages/media-signaling/src/definition/signals/client/local-state.tspackages/media-signaling/src/definition/call/IClientMediaCall.ts
🧠 Learnings (3)
📚 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:
packages/media-signaling/src/definition/signals/client/hangup.tspackages/media-signaling/src/definition/index.tspackages/media-signaling/src/definition/client.tspackages/media-signaling/src/definition/signals/client/local-state.tspackages/media-signaling/src/definition/call/IClientMediaCall.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:
packages/media-signaling/src/definition/signals/client/hangup.tspackages/media-signaling/src/definition/index.tspackages/media-signaling/src/definition/client.tspackages/media-signaling/src/definition/signals/client/local-state.tspackages/media-signaling/src/definition/call/IClientMediaCall.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:
packages/media-signaling/src/definition/signals/client/hangup.tspackages/media-signaling/src/definition/index.tspackages/media-signaling/src/definition/client.tspackages/media-signaling/src/definition/signals/client/local-state.tspackages/media-signaling/src/definition/call/IClientMediaCall.ts
🔇 Additional comments (3)
packages/media-signaling/src/definition/index.ts (1)
5-5: LGTM!packages/media-signaling/src/definition/signals/client/hangup.ts (1)
3-3: LGTM!Also applies to: 33-33
packages/media-signaling/src/definition/signals/client/local-state.ts (1)
3-5: LGTM!Also applies to: 40-45, 64-64
There was a problem hiding this comment.
2 issues found across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #41045 +/- ##
========================================
Coverage 70.09% 70.10%
========================================
Files 3362 3362
Lines 129705 129705
Branches 22466 22459 -7
========================================
+ Hits 90921 90930 +9
+ Misses 35465 35454 -11
- Partials 3319 3321 +2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Proposed changes (including videos or screenshots)
Issue(s)
Derived from CORE-2306
Steps to test or reproduce
Further comments
Summary by CodeRabbit