Skip to content

feat: add rooms.join endpoint for all room types#40996

Merged
ggazzo merged 9 commits into
developfrom
feat/rooms-join-endpoint
Jun 19, 2026
Merged

feat: add rooms.join endpoint for all room types#40996
ggazzo merged 9 commits into
developfrom
feat/rooms-join-endpoint

Conversation

@ggazzo

@ggazzo ggazzo commented Jun 17, 2026

Copy link
Copy Markdown
Member

Proposed changes

Follow-up to #40711, which left this ddp-removal TODO:

// TODO(ddp-removal): only public channels resolve through this endpoint;
// private groups, DMs and livechat used to error via DDP too — REST keeps
// that behavior. Replace with a unified `/v1/rooms.join` when available.
await sdk.rest.post('/v1/channels.join', { roomId: rid });

This PR adds that unified endpoint.

Adds POST /v1/rooms.join, which lets a user join any room type, replicating the behavior of the deprecated joinRoom DDP method (slated for removal in 9.0.0).

channels.join only resolves public c channels — private groups, DMs and livechat error out. The new endpoint funnels all room types through the shared Room.join service, so it applies the same access checks, join-code validation, federation and omnichannel rules as the DDP method.

Changes

  • rest-typings: new RoomsJoinProps + isRoomsJoinProps (accepts { roomId | roomName, joinCode? }) and /v1/rooms.join endpoint type returning { room }.
  • apps/meteor API: new rooms.join route calling Room.join({ room, user, joinCode }).
  • Client: switched join callers (useJoinRoom, chats/data, ComposerJoinWithPassword, ComposerReadOnly) from channels.join to rooms.join; removed the ddp-removal TODOs added in feat: extend 4 REST endpoints + migrate 7 DDP callers #40711.

Todo

  • End-to-end API tests for rooms.join (public channel, discussion, private-group not-allowed, join-code cases)
  • Full tsc on apps/meteor

Issue(s)

Follow-up to #40711.

How to test the changes

  1. POST /api/v1/rooms.join with { "roomId": "<public channel>" } → joins.
  2. Same with a private group the user can access → joins (previously errored via channels.join).
  3. Public channel with a join code → error-code-required without code, joins with correct code.

ARCH-2164

Summary by CodeRabbit

  • New Features
    • Added POST /v1/rooms.join so users can join any room type using roomId or roomName, with optional join-code support.
    • Updated client join flows (including password join and composer join actions) to use rooms.join.
  • Bug Fixes
    • Updated legacy join deprecation routing to reference rooms.join for consistent join behavior.
  • Tests
    • Added/updated end-to-end API and UI coverage for public/private access rules, discussion parent linkage, and join-code enforcement.

https://rocketchat.atlassian.net/browse/CORE-2296

Add a unified POST /v1/rooms.join REST endpoint that lets a user join
any room type, replicating the behavior of the deprecated joinRoom DDP
method. Unlike channels.join (public channels only), it resolves all
room types through the shared Room.join service, applying access,
join-code, federation and omnichannel checks.

Switch the client join callers from channels.join to rooms.join.
@dionisio-bot

dionisio-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b52aead

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

This PR includes changesets to release 3 packages
Name Type
@rocket.chat/meteor Minor
@rocket.chat/rest-typings Minor
@rocket.chat/core-typings Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 17, 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

Introduces a new POST /v1/rooms.join REST endpoint that supersedes the channel-scoped /v1/channels.join. The endpoint type contract and AJV validator are added to rest-typings, the server handler is implemented in the rooms API, the deprecated joinRoom DDP method's logger reference is updated, and all client call sites are migrated to the new endpoint. Comprehensive end-to-end tests validate the full feature including room resolution, access control, join-code enforcement, and UI join flow.

Changes

rooms.join REST endpoint

Layer / File(s) Summary
REST type contract and AJV validator
packages/rest-typings/src/v1/rooms.ts
Exports RoomsJoinProps (oneOf roomId/roomName with optional joinCode) and isRoomsJoinProps AJV validator; extends RoomsEndpoints with the POST /v1/rooms.join signature returning { room: IRoom }.
Server endpoint and deprecation logger update
apps/meteor/app/api/server/v1/rooms.ts, apps/meteor/app/lib/server/methods/joinRoom.ts, .changeset/rooms-join-endpoint.md
Implements the authenticated POST rooms.join handler that validates input, resolves the room via findRoomByIdOrName, calls Room.join, and returns the room. Updates the joinRoom DDP method's methodDeprecationLogger reference from /v1/channels.join to /v1/rooms.join.
Client call site migration
apps/meteor/client/hooks/useJoinRoom.ts, apps/meteor/client/lib/chats/data.ts, apps/meteor/client/views/room/composer/ComposerJoinWithPassword.tsx, apps/meteor/client/views/room/composer/ComposerReadOnly.tsx
Replaces all /v1/channels.join call sites with /v1/rooms.join across the join hook, chat data layer, and both composer components, removing stale inline comments.
End-to-end API tests
apps/meteor/tests/end-to-end/api/rooms.ts
Tests room resolution by roomId and roomName, validates access control for public vs. private groups, verifies discussion room parent linkage (prid), enforces join-code requirements, rejects incorrect codes, and permits joins with correct codes under permission constraints.
End-to-end UI test
apps/meteor/tests/e2e/rooms-join.spec.ts
Tests the non-member join flow for public channels and discussion rooms across multiple scenarios: public channels with and without preview-c-room permission, discussions with preview-c-room, and discussions inside private channels. Verifies join button visibility, state transitions after clicking, and composer enablement.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Suggested reviewers

  • tassoevan
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately and specifically describes the main change: adding a new rooms.join endpoint that works with all room types, which is the core objective of this changeset.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • ARCH-2164: 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 and usage tips.

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.55556% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.13%. Comparing base (928346f) to head (b52aead).
⚠️ Report is 12 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40996      +/-   ##
===========================================
+ Coverage    70.11%   70.13%   +0.02%     
===========================================
  Files         3357     3359       +2     
  Lines       129542   129609      +67     
  Branches     22404    22447      +43     
