refactor(client): Meteor-less absoluteUrl()#40324
Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
|
/jira ARCH-2083 |
|
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 (1)
✅ Files skipped from review due to trivial changes (1)
📜 Recent 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). (2)
WalkthroughThis PR extracts URL utility logic from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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)
apps/meteor/client/lib/absoluteUrl.ts (2)
1-1: Drop the leading remark.Per the repository coding guideline "Avoid code comments in the implementation," this speculative note should not live in the source file. If the future relocation needs to be tracked, prefer the PR description, an ADR, or an issue.
♻️ Proposed change
-// There is a good chance this module may be promoted to root lib/ in the future - import { baseURI } from './baseURI';As per coding guidelines:
**/*.{ts,tsx,js}— "Avoid code comments in the implementation".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/meteor/client/lib/absoluteUrl.ts` at line 1, Remove the speculative leading file comment in the absoluteUrl.ts module—the line "// There is a good chance this module may be promoted to root lib/ in the future"—so the implementation contains no extraneous comments; if relocation needs tracking, add the note to the PR description, an ADR, or an issue instead.
11-15: Add an overload to type the polymorphic call shape.The body accepts
absoluteUrl(options)(options-as-first-arg) but the declared signature only models(path?, options?). This forcesas anyat call sites/tests (e.g.,absoluteUrl.spec.tsLine 63). Adding an overload restores type safety without changing runtime behavior.♻️ Proposed overloads
-export function absoluteUrl(path?: string, options?: AbsoluteUrlOptions): string { +export function absoluteUrl(options?: AbsoluteUrlOptions): string; +export function absoluteUrl(path?: string, options?: AbsoluteUrlOptions): string; +export function absoluteUrl(path?: string | AbsoluteUrlOptions, options?: AbsoluteUrlOptions): string { if (!options && typeof path === 'object') { options = path; path = undefined; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/meteor/client/lib/absoluteUrl.ts` around lines 11 - 15, Add TypeScript overloads to absoluteUrl so callers can pass either (options?: AbsoluteUrlOptions) or (path?: string, options?: AbsoluteUrlOptions) while keeping the same implementation body; update the function declaration for absoluteUrl to include the single-argument overload that accepts AbsoluteUrlOptions and the two-argument overload that accepts (path?: string, options?: AbsoluteUrlOptions), then keep the existing implementation (the block that checks typeof path === 'object' and swaps args) unchanged so runtime behavior stays identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/meteor/client/lib/absoluteUrl.ts`:
- Around line 51-60: The client currently caches defaultOptions.rootUrl at
module load (via absoluteUrl.defaultOptions), causing stale values when
useSettingsOnLoadSiteUrl later mutates __meteor_runtime_config__.ROOT_URL;
update the client-side fix to mirror the server: when useSettingsOnLoadSiteUrl
updates __meteor_runtime_config__.ROOT_URL, also assign
absoluteUrl.defaultOptions.rootUrl (and set defaultOptions.secure if needed) so
Meteor.absoluteUrl uses the new Site_Url, or alternatively refactor the
absoluteUrl() implementation to resolve __meteor_runtime_config__.ROOT_URL
lazily on each call instead of reading it once at module initialization.
In `@apps/meteor/client/providers/ServerProvider.tsx`:
- Line 20: Update the ServerContextValue type so its absoluteUrl signature
matches the new helper: change the declaration of absoluteUrl in
ServerContext.ts to accept optional path and options parameters (i.e.,
absoluteUrl: (path?: string, options?: AbsoluteUrlOptions) => string) and update
the context value creation (the block that constructs the context value around
lines where the ServerContext is created) to conform to that type when assigning
the imported absoluteUrl helper; ensure any references to absoluteUrl within
ServerContextValue and the object built for the context use the optional path
and options parameters.
---
Nitpick comments:
In `@apps/meteor/client/lib/absoluteUrl.ts`:
- Line 1: Remove the speculative leading file comment in the absoluteUrl.ts
module—the line "// There is a good chance this module may be promoted to root
lib/ in the future"—so the implementation contains no extraneous comments; if
relocation needs tracking, add the note to the PR description, an ADR, or an
issue instead.
- Around line 11-15: Add TypeScript overloads to absoluteUrl so callers can pass
either (options?: AbsoluteUrlOptions) or (path?: string, options?:
AbsoluteUrlOptions) while keeping the same implementation body; update the
function declaration for absoluteUrl to include the single-argument overload
that accepts AbsoluteUrlOptions and the two-argument overload that accepts
(path?: string, options?: AbsoluteUrlOptions), then keep the existing
implementation (the block that checks typeof path === 'object' and swaps args)
unchanged so runtime behavior stays identical.
🪄 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: 0cbf4bc4-ce40-494f-ac83-c3ff02ef7862
📒 Files selected for processing (11)
apps/meteor/app/ui/client/lib/recorderjs/AudioEncoder.tsapps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.tsapps/meteor/client/lib/absoluteUrl.tsapps/meteor/client/lib/openCASLoginPopup.tsapps/meteor/client/lib/rooms/roomCoordinator.tsxapps/meteor/client/meteor/login/saml.tsapps/meteor/client/meteor/login/twitter.tsapps/meteor/client/meteor/startup/absoluteUrl.tsapps/meteor/client/providers/ServerProvider.tsxapps/meteor/client/views/root/hooks/useCorsSSLConfig.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: 📦 Build Packages
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 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/client/providers/ServerProvider.tsxapps/meteor/client/meteor/login/saml.tsapps/meteor/app/ui/client/lib/recorderjs/AudioEncoder.tsapps/meteor/client/meteor/login/twitter.tsapps/meteor/client/meteor/startup/absoluteUrl.tsapps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.tsapps/meteor/client/views/root/hooks/useCorsSSLConfig.tsapps/meteor/client/lib/openCASLoginPopup.tsapps/meteor/client/lib/absoluteUrl.spec.tsapps/meteor/client/lib/rooms/roomCoordinator.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.tsextension for test files (e.g.,login.spec.ts)
Files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
🧠 Learnings (31)
📓 Common learnings
Learnt from: smirk-dev
Repo: RocketChat/Rocket.Chat PR: 39625
File: apps/meteor/app/api/server/v1/push.ts:85-97
Timestamp: 2026-03-14T14:58:58.834Z
Learning: In RocketChat/Rocket.Chat, the `push.token` POST/DELETE endpoints in `apps/meteor/app/api/server/v1/push.ts` were already migrated to the chained router API pattern on `develop` prior to PR `#39625`. `cleanTokenResult` (which strips `authToken` and returns `PushTokenResult`) and `isPushTokenPOSTProps`/`isPushTokenDELETEProps` validators already exist on `develop`. PR `#39625` only migrates `push.get` and `push.info` to the chained pattern. Do not flag `cleanTokenResult` or `PushTokenResult` as newly introduced behavior-breaking changes when reviewing this PR.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.
Applied to files:
apps/meteor/client/providers/ServerProvider.tsxapps/meteor/client/meteor/login/twitter.tsapps/meteor/client/lib/openCASLoginPopup.tsapps/meteor/client/lib/rooms/roomCoordinator.tsx
📚 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/providers/ServerProvider.tsxapps/meteor/client/lib/rooms/roomCoordinator.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/meteor/login/saml.tsapps/meteor/client/meteor/login/twitter.tsapps/meteor/client/meteor/startup/absoluteUrl.tsapps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.tsapps/meteor/client/views/root/hooks/useCorsSSLConfig.tsapps/meteor/client/lib/openCASLoginPopup.tsapps/meteor/client/lib/absoluteUrl.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/client/meteor/login/saml.tsapps/meteor/app/ui/client/lib/recorderjs/AudioEncoder.tsapps/meteor/client/meteor/login/twitter.tsapps/meteor/client/meteor/startup/absoluteUrl.tsapps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.tsapps/meteor/client/views/root/hooks/useCorsSSLConfig.tsapps/meteor/client/lib/openCASLoginPopup.tsapps/meteor/client/lib/absoluteUrl.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/client/meteor/login/saml.tsapps/meteor/app/ui/client/lib/recorderjs/AudioEncoder.tsapps/meteor/client/meteor/login/twitter.tsapps/meteor/client/meteor/startup/absoluteUrl.tsapps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.tsapps/meteor/client/views/root/hooks/useCorsSSLConfig.tsapps/meteor/client/lib/openCASLoginPopup.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2025-10-07T15:08:37.419Z
Learnt from: cardoso
Repo: RocketChat/Rocket.Chat PR: 36942
File: apps/meteor/client/lib/e2ee/pbkdf2.ts:13-45
Timestamp: 2025-10-07T15:08:37.419Z
Learning: In apps/meteor/client/lib/e2ee/pbkdf2.ts, the team has decided to use Latin-1 encoding (via Binary.toArrayBuffer and Binary.toString) for password encoding and decrypt output instead of UTF-8 encoding. This is a deliberate choice for E2EE password/key material handling.
Applied to files:
apps/meteor/app/ui/client/lib/recorderjs/AudioEncoder.ts
📚 Learning: 2026-03-09T23:46:52.173Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 39492
File: apps/meteor/app/oauth2-server-config/server/oauth/oauth2-server.ts:22-24
Timestamp: 2026-03-09T23:46:52.173Z
Learning: In `apps/meteor/app/oauth2-server-config/server/oauth/oauth2-server.ts`, the `oAuth2ServerAuth` function's `authorization` field in `partialRequest` is exclusively expected to carry Bearer tokens. Basic authentication is not supported in this OAuth flow, so there is no need to guard against non-Bearer schemes when extracting the token from the `Authorization` header.
Applied to files:
apps/meteor/client/meteor/login/twitter.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`
Applied to files:
apps/meteor/client/meteor/startup/absoluteUrl.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Applied to files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files
Applied to files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests
Applied to files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.
Applied to files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory
Applied to files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2026-03-06T18:09:17.867Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/elements/Timestamp/DateTimeFormats.spec.tsx:20-23
Timestamp: 2026-03-06T18:09:17.867Z
Learning: In the RocketChat/Rocket.Chat gazzodown package (`packages/gazzodown`), tests are intended to run under the UTC timezone, but as of PR `#39397` this is NOT yet explicitly enforced in `jest.config.ts` or the `package.json` test scripts (which just run `jest` without `TZ=UTC`). To make timezone-sensitive snapshot tests reliable across all environments, `TZ=UTC` should be added to the test scripts in `package.json` or to `jest.config.ts` via `testEnvironmentOptions.timezone`. Without explicit UTC enforcement, snapshot tests involving date-fns formatted output or `toLocaleString()` will fail for contributors in non-UTC timezones.
Applied to files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2025-12-16T17:29:45.163Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37834
File: apps/meteor/tests/e2e/page-objects/fragments/admin-flextab-emoji.ts:12-22
Timestamp: 2025-12-16T17:29:45.163Z
Learning: In page object files under `apps/meteor/tests/e2e/page-objects/`, always import `expect` from `../../utils/test` (Playwright's async expect), not from Jest. Jest's `expect` has a synchronous signature and will cause TypeScript errors when used with web-first assertions like `toBeVisible()`.
Applied to files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests
Applied to files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests
Applied to files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file
Applied to files:
apps/meteor/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 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/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.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/client/lib/absoluteUrl.https.spec.tsapps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests
Applied to files:
apps/meteor/client/lib/absoluteUrl.spec.ts
📚 Learning: 2026-04-13T16:40:55.864Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 40100
File: apps/meteor/client/views/root/MainLayout/EmbeddedPreload.tsx:18-35
Timestamp: 2026-04-13T16:40:55.864Z
Learning: In Rocket.Chat's embedded mode (`?layout=embedded`), route changes are driven by the parent frame reloading the iframe URL, which causes a full remount of the React tree (including `EmbeddedPreload` at `apps/meteor/client/views/root/MainLayout/EmbeddedPreload.tsx`). The component never survives a navigation, so `roomParams` (computed via `useMemo`) is always fresh on mount. A `[router]` singleton as the sole `useMemo` dependency is therefore correct and intentional — do not flag it as a stale-dependency bug in this component.
Applied to files:
apps/meteor/client/lib/rooms/roomCoordinator.tsx
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.
Applied to files:
apps/meteor/client/lib/rooms/roomCoordinator.tsx
📚 Learning: 2025-11-04T16:49:19.107Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37377
File: apps/meteor/ee/server/hooks/federation/index.ts:86-88
Timestamp: 2025-11-04T16:49:19.107Z
Learning: In Rocket.Chat's federation system (apps/meteor/ee/server/hooks/federation/), permission checks follow two distinct patterns: (1) User-initiated federation actions (creating rooms, adding users to federated rooms, joining from invites) should throw MeteorError to inform users they lack 'access-federation' permission. (2) Remote server-initiated federation events should silently skip/ignore when users lack permission. The beforeAddUserToRoom hook only executes for local user-initiated actions, so throwing an error there is correct. Remote federation events are handled separately by the federation Matrix package with silent skipping logic.
Applied to files:
apps/meteor/client/lib/rooms/roomCoordinator.tsx
📚 Learning: 2025-10-28T16:53:42.761Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.
Applied to files:
apps/meteor/client/lib/rooms/roomCoordinator.tsx
📚 Learning: 2026-03-15T14:31:28.969Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39647
File: apps/meteor/app/api/server/v1/users.ts:710-757
Timestamp: 2026-03-15T14:31:28.969Z
Learning: In RocketChat/Rocket.Chat, the `UserCreateParamsPOST` type in `apps/meteor/app/api/server/v1/users.ts` (migrated from `packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts`) intentionally has `fields: string` (non-optional) and `settings?: IUserSettings` without a corresponding AJV schema entry. This is a pre-existing divergence carried over verbatim from the original rest-typings source (PR `#39647`). Do not flag this type/schema misalignment during the OpenAPI migration review — it is tracked as a separate follow-up fix.
Applied to files:
apps/meteor/client/lib/rooms/roomCoordinator.tsx
📚 Learning: 2026-04-17T17:38:15.994Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39858
File: packages/ui-kit/src/interactions/UserInteraction.ts:33-33
Timestamp: 2026-04-17T17:38:15.994Z
Learning: In RocketChat/Rocket.Chat (`packages/ui-kit/src/interactions/UserInteraction.ts`), `ViewSubmitUserInteraction` and `ViewClosedUserInteraction` intentionally do NOT include `rid` when the interaction originates from a **modal** surface. Modals are not scoped to a room, so no room id is available in that context. The `rid?: string` field is optional to support the contextual bar surface (where room context exists) while remaining absent for modals. Do not flag the absence of `rid` in modal viewSubmit/viewClosed interactions as a missing-context bug.
Applied to files:
apps/meteor/client/lib/rooms/roomCoordinator.tsx
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings (mapping subscription documents to room IDs), never undefined, even when user has no room subscriptions.
Applied to files:
apps/meteor/client/lib/rooms/roomCoordinator.tsx
📚 Learning: 2025-09-25T09:59:26.461Z
Learnt from: Dnouv
Repo: RocketChat/Rocket.Chat PR: 37057
File: packages/apps-engine/src/definition/accessors/IUserRead.ts:23-27
Timestamp: 2025-09-25T09:59:26.461Z
Learning: AppUserBridge.getUserRoomIds in apps/meteor/app/apps/server/bridges/users.ts always returns an array of strings by mapping subscription documents to room IDs, never undefined, even when user has no room subscriptions.
Applied to files:
apps/meteor/client/lib/rooms/roomCoordinator.tsx
📚 Learning: 2026-03-10T08:13:52.153Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 39414
File: apps/meteor/app/api/server/v1/rooms.ts:1241-1297
Timestamp: 2026-03-10T08:13:52.153Z
Learning: In the RocketChat/Rocket.Chat OpenAPI migration PRs for endpoints under apps/meteor/app/api/server/v1/rooms.ts, the pattern `ajv.compile<void>({...})` is intentionally used for the 200 response schema even when the endpoint returns `{ success: true }`. This is an established convention across all migrated endpoints (rooms.leave, rooms.favorite, rooms.delete, rooms.muteUser, rooms.unmuteUser). Do not flag this as a type mismatch during reviews of these migration PRs.
Applied to files:
apps/meteor/client/lib/rooms/roomCoordinator.tsx
🔇 Additional comments (9)
apps/meteor/client/lib/rooms/roomCoordinator.tsx (1)
19-19: LGTM!Clean drop-in replacement of
Meteor.absoluteUrl(...)with the local helper;router.buildRoutePath(...)output is wrapped identically.Also applies to: 206-211
apps/meteor/client/meteor/login/saml.ts (1)
6-6: LGTM!SLO bounce URL is built identically; only the URL prefixing helper changed.
Also applies to: 79-79
apps/meteor/app/ui/client/lib/recorderjs/AudioEncoder.ts (1)
3-3: LGTM!Worker URL construction is unchanged in semantics. The
../../../../../client/lib/absoluteUrlimport is a bit deep but acceptable given this module is already client-only.Also applies to: 13-13
apps/meteor/client/views/root/hooks/useCorsSSLConfig.ts (1)
4-12: LGTM — pre-existing semantics preserved.The mutation target moved from
Meteor.absoluteUrl.defaultOptionsto the localabsoluteUrl.defaultOptions. Note (informational, not blocking): whenForce_SSL=falseon an https page, this still overrides the auto-detectedsecure: trueset during module init — same behavior as before, kept intentionally.apps/meteor/client/meteor/login/twitter.ts (1)
9-9: LGTM!Drop-in replacement; OAuth flow and
loginPathcomposition unchanged.Also applies to: 47-47
apps/meteor/client/lib/openCASLoginPopup.ts (1)
34-35: No issue. TheabsoluteUrl()function does not includeROOT_URL_PATH_PREFIXin its return value; it only returns the base URL (protocol + host + optional path). The pattern on line 34 of appending the prefix is correct and does not duplicate it.apps/meteor/client/meteor/startup/absoluteUrl.ts (1)
3-8: No client-side conflicts detected—migration is safe.All client-side references to
absoluteUrl.defaultOptionsuse the local helper (imported fromapps/meteor/client/lib/absoluteUrl.ts), which has its owndefaultOptionsproperty. Server-side mutations inconfigureBoilerplate.tsandapp/cors/server/index.tsremain unaffected. The local helper fully supports thesecureproperty needed byuseCorsSSLConfig.ts, confirming the migration is complete and correct.apps/meteor/client/lib/absoluteUrl.https.spec.ts (1)
1-20: LGTM!Per-file
jsdomenv override plusjest.isolateModulesAsynccorrectly forces a fresh module evaluation under https location, and assertions match the module-init logic inabsoluteUrl.ts(location-derivedrootUrlandsecure: true).apps/meteor/client/lib/absoluteUrl.spec.ts (1)
1-120: Tests look thorough and correct.Coverage spans default-option resolution, protocol normalization, secure/localhost rules, and module-init paths (including
__meteor_runtime_config__.ROOT_URL). Theas anycast at Line 63 reflects a typing gap in the public signature ofabsoluteUrl; addressing it via overloads inabsoluteUrl.ts(see comment there) will let this test drop the cast.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #40324 +/- ##
===========================================
- Coverage 69.87% 69.86% -0.01%
===========================================
Files 3296 3297 +1
Lines 119186 119243 +57
Branches 21525 21555 +30
===========================================
+ Hits 83285 83314 +29
- Misses 32613 32623 +10
- Partials 3288 3306 +18
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)
It adds a
absoluteUrlfunction that mimics the originalMeteor.absoluteUrlto client-side code.Issue(s)
Steps to test or reproduce
Further comments
It's inspired by automated review comments on #40268.
Task: ARCH-2120
Summary by CodeRabbit
New Features
Refactor