Skip to content

chore: reorganize backend folder structure — Phase 5 (meteor methods) - #41225

Merged
sampaiodiego merged 12 commits into
developfrom
backend-restructure-phase5
Jul 10, 2026
Merged

chore: reorganize backend folder structure — Phase 5 (meteor methods)#41225
sampaiodiego merged 12 commits into
developfrom
backend-restructure-phase5

Conversation

@sampaiodiego

@sampaiodiego sampaiodiego commented Jul 7, 2026

Copy link
Copy Markdown
Member

Proposed changes

Phase 5 of the backend folder-structure migration: rename server/methods/server/meteor-methods/ and consolidate every Meteor method from app/*/server/methods/ into domain subfolders. The new name makes explicit that these are Meteor-specific RPC handlers — deprecated and slated for removal — not REST handlers or service methods. Files move as-is — only import paths change, no refactoring.

Please read comment with detailed information on the changes: #41225 (comment)

Folder structure

Community — before

apps/meteor/
├── app/
│   ├── lib/server/methods/               35 files (sendMessage, createChannel, saveSetting, …)
│   ├── authorization/server/methods/     (4)    2fa/server/methods/        (5)
│   ├── channel-settings/server/methods/  (1)    threads/server/methods/    (4 + index)
│   ├── discussion/server/methods/        (1)    livechat/server/methods/   (3)
│   ├── integrations/server/methods/      (8, incoming/ + outgoing/)
│   ├── importer/server/methods/          (6 + index)
│   ├── autotranslate/server/methods/     (4)    e2e/server/methods/        (7)
└── server/methods/                       48 flat files — every domain mixed together

Community — after

apps/meteor/server/meteor-methods/        (renamed from server/methods/)
├── auth/           (18: OAuth services, roles/permissions, 2FA, tokens, emails, …)
├── messages/       (21: sendMessage, threads, discussion, history/search, slash-command previews, …)
├── omnichannel/    (2:  sendMessageLivechat, sendFileLivechatMessage)
├── platform/       (16: e2e keys, autotranslate, restartServer, requestDataDownload, …)
├── rooms/          (32: create/join/leave, roles, mute/ban, saveRoomSettings, browseChannels, …)
├── settings/       (4:  saveSetting(s), sendSMTPTestEmail, getSetupWizardParameters)
├── users/          (17: profile/prefs/avatar, block/ignore, registerUser, deleteUser, …)
├── import/         (6:  importer methods; execute* fns imported directly by api/v1/import)
├── integrations/   (8:  incoming/ + outgoing/ preserved)
└── index.ts        single registration aggregator (side-effect imports, grouped by domain)

→ all 12 app/*/server/methods/ dirs in scope removed
EE mirror — before / after (stays inside ee/)

Before

apps/meteor/ee/
├── server/methods/getReadReceipts.ts
└── app/
    ├── canned-responses/server/methods/{saveCannedResponse,removeCannedResponse}.ts
    ├── license/server/methods.ts
    └── livechat-enterprise/server/methods/removeBusinessHour.ts

After

apps/meteor/ee/server/meteor-methods/
├── getReadReceipts.ts
├── saveCannedResponse.ts        ← still registered via License.onLicense() dynamic import
├── removeCannedResponse.ts      ← (license gating untouched)
└── license.ts                   ← renamed from license/server/methods.ts
Test mirrorstests/unit/** follows its sources
tests/unit/server/methods/deleteFileMessage.spec.ts   → tests/unit/server/meteor-methods/messages/
tests/unit/app/e2e/server/methods/updateGroupKey.spec.ts → tests/unit/server/meteor-methods/platform/
tests/unit/server/methods/banUserFromRoom.spec.ts     → tests/unit/server/lib/   (it tests server/lib/banUserFromRoom.ts — was misfiled in the methods mirror)

No runner-glob changes needed: tests/unit/server/** already covers the new mirrors.

Eleven commits for reviewability: the rename, 5a (flat files → domain subfolders), 5b (app/lib methods), 5c (feature methods), EE mirror, then review follow-ups: a proxyquire fixup caught by the mocha run, Phase 6/7 docs amendments, dropping the import/ domain index in favor of direct registrations, restoring the dropped unblockUser registration, and deleting two 0-byte business-hour stubs left behind by #37772/#37819.

Beyond file moves (see reviewer comment)

  • Method registration imports consolidated into server/meteor-methods/index.ts — removed from app/lib/server/index.ts and 9 feature aggregators (threads' pure-aggregator methods/index.ts deleted). Three deliberate exceptions keep their previous registration path: createToken, removeUserFromRole, and the license-gated EE canned-responses methods.
  • 7 spec files needed hand-rewritten proxyquire .load() targets / mock keys (string literals lint & tsc can't validate).
  • Docs: Phase 6/7 tables now route the 10 deferred features' methods/ dirs to server/meteor-methods/<domain>/ (new media/ domain) and app/integrations/server/api/api.ts to server/api/webhooks.ts, so later phases can't sweep methods into server/lib/.

Verification

  • yarn lint --quiet — clean (after each batch)
  • yarn typecheck (meteor lint + tsc --noEmit --skipLibCheck) — 0 errors
  • verify-no-old-imports.mjs — only the 11 intentional references to methods dirs of features deferred to Phases 6/7 (file-upload, user-status, mentions, emoji-custom, push-notifications)
  • mocha unit suite: 1964 passing / 12 pending / 0 failing
  • jest: 269 suites passed, 1860 passed / 8 skipped

Note

Not run here (need a running server/DB): integration suites and manual DDP smoke tests of the moved methods (send message, create channel, save settings, 2FA enable/disable, livechat message).

🤖 Generated with Claude Code

Task: ARCH-2241

@sampaiodiego
sampaiodiego requested review from a team as code owners July 7, 2026 18:33
@dionisio-bot

dionisio-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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

@hacktron-app

hacktron-app Bot commented Jul 7, 2026

Copy link
Copy Markdown

⏭️ Hacktron Security Check — Skipped

Reason: This PR exceeds Hacktron's 200-file review cap and will not be scanned. Split the PR into smaller changes for review coverage.

Split the PR into smaller commits or open separate PRs for unrelated changes.

@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 398ee26

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

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 212 files, which is 62 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0e135531-7d54-45d6-9885-59c25dc1fad1

📥 Commits

Reviewing files that changed from the base of the PR and between 13b4a7b and 398ee26.

⛔ Files ignored due to path filters (4)
  • apps/meteor/scripts/migration/phase5-ee-methods.tsv is excluded by !**/*.tsv
  • apps/meteor/scripts/migration/phase5a-flat-methods.tsv is excluded by !**/*.tsv
  • apps/meteor/scripts/migration/phase5b-lib-methods.tsv is excluded by !**/*.tsv
  • apps/meteor/scripts/migration/phase5c-feature-methods.tsv is excluded by !**/*.tsv
📒 Files selected for processing (212)
  • apps/meteor/MIGRATION_PLAN.md
  • apps/meteor/app/2fa/server/index.ts
  • apps/meteor/app/apps/server/bridges/messages.ts
  • apps/meteor/app/apps/server/bridges/rooms.ts
  • apps/meteor/app/apps/server/bridges/uploads.ts
  • apps/meteor/app/authorization/server/index.ts
  • apps/meteor/app/autotranslate/server/index.ts
  • apps/meteor/app/channel-settings/server/index.ts
  • apps/meteor/app/discussion/server/index.ts
  • apps/meteor/app/e2e/server/index.ts
  • apps/meteor/app/file-upload/server/methods/sendFileMessage.spec.ts
  • apps/meteor/app/file-upload/server/methods/sendFileMessage.ts
  • apps/meteor/app/importer/server/classes/converters/RoomConverter.ts
  • apps/meteor/app/importer/server/index.ts
  • apps/meteor/app/importer/server/methods/index.ts
  • apps/meteor/app/integrations/server/api/api.ts
  • apps/meteor/app/integrations/server/index.ts
  • apps/meteor/app/lib/server/index.ts
  • apps/meteor/app/livechat/server/index.ts
  • apps/meteor/app/livechat/server/methods/saveBusinessHour.ts
  • apps/meteor/app/search/server/provider/DefaultProvider.ts
  • apps/meteor/app/threads/server/index.ts
  • apps/meteor/app/threads/server/methods/index.ts
  • apps/meteor/ee/app/canned-responses/server/index.ts
  • apps/meteor/ee/app/license/server/index.ts
  • apps/meteor/ee/app/livechat-enterprise/server/methods/removeBusinessHour.ts
  • apps/meteor/ee/server/api/chat.ts
  • apps/meteor/ee/server/api/v1/canned-responses.ts
  • apps/meteor/ee/server/index.ts
  • apps/meteor/ee/server/meteor-methods/getReadReceipts.ts
  • apps/meteor/ee/server/meteor-methods/license.ts
  • apps/meteor/ee/server/meteor-methods/removeCannedResponse.ts
  • apps/meteor/ee/server/meteor-methods/saveCannedResponse.ts
  • apps/meteor/server/api/v1/channels.ts
  • apps/meteor/server/api/v1/chat.ts
  • apps/meteor/server/api/v1/commands.ts
  • apps/meteor/server/api/v1/e2e.ts
  • apps/meteor/server/api/v1/groups.ts
  • apps/meteor/server/api/v1/im.ts
  • apps/meteor/server/api/v1/import.ts
  • apps/meteor/server/api/v1/integrations.ts
  • apps/meteor/server/api/v1/misc.ts
  • apps/meteor/server/api/v1/omnichannel/upload.ts
  • apps/meteor/server/api/v1/roles.ts
  • apps/meteor/server/api/v1/rooms.ts
  • apps/meteor/server/api/v1/settings.ts
  • apps/meteor/server/api/v1/users.ts
  • apps/meteor/server/cron/oembed.ts
  • apps/meteor/server/lib/bot-helpers/index.ts
  • apps/meteor/server/lib/dataExport/processDataDownloads.spec.ts
  • apps/meteor/server/lib/rooms/getRoomByNameOrIdWithOptionToJoin.ts
  • apps/meteor/server/lib/sendDirectMessageToUsers.ts
  • apps/meteor/server/lib/sendMessagesToAdmins.ts
  • apps/meteor/server/lib/users/setEmail.ts
  • apps/meteor/server/main.ts
  • apps/meteor/server/meteor-methods/auth/addOAuthService.ts
  • apps/meteor/server/meteor-methods/auth/addPermissionToRole.ts
  • apps/meteor/server/meteor-methods/auth/addUserToRole.ts
  • apps/meteor/server/meteor-methods/auth/afterVerifyEmail.ts
  • apps/meteor/server/meteor-methods/auth/checkCodesRemaining.ts
  • apps/meteor/server/meteor-methods/auth/checkRegistrationSecretURL.ts
  • apps/meteor/server/meteor-methods/auth/createToken.ts
  • apps/meteor/server/meteor-methods/auth/disable.ts
  • apps/meteor/server/meteor-methods/auth/enable.ts
  • apps/meteor/server/meteor-methods/auth/logoutCleanUp.ts
  • apps/meteor/server/meteor-methods/auth/refreshOAuthService.ts
  • apps/meteor/server/meteor-methods/auth/regenerateCodes.ts
  • apps/meteor/server/meteor-methods/auth/removeOAuthService.ts
  • apps/meteor/server/meteor-methods/auth/removeRoleFromPermission.ts
  • apps/meteor/server/meteor-methods/auth/removeUserFromRole.ts
  • apps/meteor/server/meteor-methods/auth/sendConfirmationEmail.ts
  • apps/meteor/server/meteor-methods/auth/sendForgotPasswordEmail.ts
  • apps/meteor/server/meteor-methods/auth/validateTempToken.ts
  • apps/meteor/server/meteor-methods/import/downloadPublicImportFile.ts
  • apps/meteor/server/meteor-methods/import/getImportFileData.ts
  • apps/meteor/server/meteor-methods/import/getImportProgress.ts
  • apps/meteor/server/meteor-methods/import/getLatestImportOperations.ts
  • apps/meteor/server/meteor-methods/import/startImport.ts
  • apps/meteor/server/meteor-methods/import/uploadImportFile.ts
  • apps/meteor/server/meteor-methods/index.ts
  • apps/meteor/server/meteor-methods/integrations/clearIntegrationHistory.ts
  • apps/meteor/server/meteor-methods/integrations/incoming/addIncomingIntegration.ts
  • apps/meteor/server/meteor-methods/integrations/incoming/deleteIncomingIntegration.ts
  • apps/meteor/server/meteor-methods/integrations/incoming/updateIncomingIntegration.ts
  • apps/meteor/server/meteor-methods/integrations/outgoing/addOutgoingIntegration.ts
  • apps/meteor/server/meteor-methods/integrations/outgoing/deleteOutgoingIntegration.ts
  • apps/meteor/server/meteor-methods/integrations/outgoing/replayOutgoingIntegration.ts
  • apps/meteor/server/meteor-methods/integrations/outgoing/updateOutgoingIntegration.ts
  • apps/meteor/server/meteor-methods/messages/createDirectMessage.ts
  • apps/meteor/server/meteor-methods/messages/createDiscussion.ts
  • apps/meteor/server/meteor-methods/messages/deleteFileMessage.ts
  • apps/meteor/server/meteor-methods/messages/executeSlashCommandPreview.ts
  • apps/meteor/server/meteor-methods/messages/followMessage.ts
  • apps/meteor/server/meteor-methods/messages/getChannelHistory.ts
  • apps/meteor/server/meteor-methods/messages/getMessages.ts
  • apps/meteor/server/meteor-methods/messages/getSingleMessage.ts
  • apps/meteor/server/meteor-methods/messages/getSlashCommandPreviews.ts
  • apps/meteor/server/meteor-methods/messages/getThreadMessages.ts
  • apps/meteor/server/meteor-methods/messages/getThreadsList.ts
  • apps/meteor/server/meteor-methods/messages/loadHistory.ts
  • apps/meteor/server/meteor-methods/messages/loadMissedMessages.ts
  • apps/meteor/server/meteor-methods/messages/loadNextMessages.ts
  • apps/meteor/server/meteor-methods/messages/loadSurroundingMessages.ts
  • apps/meteor/server/meteor-methods/messages/messageSearch.ts
  • apps/meteor/server/meteor-methods/messages/readMessages.ts
  • apps/meteor/server/meteor-methods/messages/readThreads.ts
  • apps/meteor/server/meteor-methods/messages/sendMessage.ts
  • apps/meteor/server/meteor-methods/messages/unfollowMessage.ts
  • apps/meteor/server/meteor-methods/messages/updateMessage.ts
  • apps/meteor/server/meteor-methods/omnichannel/sendFileLivechatMessage.ts
  • apps/meteor/server/meteor-methods/omnichannel/sendMessageLivechat.ts
  • apps/meteor/server/meteor-methods/platform/OEmbedCacheCleanup.ts
  • apps/meteor/server/meteor-methods/platform/checkFederationConfiguration.ts
  • apps/meteor/server/meteor-methods/platform/fetchMyKeys.ts
  • apps/meteor/server/meteor-methods/platform/getProviderUiMetadata.ts
  • apps/meteor/server/meteor-methods/platform/getSupportedLanguages.ts
  • apps/meteor/server/meteor-methods/platform/getUsersOfRoomWithoutKey.ts
  • apps/meteor/server/meteor-methods/platform/loadLocale.ts
  • apps/meteor/server/meteor-methods/platform/requestDataDownload.ts
  • apps/meteor/server/meteor-methods/platform/requestSubscriptionKeys.ts
  • apps/meteor/server/meteor-methods/platform/resetOwnE2EKey.ts
  • apps/meteor/server/meteor-methods/platform/restartServer.ts
  • apps/meteor/server/meteor-methods/platform/saveSettings.ts
  • apps/meteor/server/meteor-methods/platform/setRoomKeyID.ts
  • apps/meteor/server/meteor-methods/platform/setUserPublicAndPrivateKeys.ts
  • apps/meteor/server/meteor-methods/platform/translateMessage.ts
  • apps/meteor/server/meteor-methods/platform/updateGroupKey.ts
  • apps/meteor/server/meteor-methods/rooms/addAllUserToRoom.ts
  • apps/meteor/server/meteor-methods/rooms/addRoomLeader.ts
  • apps/meteor/server/meteor-methods/rooms/addRoomModerator.ts
  • apps/meteor/server/meteor-methods/rooms/addRoomOwner.ts
  • apps/meteor/server/meteor-methods/rooms/addUserToRoom.ts
  • apps/meteor/server/meteor-methods/rooms/addUsersToRoom.ts
  • apps/meteor/server/meteor-methods/rooms/archiveRoom.ts
  • apps/meteor/server/meteor-methods/rooms/browseChannels.ts
  • apps/meteor/server/meteor-methods/rooms/channelsList.ts
  • apps/meteor/server/meteor-methods/rooms/cleanRoomHistory.ts
  • apps/meteor/server/meteor-methods/rooms/createChannel.ts
  • apps/meteor/server/meteor-methods/rooms/createPrivateGroup.ts
  • apps/meteor/server/meteor-methods/rooms/getRoomById.ts
  • apps/meteor/server/meteor-methods/rooms/getRoomIdByNameOrId.ts
  • apps/meteor/server/meteor-methods/rooms/getRoomJoinCode.ts
  • apps/meteor/server/meteor-methods/rooms/getRoomNameById.ts
  • apps/meteor/server/meteor-methods/rooms/getRoomRoles.ts
  • apps/meteor/server/meteor-methods/rooms/getTotalChannels.ts
  • apps/meteor/server/meteor-methods/rooms/hideRoom.ts
  • apps/meteor/server/meteor-methods/rooms/joinDefaultChannels.ts
  • apps/meteor/server/meteor-methods/rooms/joinRoom.ts
  • apps/meteor/server/meteor-methods/rooms/leaveRoom.ts
  • apps/meteor/server/meteor-methods/rooms/muteUserInRoom.ts
  • apps/meteor/server/meteor-methods/rooms/openRoom.ts
  • apps/meteor/server/meteor-methods/rooms/removeRoomLeader.ts
  • apps/meteor/server/meteor-methods/rooms/removeRoomModerator.ts
  • apps/meteor/server/meteor-methods/rooms/removeRoomOwner.ts
  • apps/meteor/server/meteor-methods/rooms/removeUserFromRoom.ts
  • apps/meteor/server/meteor-methods/rooms/saveRoomSettings.ts
  • apps/meteor/server/meteor-methods/rooms/toggleFavorite.ts
  • apps/meteor/server/meteor-methods/rooms/unarchiveRoom.ts
  • apps/meteor/server/meteor-methods/rooms/unmuteUserInRoom.ts
  • apps/meteor/server/meteor-methods/settings/getSetupWizardParameters.ts
  • apps/meteor/server/meteor-methods/settings/saveSetting.ts
  • apps/meteor/server/meteor-methods/settings/saveSettings.ts
  • apps/meteor/server/meteor-methods/settings/sendSMTPTestEmail.ts
  • apps/meteor/server/meteor-methods/users/blockUser.ts
  • apps/meteor/server/meteor-methods/users/deleteUser.ts
  • apps/meteor/server/meteor-methods/users/deleteUserOwnAccount.ts
  • apps/meteor/server/meteor-methods/users/getUsernameSuggestion.ts
  • apps/meteor/server/meteor-methods/users/getUsersOfRoom.ts
  • apps/meteor/server/meteor-methods/users/ignoreUser.ts
  • apps/meteor/server/meteor-methods/users/registerUser.ts
  • apps/meteor/server/meteor-methods/users/resetAvatar.ts
  • apps/meteor/server/meteor-methods/users/saveUserPreferences.ts
  • apps/meteor/server/meteor-methods/users/saveUserProfile.ts
  • apps/meteor/server/meteor-methods/users/setAvatarFromService.ts
  • apps/meteor/server/meteor-methods/users/setEmail.ts
  • apps/meteor/server/meteor-methods/users/setRealName.ts
  • apps/meteor/server/meteor-methods/users/setUserActiveStatus.ts
  • apps/meteor/server/meteor-methods/users/unblockUser.ts
  • apps/meteor/server/meteor-methods/users/userPresence.ts
  • apps/meteor/server/meteor-methods/users/userSetUtcOffset.ts
  • apps/meteor/server/methods/index.ts
  • apps/meteor/server/modules/core-apps/mention.module.ts
  • apps/meteor/server/publications/messages.ts
  • apps/meteor/server/services/media-call/service.ts
  • apps/meteor/server/services/messages/service.ts
  • apps/meteor/server/services/room/service.ts
  • apps/meteor/server/services/upload/service.ts
  • apps/meteor/server/slashcommands/asciiarts/gimme.ts
  • apps/meteor/server/slashcommands/asciiarts/lenny.ts
  • apps/meteor/server/slashcommands/asciiarts/shrug.ts
  • apps/meteor/server/slashcommands/asciiarts/tableflip.ts
  • apps/meteor/server/slashcommands/asciiarts/unflip.ts
  • apps/meteor/server/slashcommands/ban/ban.ts
  • apps/meteor/server/slashcommands/ban/unban.ts
  • apps/meteor/server/slashcommands/create/server.ts
  • apps/meteor/server/slashcommands/hide/hide.ts
  • apps/meteor/server/slashcommands/invite/server.ts
  • apps/meteor/server/slashcommands/inviteall/server.ts
  • apps/meteor/server/slashcommands/kick/server.ts
  • apps/meteor/server/slashcommands/leave/leave.ts
  • apps/meteor/server/slashcommands/me/me.ts
  • apps/meteor/server/slashcommands/msg/server.ts
  • apps/meteor/server/slashcommands/mute/mute.ts
  • apps/meteor/server/slashcommands/mute/unmute.ts
  • apps/meteor/server/slashcommands/topic/topic.ts
  • apps/meteor/tests/unit/app/importer/server/roomConverter.spec.ts
  • apps/meteor/tests/unit/server/lib/banUserFromRoom.spec.ts
  • apps/meteor/tests/unit/server/lib/rooms/getRoomByNameOrIdWithOptionToJoin.spec.ts
  • apps/meteor/tests/unit/server/meteor-methods/auth/createToken.spec.ts
  • apps/meteor/tests/unit/server/meteor-methods/messages/deleteFileMessage.spec.ts
  • apps/meteor/tests/unit/server/meteor-methods/platform/updateGroupKey.spec.ts
  • apps/meteor/tests/unit/server/publications/messages.spec.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@sampaiodiego

sampaiodiego commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

Reviewer guide — what changed beyond moves + import rewrites

Everything not listed here is a git mv plus script-generated import recomputation (verified by lint, tsc, mocha and jest). Ordered by deviation from "pure move":

1. Method registration moved to a single aggregator (the one semantic change)

server/meteor-methods/index.ts now holds all side-effect registration imports, grouped by domain. They were removed from app/lib/server/index.ts and 9 feature aggregators (threads' pure-aggregator methods/index.ts was deleted — threads/server/index.ts now only imports hooks). Net effect: methods register when server/main.ts imports ./meteor-methods instead of during importPackages. Meteor.methods() registration is order-independent and each method module imports its own dependencies, so behavior is unchanged — but this is the thing to convince yourself of.

Warning

This consolidation is exactly where a method can silently deregister — and it happened: the 5b rewrite carried over 33 of 34 registrations, dropping unblockUser (restored in 13a70a7). Lint/tsc/unit suites stay green on such a drop, e2e only calls ~24 methods by name, and several methods (unblockUser included) have no in-repo caller — they serve mobile/DDP clients. A registration audit over every meteor-methods/ file found no other missing import (the only unimported files were two 0-byte business-hour stubs — emptied but never deleted by the 8.0.0 deprecation removals #37772/#37819 — now removed in 2cf66f6), and MIGRATION_PLAN.md now mandates that audit for Phases 6/7. Reviewers: the diff of removed-vs-added side-effect imports in this file is the highest-value check in this PR.

Three registrations deliberately did NOT move to the aggregator (they'd double-register or lose gating):

2. Hand-rewritten proxyquire strings (lint/tsc can't validate these)

Mock keys / .load() targets are string literals that must exactly match the loaded module's new import specifiers — a mismatch silently un-stubs the dependency:

3. Test-mirror relocations

  • deleteFileMessage.spec.ts and updateGroupKey.spec.ts mirror their sources' new homes; load targets + depth-sensitive keys updated.
  • banUserFromRoom.spec.ts moved to tests/unit/server/lib/ — it tests server/lib/banUserFromRoom.ts, not a method; it was misfiled in the methods mirror. Heads-up: it has a pre-existing stale key ('../lib/rooms/roomCoordinator' vs the module's './rooms/roomCoordinator'), meaning the real roomCoordinator loads instead of the stub. Left as-is because fixing it changes what the test exercises — worth a follow-up.

4. Placement judgment calls (files the plan's tables didn't list)

getRoomRolesrooms/; checkRegistrationSecretURLauth/; executeSlashCommandPreview, getSlashCommandPreviewsmessages/; restartServer, checkFederationConfigurationplatform/; sendSMTPTestEmailsettings/. EE license/server/methods.ts renamed to meteor-methods/license.ts (a bare methods.ts is meaningless at its new location).

5. Docs: Phase 6/7 tables corrected (MIGRATION_PLAN.md)

Ten features moving in Phases 6/7 still carry methods/ dirs (file-upload, mentions, user-status, emoji-custom, custom-sounds, push-notifications, statistics, version-check, meteor-accounts-saml, oauth2-server-config) — as written, their tables would have swept those into server/lib/. Explicit rows now route each to server/meteor-methods/<domain>/ (new media/ domain), and app/integrations/server/api/api.ts (the /hooks/* webhook REST API) to server/api/webhooks.ts. This also means verify-no-old-imports.mjs "server/methods" intentionally still reports 11 hits pointing at those deferred dirs.

6. Mechanical but hand-triggered

eslint --fix import/order churn in files whose imports the script rewrote (api/v1 endpoints, services, slashcommands).

7. Why some methods/ dirs are deliberately NOT in this PR

A fair question when reviewing: methods from 12 sources move here, yet 10 features keep theirs (file-upload, mentions, user-status, emoji-custom, custom-sounds, push-notifications, statistics, version-check, meteor-accounts-saml, oauth2-server-config). The line is not arbitrary:

  • Every feature whose methods move in this PR was already being dismantled across multiple phases (livechat: API in Phase 3, methods here, hooks in 6b, lib in 7; authorization: functions in 4 + methods here; threads/discussion: here + 6b + 6d; 2fa: here + 6a; integrations/importer/autotranslate/e2e: here + 6e; channel-settings: here + 7). For these there is no single "feature move" to preserve — they're sliced by responsibility regardless, so their methods belong to the methods phase.
  • Every deferred feature moves in exactly one Phase 6/7 row. Each is small and self-contained, and its methods are leaf registrations with almost no fan-in (their own index.ts plus an API endpoint or two). Pulling those 1–5 files forward would double-touch each feature (two PRs rewriting imports in the same folder, two conflict windows with in-flight product work) and create split-brain states — e.g. sendFileMessage is tightly coupled to file-upload's store internals, so it should relocate together with the rest of file-upload.

The cost of this split is a short-lived inconsistency: until Phases 6/7 land, server/meteor-methods/ is "all methods except those of ten features that haven't moved yet." The amended Phase 6/7 tables (item 5 above) guarantee those dirs route to server/meteor-methods/<domain>/ when their feature moves, so the "all Meteor methods live in meteor-methods/" invariant holds at the end state.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.98%. Comparing base (13b4a7b) to head (398ee26).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41225      +/-   ##
===========================================
- Coverage    69.39%   68.98%   -0.42%     
===========================================
  Files         3680     3755      +75     
  Lines       145528   147149    +1621     
  Branches     25853    26275     +422     
===========================================
+ Hits        100987   101507     +520     
- Misses       40241    41138     +897     
- Partials      4300     4504     +204     
Flag Coverage Δ
e2e 59.23% <ø> (-0.10%) ⬇️
e2e-api 49.35% <ø> (-1.08%) ⬇️
unit 70.47% <100.00%> (-0.04%) ⬇️

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.

@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 215 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="apps/meteor/server/meteor-methods/index.ts">

<violation number="1" location="apps/meteor/server/meteor-methods/index.ts:103">
P1: **Missing import for `unblockUser` in the new aggregator (method won't be registered)**

The old import `import './methods/unblockUser'` from `app/lib/server/index.ts` was removed as part of this migration. The file was moved to `server/meteor-methods/users/unblockUser.ts` (per the phase5b manifest), but the corresponding `import './users/unblockUser'` line was not added to `server/meteor-methods/index.ts`. The `blockUser` import is present directly above it, so `unblockUser` appears to have been accidentally skipped.

Without this import, the Meteor method for unblocking users is never registered — calling the `unblockUser` method will fail with a method-not-found error. Add `import './users/unblockUser';` between the `blockUser` and `deleteUser` imports.</violation>
</file>

Note: This PR contains a large number of files. cubic only reviews up to 200 files per PR, so some files may not have been reviewed. cubic prioritizes the most important files to review.

Re-trigger cubic

Comment thread apps/meteor/server/meteor-methods/index.ts
d-gubert
d-gubert previously approved these changes Jul 8, 2026
ricardogarim
ricardogarim previously approved these changes Jul 8, 2026
KevLehman
KevLehman previously approved these changes Jul 8, 2026
@sampaiodiego
sampaiodiego dismissed stale reviews from KevLehman, ricardogarim, and d-gubert via a028c8a July 8, 2026 18:26
@sampaiodiego
sampaiodiego force-pushed the backend-restructure-phase5 branch 2 times, most recently from a028c8a to 346d7b2 Compare July 8, 2026 21:18
KevLehman
KevLehman previously approved these changes Jul 8, 2026
sampaiodiego and others added 9 commits July 9, 2026 15:40
Meteor-specific RPC handlers get an explicit folder name, distinguishing
them from REST handlers and service methods, per MIGRATION_PLAN.md Phase 5.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… domain subfolders)

Moves the flat files in server/meteor-methods/ into domain subfolders
(users/, rooms/, messages/, auth/, settings/, platform/) and regroups
index.ts by domain. Mirrored specs follow: deleteFileMessage.spec.ts to
the messages/ mirror, banUserFromRoom.spec.ts to tests/unit/server/lib/
(it tests server/lib/banUserFromRoom.ts, not a method).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Moves app/lib/server/methods/* into server/meteor-methods/<domain>/.
Method registrations previously aggregated by app/lib/server/index.ts now
live in server/meteor-methods/index.ts. Stale proxyquire keys updated in
roomConverter, publications/messages and sendFileMessage specs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Moves Meteor methods from authorization, 2fa, channel-settings, threads,
discussion, livechat, integrations, importer, autotranslate and e2e into
server/meteor-methods/<domain>/. Registrations consolidate into
server/meteor-methods/index.ts; feature server/index.ts aggregators drop
their method imports. updateGroupKey.spec.ts moves to the meteor-methods
platform/ mirror; stale proxyquire keys rewritten.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Renames ee/server/methods → ee/server/meteor-methods and moves EE method
files there: canned-responses methods (still registered via the
License.onLicense dynamic imports), license methods.ts (as license.ts) and
livechat-enterprise removeBusinessHour into omnichannel/. All EE sources
stay under ee/ per the license boundary.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… Phase 5a

The spec loaded '../../methods/requestDataDownload.ts', a string literal
the move script does not rewrite; the module now lives under
meteor-methods/platform/ and its settings/dataExport specifiers changed
depth, so the mock keys are updated to match.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ten features whose methods/ dirs Phase 5 deliberately left in place move
wholesale in Phases 6/7 — as written, their tables would sweep Meteor
methods into server/lib/, breaking the meteor-methods consolidation.
Adds explicit rows sending each methods/ dir to
server/meteor-methods/<domain>/ (new media/ domain for custom-sounds,
emoji-custom and file-upload admin methods), routes the integrations
webhook REST API to server/api/webhooks.ts, and notes the co-located
sendFileMessage.spec.ts mocha-glob move.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The import domain was the only one with an index re-exporting its method
files; register them from server/meteor-methods/index.ts like every other
domain and import the execute* functions directly in api/v1/import.ts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Phase 5b consolidated app/lib/server/index.ts's 34 method registrations
into server/meteor-methods/index.ts but only carried 33 over —
unblockUser was dropped, deregistering the Meteor method (used by
external DDP clients; the web client goes through REST im.blockUser, so
no in-repo test exercises it). A registration audit over every
meteor-methods file found no other missing import; the plan now mandates
that audit for Phases 6/7.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sampaiodiego and others added 3 commits July 9, 2026 15:40
saveBusinessHour.ts and removeBusinessHour.ts were emptied (but not
deleted) by the 8.0.0 deprecated-method removals #37772 and #37819;
they have no content, no importers and register nothing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sampaiodiego
sampaiodiego force-pushed the backend-restructure-phase5 branch from a24220d to 398ee26 Compare July 9, 2026 18:40
@sampaiodiego sampaiodiego added this to the 8.7.0 milestone Jul 9, 2026
@sampaiodiego sampaiodiego added the stat: QA assured Means it has been tested and approved by a company insider label Jul 9, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 9, 2026
@sampaiodiego

Copy link
Copy Markdown
Member Author

/jira ARCH-1539

@dionisio-bot

dionisio-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

⚠️ Dionisio (Jira)

The PR description was sent as plain text because Jira rejected the formatted body.

@sampaiodiego
sampaiodiego merged commit 3b27160 into develop Jul 10, 2026
47 checks passed
@sampaiodiego
sampaiodiego deleted the backend-restructure-phase5 branch July 10, 2026 03:03
ggazzo added a commit that referenced this pull request Jul 27, 2026
The restructure (#40259, #41115, #41126, #41155, #41225, #41315, #41381)
moved API, settings, auth, notifications, integrations and slash-command
server code out of app/ into apps/meteor/server/ while this PR was open.
Update every path reference and fix related factual drift:

- app/api/server -> server/api (rest-endpoints, add-a-rest-endpoint,
  critical-flows, realtime-and-ddp, monorepo-layout, glossary)
- app/settings/server -> server/settings; fix settings import example
- sendMessage entry -> server/lib/messages/sendMessage.ts
- notifications streams -> server/modules/notifications; auth entry ->
  server/hooks/auth + server/lib/auth-providers
- slash commands: two registries (server/lib/utils + app/utils/client),
  server handlers in server/slashcommands/<name>/
- integrations -> server/lib/integrations + server/api/webhooks.ts
- ee/apps count 8 -> 6: stream-hub-service and federation-service do not
  exist; federation runs in-process (server/services/), noted
- module/package counts: ~100 -> ~37 app modules, 68 -> ~65 packages;
  drop nonexistent apps/docs workspace and string-helpers
- Yarn 4.12.0 -> 4.17.1 (getting-started, troubleshooting)
- Mongo troubleshooting: align with change-streams story; MONGO_OPLOG_URL
  is prod/ms-only; env vars must be shell-exported (no .env loader in dev)
- drop stale apps/meteor/.env.example pointer
- glossary proxify: models throw immediately; only core-services proxify
  waits/hangs
- useTranslation: teach react-i18next form ({ t }), ui-contexts one is
  deprecated; useUniqueId does not exist (use React useId); theming via
  useThemeMode in ui-client (no ui-theming package)
- remove Blaze bridge section: Blaze is fully removed
- add-a-rest-endpoint: add the mandatory side-effect import step in
  server/api/index.ts (endpoint silently never mounts without it)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

4 participants