===========================================
+ Hits         90832    90905      +73     
+ Misses       35420    35397      -23     
- Partials      3290     3307      +17     
Flag Coverage Δ
e2e 59.33% <75.00%> (+0.07%) ⬆️
e2e-api 46.22% <ø> (+0.01%) ⬆️
unit 70.07% <33.33%> (-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.

@ggazzo ggazzo added this to the 8.6.0 milestone Jun 17, 2026
@ggazzo ggazzo marked this pull request as ready for review June 17, 2026 21:30
@ggazzo ggazzo requested review from a team as code owners June 17, 2026 21:30
@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label Jun 17, 2026

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

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/rest-typings/src/v1/rooms.ts">

<violation number="1" location="packages/rest-typings/src/v1/rooms.ts:767">
P2: `RoomsJoinProps` is out of sync with its Ajv schema: schema accepts `joinCode: null` but the type does not. This creates unsound typing for consumers of `isRoomsJoinProps` and downstream `joinCode` handling.</violation>
</file>

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

Re-trigger cubic


export const isRoomsOpenProps = ajv.compile<RoomsOpenProps>(roomsOpenSchema);

export type RoomsJoinProps = { roomId: string; joinCode?: string } | { roomName: string; joinCode?: string };

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.

P2: RoomsJoinProps is out of sync with its Ajv schema: schema accepts joinCode: null but the type does not. This creates unsound typing for consumers of isRoomsJoinProps and downstream joinCode handling.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/rest-typings/src/v1/rooms.ts, line 767:

<comment>`RoomsJoinProps` is out of sync with its Ajv schema: schema accepts `joinCode: null` but the type does not. This creates unsound typing for consumers of `isRoomsJoinProps` and downstream `joinCode` handling.</comment>

<file context>
@@ -764,6 +764,45 @@ const roomsOpenSchema = {
 
 export const isRoomsOpenProps = ajv.compile<RoomsOpenProps>(roomsOpenSchema);
 
+export type RoomsJoinProps = { roomId: string; joinCode?: string } | { roomName: string; joinCode?: string };
+
+const roomsJoinSchema = {
</file context>
Suggested change
export type RoomsJoinProps = { roomId: string; joinCode?: string } | { roomName: string; joinCode?: string };
export type RoomsJoinProps = { roomId: string; joinCode?: string | null } | { roomName: string; joinCode?: string | null };

dougfabris
dougfabris previously approved these changes Jun 17, 2026
Covers joining a public channel by id and name, joining a discussion
(a room with a parent room), the not-allowed case for a private group,
and the join-code required/invalid/correct flows.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@apps/meteor/tests/end-to-end/api/rooms.ts`:
- Around line 1991-1999: In the after() teardown hook, add a deleteRoom call to
explicitly clean up the testDiscussion room that was created in setup at line
1983. Add a Promise.all entry that calls deleteRoom with testDiscussion._id as
the roomId parameter and the appropriate type parameter (check how the
discussion room was created to determine the correct type value). This ensures
the discussion room is explicitly deleted during teardown rather than relying on
parent-room cascade deletion, preventing residual data and cross-test flakiness.
🪄 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: 43218c3a-20e4-4edb-ad0c-bd94e6fbcf31

📥 Commits

Reviewing files that changed from the base of the PR and between 2aabed4 and 309584d.

📒 Files selected for processing (1)
  • apps/meteor/tests/end-to-end/api/rooms.ts
📜 Review details
⏰ 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). (5)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: Hacktron Security Check
  • 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:

  • apps/meteor/tests/end-to-end/api/rooms.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:

  • apps/meteor/tests/end-to-end/api/rooms.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/tests/end-to-end/api/rooms.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/tests/end-to-end/api/rooms.ts

Comment thread apps/meteor/tests/end-to-end/api/rooms.ts

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/meteor/tests/end-to-end/api/rooms.ts">

<violation number="1" location="apps/meteor/tests/end-to-end/api/rooms.ts:1995">
P2: Missing cleanup of testDiscussion in the after block. The discussion room created in `before` will remain orphaned after tests finish, polluting the database.</violation>
</file>

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

Re-trigger cubic

Comment thread apps/meteor/tests/end-to-end/api/rooms.ts
Covers a non-member joining a public channel and a discussion through the
"Join channel" UI, which calls /v1/rooms.join via useJoinRoom.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/meteor/tests/e2e/rooms-join.spec.ts (2)

55-55: ⚡ Quick win

Use a precise type for discussion instead of Record<string, string>.

Record<string, string> is too broad for _id/name usage and weakens compile-time guarantees.

Suggested typing improvement
-let discussion: Record<string, string>;
+let discussion: Awaited<ReturnType<typeof createTargetDiscussion>>;

As per coding guidelines, “Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests.”

🤖 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/tests/e2e/rooms-join.spec.ts` at line 55, The `discussion`
variable is typed too broadly as `Record<string, string>`, which weakens type
safety for the `_id` and `name` properties used throughout the test. Replace
this generic Record type with a precise interface or type definition that
explicitly declares the expected properties (such as `_id: string` and `name:
string`) to improve compile-time guarantees and provide better type checking in
the Playwright test.

Source: Coding guidelines


12-13: ⚡ Quick win

Remove inline implementation comments in this spec.

Move this intent into helper naming or test-step naming instead of comments.

As per coding guidelines, “Avoid code comments in the implementation.”

🤖 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/tests/e2e/rooms-join.spec.ts` around lines 12 - 13, The inline
comments at lines 12-13 in rooms-join.spec.ts explaining the intent about
restricting preview to admin and the useJoinRoom behavior should be removed per
coding guidelines to avoid implementation comments. Instead, refactor the test
setup and steps to use descriptive helper function names or clear test step
descriptions that self-document the intent without requiring explanatory
comments, so the purpose is evident from the code structure itself.

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 `@apps/meteor/tests/e2e/rooms-join.spec.ts`:
- Around line 11-19: The test suite is using test.beforeAll and test.afterAll
hooks to globally modify the preview-c-room permission, which persists across
all tests in the suite and affects parallel test execution in other spec files.
Replace test.beforeAll with test.beforeEach and test.afterAll with
test.afterEach so that the permission change is scoped to individual test
execution rather than the entire suite. This ensures each test modifies and
restores the permission independently, maintaining test isolation when running
tests in parallel.

---

Nitpick comments:
In `@apps/meteor/tests/e2e/rooms-join.spec.ts`:
- Line 55: The `discussion` variable is typed too broadly as `Record<string,
string>`, which weakens type safety for the `_id` and `name` properties used
throughout the test. Replace this generic Record type with a precise interface
or type definition that explicitly declares the expected properties (such as
`_id: string` and `name: string`) to improve compile-time guarantees and provide
better type checking in the Playwright test.
- Around line 12-13: The inline comments at lines 12-13 in rooms-join.spec.ts
explaining the intent about restricting preview to admin and the useJoinRoom
behavior should be removed per coding guidelines to avoid implementation
comments. Instead, refactor the test setup and steps to use descriptive helper
function names or clear test step descriptions that self-document the intent
without requiring explanatory comments, so the purpose is evident from the code
structure itself.
🪄 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: 711b8c8b-b35e-4280-a9ba-db4d13b220ab

📥 Commits

Reviewing files that changed from the base of the PR and between 309584d and 391fcd6.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/rooms-join.spec.ts
📜 Review details
⏰ 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: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 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/tests/e2e/rooms-join.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/tests/e2e/rooms-join.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/rooms-join.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/rooms-join.spec.ts
🧠 Learnings (6)
📚 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/tests/e2e/rooms-join.spec.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/rooms-join.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/tests/e2e/rooms-join.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/tests/e2e/rooms-join.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/tests/e2e/rooms-join.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/tests/e2e/rooms-join.spec.ts
🔇 Additional comments (1)
apps/meteor/tests/e2e/rooms-join.spec.ts (1)

40-49: LGTM!

Also applies to: 65-74

Comment thread apps/meteor/tests/e2e/rooms-join.spec.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.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/rest-typings/src/v1/rooms.ts">

<violation number="1" location="packages/rest-typings/src/v1/rooms.ts:767">
P2: `RoomsJoinProps` is out of sync with its Ajv schema: schema accepts `joinCode: null` but the type does not. This creates unsound typing for consumers of `isRoomsJoinProps` and downstream `joinCode` handling.</violation>
</file>

<file name="apps/meteor/tests/end-to-end/api/rooms.ts">

<violation number="1" location="apps/meteor/tests/end-to-end/api/rooms.ts:1995">
P2: Missing cleanup of testDiscussion in the after block. The discussion room created in `before` will remain orphaned after tests finish, polluting the database.</violation>
</file>

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

Re-trigger cubic

Comment thread apps/meteor/tests/e2e/rooms-join.spec.ts Outdated
A member of the private parent (but not of the discussion) joins the
type-`p` discussion via rooms.join; access is inherited from the parent,
a case channels.join could not handle.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/meteor/tests/e2e/rooms-join.spec.ts (2)

57-69: ⚡ Quick win

Remove duplicated HomeChannel initialization in beforeEach hooks.

Line 58 and Line 67 both assign poHomeChannel = new HomeChannel(page). The first hook is redundant.

Proposed simplification
-	test.beforeEach(async ({ page }) => {
-		poHomeChannel = new HomeChannel(page);
-	});
-
 	test.beforeEach(async ({ api }) => {
 		targetChannel = await createTargetChannel(api);
 		await sendTargetChannelMessage(api, targetChannel, { msg: 'message from a channel the user has not joined' });
 	});
🤖 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/tests/e2e/rooms-join.spec.ts` around lines 57 - 69, The first
beforeEach hook (lines 57-59) contains a redundant initialization of
poHomeChannel with new HomeChannel(page) that is duplicated in the third
beforeEach hook (lines 65-69). Remove the entire first beforeEach hook that only
contains the poHomeChannel initialization, keeping only the second beforeEach
hook that handles API setup and the third beforeEach hook that initializes
poHomeChannel and navigates to the channel.

124-126: ⚡ Quick win

Use test.step() for this complex flow and remove inline TODO comments.

This scenario has multiple phases (join action + cache-workaround verification). Wrapping them with test.step() will make reporting clearer and keeps intent out of inline implementation comments.

As per coding guidelines, “Use test.step() for complex test scenarios to improve organization in Playwright tests” and “Avoid code comments in the implementation.”

Also applies to: 143-145, 137-150

🤖 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/tests/e2e/rooms-join.spec.ts` around lines 124 - 126, The test
contains complex multi-phase scenarios described with inline comments instead of
using Playwright's test.step() for organization. Replace the inline comment
blocks (such as the comments explaining the discussion type inheritance and user
membership scenarios around lines 124-126, 137-150, and 143-145) with
corresponding test.step() calls that describe each phase, removing the
implementation comments and letting the step descriptions capture the intent and
context of each phase in the test flow.

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 `@apps/meteor/tests/e2e/rooms-join.spec.ts`:
- Around line 19-50: The test suite at line 19 is incorrectly using test.skip()
which is only for individual tests; change it to test.describe.skip() to
properly skip the entire suite with its hooks and nested tests. Additionally,
the variable poHomeChannel is referenced in the nested test (around line 46) but
is never initialized, so you need to declare and initialize poHomeChannel in the
beforeEach hook (the one that takes the page parameter) to set up the page
object before each test runs, similar to how it would be done in other test
suites.

---

Nitpick comments:
In `@apps/meteor/tests/e2e/rooms-join.spec.ts`:
- Around line 57-69: The first beforeEach hook (lines 57-59) contains a
redundant initialization of poHomeChannel with new HomeChannel(page) that is
duplicated in the third beforeEach hook (lines 65-69). Remove the entire first
beforeEach hook that only contains the poHomeChannel initialization, keeping
only the second beforeEach hook that handles API setup and the third beforeEach
hook that initializes poHomeChannel and navigates to the channel.
- Around line 124-126: The test contains complex multi-phase scenarios described
with inline comments instead of using Playwright's test.step() for organization.
Replace the inline comment blocks (such as the comments explaining the
discussion type inheritance and user membership scenarios around lines 124-126,
137-150, and 143-145) with corresponding test.step() calls that describe each
phase, removing the implementation comments and letting the step descriptions
capture the intent and context of each phase in the test flow.
🪄 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: ffbe1720-355b-4356-8daf-06b7c34d8b1a

📥 Commits

Reviewing files that changed from the base of the PR and between 391fcd6 and 12cac3e.

📒 Files selected for processing (1)
  • apps/meteor/tests/e2e/rooms-join.spec.ts
📜 Review details
⏰ 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). (3)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🧰 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/tests/e2e/rooms-join.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/tests/e2e/rooms-join.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/rooms-join.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/rooms-join.spec.ts
🧠 Learnings (6)
📚 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/tests/e2e/rooms-join.spec.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/rooms-join.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/tests/e2e/rooms-join.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/tests/e2e/rooms-join.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/tests/e2e/rooms-join.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/tests/e2e/rooms-join.spec.ts

Comment thread apps/meteor/tests/e2e/rooms-join.spec.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.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/rest-typings/src/v1/rooms.ts">

<violation number="1" location="packages/rest-typings/src/v1/rooms.ts:767">
P2: `RoomsJoinProps` is out of sync with its Ajv schema: schema accepts `joinCode: null` but the type does not. This creates unsound typing for consumers of `isRoomsJoinProps` and downstream `joinCode` handling.</violation>
</file>

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

Re-trigger cubic

Comment thread apps/meteor/tests/e2e/rooms-join.spec.ts Outdated
ggazzo added 3 commits June 18, 2026 12:59
useJoinRoom invalidated a stale React Query key (['rooms', { reference,
type }]) that no longer matched the open-room query key
(roomsQueryKeys.roomReference => ['rooms', reference, type, uid]). The
invalidation matched nothing, so the 'not subscribed' screen kept
rendering until a manual reload. Invalidate the correct ['rooms',
reference, type] prefix instead, and re-enable the e2e coverage.
Comment thread apps/meteor/tests/e2e/rooms-join.spec.ts Outdated
Comment thread apps/meteor/tests/e2e/rooms-join.spec.ts
Co-authored-by: dougfabris <devfabris@gmail.com>
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Jun 19, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jun 19, 2026
@ggazzo ggazzo merged commit fa685d0 into develop Jun 19, 2026
83 of 85 checks passed
@ggazzo ggazzo deleted the feat/rooms-join-endpoint branch June 19, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants