Skip to content

Conversation

@tassoevan
Copy link
Contributor

@tassoevan tassoevan commented Sep 9, 2025

Proposed changes (including videos or screenshots)

It colocates code related to Meteor APIs under client/meteor.

Issue(s)

Steps to test or reproduce

Further comments

This PR is part of our “demeteorization” initiative.

It's a slice of #36858.

Summary by CodeRabbit

  • Refactor
    • Standardized and centralized client-side imports across authentication, settings, and startup modules to reduce duplication and improve consistency. No user-facing behavior changes.
  • Chores
    • Removed an unused export to streamline the public surface.
    • Updated internal module resolution to improve reliability during app startup and authentication flows.
  • Notes
    • This is a maintenance update with no new features or visible UI changes.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Sep 9, 2025

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

@changeset-bot
Copy link

changeset-bot bot commented Sep 9, 2025

⚠️ No Changeset found

Latest commit: e5716eb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@tassoevan tassoevan added this to the 7.11.0 milestone Sep 9, 2025
@codecov
Copy link

codecov bot commented Sep 9, 2025

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.26%. Comparing base (a45420b) to head (e5716eb).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #36895      +/-   ##
===========================================
- Coverage    66.26%   66.26%   -0.01%     
===========================================
  Files         3339     3339              
  Lines       113726   113725       -1     
  Branches     21166    21173       +7     
===========================================
- Hits         75363    75357       -6     
  Misses       35674    35674              
- Partials      2689     2694       +5     
Flag Coverage Δ
e2e 57.67% <50.00%> (-0.04%) ⬇️
unit 71.01% <100.00%> (+<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.

@tassoevan tassoevan marked this pull request as ready for review September 9, 2025 19:02
@tassoevan tassoevan requested a review from a team as a code owner September 9, 2025 19:02
@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Sep 10, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Sep 10, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 10, 2025

Walkthrough

Refactors update multiple import paths across the Meteor client, consolidating modules under apps/meteor/client/meteor/overrides and apps/meteor/client/meteor/watch. One re-export (watch) is removed from cachedStores. No logic, control flow, or public API signatures change beyond that export removal.

Changes

Cohort / File(s) Summary
Authorization clients (watch path)
apps/meteor/app/authorization/client/hasPermission.ts, apps/meteor/app/authorization/client/hasRole.ts
Update watch import from .../client/lib/cachedStores to .../client/meteor/watch.
CachedStores refactor
apps/meteor/client/lib/cachedStores/CachedStore.ts, apps/meteor/client/lib/cachedStores/index.ts
Internal watch import moved to ../../meteor/watch; removed re-export watch from index.ts.
OAuth/custom login glue
apps/meteor/client/lib/customOAuth/CustomOAuth.ts
Move import of createOAuthTotpLoginMethod to ../../meteor/overrides/login/oauth.
Client settings (watch path)
apps/meteor/client/lib/settings/settings.ts, apps/meteor/client/startup/accounts.ts
Switch watch import to ../../meteor/watch or ../meteor/watch.
Client main bootstrap
apps/meteor/client/main.ts
Dynamic import path changed from ./meteorOverrides to ./meteor/overrides.
Overrides infra
apps/meteor/client/meteor/overrides/ddpOverREST.ts
Update SDKClient import to deeper relative path.
Login provider overrides (2FA/util paths)
apps/meteor/client/meteor/overrides/login/cas.ts, .../crowd.ts, .../facebook.ts, .../github.ts, .../google.ts, .../ldap.ts, .../meteorDeveloperAccount.ts, .../oauth.ts, .../password.ts, .../saml.ts, .../twitter.ts
Adjust imports from ../../lib/... to ../../../lib/... (and related definition paths); no logic changes. In saml.ts, also deepen dynamic SDKClient import.
Overrides settings and stores
apps/meteor/client/meteor/overrides/settings.ts, apps/meteor/client/meteor/overrides/userAndUsers.ts, apps/meteor/client/meteor/overrides/unstoreLoginToken.ts
Update paths for PublicSettings, Users, and CachedStoresManager respectively.
TOTP on-call utilities
apps/meteor/client/meteor/overrides/totpOnCall.ts
Update multiple import paths (i18n, 2FA types/utils) to new relative locations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks (3 passed)

✅ 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 accurately and concisely summarizes the primary change of moving Meteor-related client-side modules into the new client/meteor directory, reflecting the bulk of the file relocations in this PR. It uses a clear “chore:” prefix without unnecessary details or file listings, making the intent immediately understandable to reviewers.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I hop through paths, from here to there,
A warren of imports neatened with care.
One watch burrow closed, new tunnels align,
Logins unchanged, the routes now fine.
Thump-thump—refactor done, concise and fair. 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/client-meteor-directory

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

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

Caution

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

⚠️ Outside diff range comments (1)
apps/meteor/client/meteor/overrides/login/meteorDeveloperAccount.ts (1)

20-21: Build break: Random is used but not imported

Add the missing import.

Apply:

+import { Random } from '@rocket.chat/random';
🧹 Nitpick comments (4)
apps/meteor/client/meteor/overrides/ddpOverREST.ts (1)

5-5: SDKClient path realigned; consider path aliases to avoid brittle ../../../

Optional: add TS path aliases to make future relocations safer.

Example tsconfig paths:

{
  "compilerOptions": {
    "baseUrl": "apps/meteor",
    "paths": {
      "@app/*": ["app/*"],
      "@client/*": ["client/*"]
    }
  }
}
apps/meteor/client/meteor/overrides/login/google.ts (1)

8-9: Import depths updated correctly post-relocation.

Paths to overrideLoginMethod and wrapRequestCredentialFn look right from overrides/login/.

To reduce future churn from deep relatives, consider TS path aliases (e.g., @client/lib/...) in a follow-up.

apps/meteor/client/meteor/overrides/totpOnCall.ts (2)

48-60: Fix double-wrapped return type in async wrapper.

The inner function is declared as Promise<ReturnType>, but ReturnType is already a Promise<…>. This yields Promise<Promise<…>> at the type level. Adjust to ReturnType.

-  return async function callAsyncWithTOTP(methodName: string, ...args: unknown[]): Promise<ReturnType<T>> {
+  return async function callAsyncWithTOTP(methodName: string, ...args: unknown[]): ReturnType<T> {

55-56: Prefer original callAsync to avoid re-wrapping via the global.

Using the captured callAsync keeps the retry path on the original impl and avoids unnecessary wrapper re-entry.

-        onCode: (twoFactorCode, twoFactorMethod) => Meteor.callAsync(methodName, ...args, { twoFactorCode, twoFactorMethod }),
+        onCode: (twoFactorCode, twoFactorMethod) => callAsync(methodName, ...args, { twoFactorCode, twoFactorMethod }),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c102712 and 01458b1.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (24)
  • apps/meteor/app/authorization/client/hasPermission.ts (1 hunks)
  • apps/meteor/app/authorization/client/hasRole.ts (1 hunks)
  • apps/meteor/client/lib/cachedStores/CachedStore.ts (1 hunks)
  • apps/meteor/client/lib/cachedStores/index.ts (0 hunks)
  • apps/meteor/client/lib/customOAuth/CustomOAuth.ts (1 hunks)
  • apps/meteor/client/lib/settings/settings.ts (1 hunks)
  • apps/meteor/client/main.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/ddpOverREST.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/login/cas.ts (2 hunks)
  • apps/meteor/client/meteor/overrides/login/crowd.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/login/facebook.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/login/github.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/login/google.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/login/ldap.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/login/meteorDeveloperAccount.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/login/oauth.ts (2 hunks)
  • apps/meteor/client/meteor/overrides/login/password.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/login/saml.ts (2 hunks)
  • apps/meteor/client/meteor/overrides/login/twitter.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/settings.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/totpOnCall.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/unstoreLoginToken.ts (1 hunks)
  • apps/meteor/client/meteor/overrides/userAndUsers.ts (1 hunks)
  • apps/meteor/client/startup/accounts.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/meteor/client/lib/cachedStores/index.ts
🧰 Additional context used
🧬 Code graph analysis (3)
apps/meteor/app/authorization/client/hasRole.ts (1)
apps/meteor/app/lib/server/lib/notifyListener.ts (2)
  • T (136-138)
  • NotifyUserChange (372-384)
apps/meteor/client/meteor/overrides/userAndUsers.ts (2)
apps/meteor/app/lib/server/lib/notifyListener.ts (2)
  • NotifyUserChange (372-384)
  • id (405-412)
apps/meteor/app/lib/server/functions/setUserActiveStatus.ts (2)
  • u (38-38)
  • setUserActiveStatus (53-176)
apps/meteor/app/authorization/client/hasPermission.ts (1)
apps/meteor/app/lib/server/lib/notifyListener.ts (5)
  • permission (100-110)
  • T (287-293)
  • pid (114-121)
  • NotifyUserChange (372-384)
  • T (136-138)
⏰ 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). (8)
  • GitHub Check: 🔨 Test Storybook / Test Storybook
  • GitHub Check: 🔎 Code Check / Code Lint
  • GitHub Check: 🔎 Code Check / TypeScript
  • GitHub Check: 🔨 Test Unit / Unit Tests
  • GitHub Check: 📦 Meteor Build - coverage
  • GitHub Check: Builds matrix rust bindings against alpine
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (22)
apps/meteor/client/lib/settings/settings.ts (1)

3-3: LGTM: import now points to the centralized Meteor watch module

Path looks correct for apps/meteor/client/lib/settings../../meteor/watch. No behavior change.

apps/meteor/client/meteor/overrides/unstoreLoginToken.ts (1)

3-3: LGTM: updated CachedStoresManager import path

Relocation aligns with the new directory layout; override behavior remains unchanged.

apps/meteor/client/meteor/overrides/userAndUsers.ts (1)

4-4: LGTM: Users store import path adjusted

Correct relative path after move; no functional impact.

apps/meteor/client/meteor/overrides/login/twitter.ts (1)

8-9: Verified consistent import depth
All login override modules under apps/meteor/client/meteor/overrides/login import overrideLoginMethod and wrapRequestCredentialFn from '../../../lib/...'; no stale '../../lib/…' paths remain.

apps/meteor/client/meteor/overrides/settings.ts (1)

3-3: LGTM: PublicSettings import path updated

Matches the new colocated stores location; logic untouched.

apps/meteor/client/lib/cachedStores/CachedStore.ts (1)

16-16: LGTM: watch import redirected to client/meteor

Keeps reactive readiness wiring intact while isolating Meteor-specific watch logic.

apps/meteor/client/meteor/overrides/login/facebook.ts (1)

8-9: LGTM: path depth corrected for shared lib imports

Consistent with twitter override; no functional differences.

apps/meteor/app/authorization/client/hasPermission.ts (1)

6-6: Watch import migration verified
No imports of watch remain under cachedStores and no re-exports in apps/meteor/client/lib/cachedStores/index.ts were found.

apps/meteor/client/startup/accounts.ts (1)

10-10: LGTM: watch fully relocated
No imports from cachedStores detected; apps/meteor/client/meteor/watch.ts exists.

apps/meteor/client/meteor/overrides/login/crowd.ts (1)

3-3: LGTM: 2FA override import path updated

Consistent with other login overrides.

apps/meteor/client/meteor/overrides/login/oauth.ts (2)

5-6: LGTM: type-only imports now point to client/definitions and client/lib

No behavior change; good use of import type.


116-116: Approve dynamic import for process2faReturn
File verified at apps/meteor/client/lib/2fa/process2faReturn.ts; no further changes needed.

apps/meteor/client/lib/customOAuth/CustomOAuth.ts (1)

10-10: LGTM: createOAuthTotpLoginMethod import switched to meteor/overrides

Keeps responsibilities clear between lib and meteor overrides.

apps/meteor/client/meteor/overrides/login/github.ts (1)

8-10: LGTM: lib imports moved one level deeper

Matches repo layout changes; no functional diffs.

apps/meteor/client/main.ts (1)

6-7: Approve changes: overrides entry relocated and cleanup confirmed
Confirmed apps/meteor/client/meteor/overrides/index.ts exists and the legacy meteorOverrides directory has been removed.

apps/meteor/client/meteor/overrides/login/meteorDeveloperAccount.ts (1)

6-7: LGTM: lib imports depth adjusted

Consistent with the rest of the login overrides.

apps/meteor/app/authorization/client/hasRole.ts (1)

3-3: Approve import relocation
No remaining imports of watch from client/lib/cachedStores; new apps/meteor/client/meteor/watch.ts exports watch as expected.

apps/meteor/client/meteor/overrides/login/password.ts (1)

4-4: Import path adjustment is correct.

Matches the new directory layout; no behavior change.

apps/meteor/client/meteor/overrides/login/ldap.ts (1)

3-3: Import relocation LGTM.

overrideLoginMethod symbols now resolve from the correct path.

apps/meteor/client/meteor/overrides/login/cas.ts (1)

4-4: All imports verified
Confirmed that apps/meteor/client/lib/openCASLoginPopup.ts exists and exports openCASLoginPopup as a named export.

apps/meteor/client/meteor/overrides/login/saml.ts (1)

5-6: Approve imports and exports—verified
Both settings in apps/meteor/client/lib/settings/settings.ts and the named export sdk in apps/meteor/app/utils/client/lib/SDKClient.ts are present as expected.

apps/meteor/client/meteor/overrides/totpOnCall.ts (1)

3-6: Import paths verified and correct. All referenced modules exist at their new locations, so no further changes needed.

@kodiakhq kodiakhq bot merged commit d832f91 into develop Sep 10, 2025
49 checks passed
@kodiakhq kodiakhq bot deleted the chore/client-meteor-directory branch September 10, 2025 16:24
@coderabbitai coderabbitai bot mentioned this pull request Dec 10, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants