chore: reorganize backend folder structure — Phase 6 (lib, hooks, feature code)#41315
chore: reorganize backend folder structure — Phase 6 (lib, hooks, feature code)#41315sampaiodiego wants to merge 10 commits into
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
⏭️ Hacktron Security Check — SkippedReason: This PR exceeds Hacktron's 200-file review cap and will not be scanned. Split the PR into smaller changes for review coverage.
|
|
|
Important Review skippedToo many files! This PR contains 596 files, which is 446 over the limit of 150. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (7)
📒 Files selected for processing (596)
You can disable this status message by setting the Use the checkbox below for a quick retry:
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.
All reported issues were addressed across 600 files
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #41315 +/- ##
===========================================
- Coverage 69.12% 68.21% -0.92%
===========================================
Files 3762 3968 +206
Lines 147936 154740 +6804
Branches 26451 27774 +1323
===========================================
+ Hits 102258 105549 +3291
- Misses 41173 44394 +3221
- Partials 4505 4797 +292
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
For reviewers — everything that is NOT a pure file move / import-path rewriteOf the diff, 362 files are renames (moves with only import specifiers recomputed) and most of the 194 modified files only had import paths rewritten by the migration script. The changes below are the ones that deserve actual review. 1. Files renamed (not just relocated)
2. Deleted files: 32 side-effect
|
f0e0661 to
df4b5bc
Compare
- app/{apple,crowd,custom-oauth,dolphin,drupal,github,github-enterprise,gitlab,google-oauth,iframe-login,wordpress}/server -> server/lib/auth-providers/
- app/lib/server/oauth -> server/lib/auth-providers/oauth/
- app/meteor-accounts-saml/server -> server/lib/saml/ (methods -> server/meteor-methods/auth/)
- app/2fa/server -> server/lib/2fa/
- app/{authentication,token-login}/server -> server/lib/auth/
- crowd methods -> server/meteor-methods/auth/crowd.ts
- folded trivial feature index.ts aggregators into importPackages.ts
- re-wired mocha/jest globs; fixed stale proxyquire/jest.mock keys
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- app/livechat/server/hooks -> server/hooks/omnichannel/
- app/{authentication,discussion,threads}/server/hooks -> server/hooks/{auth,messages}/
- threads aftersavemessage.ts renamed processThreads.ts (case-collision with afterSaveMessage.ts)
- app/lib/server/lib/{afterSaveMessage,notifyUsersOnMessage,sendNotificationsOnMessage} -> server/hooks/messages/
- app/lib/server/lib/beforeAddUserToRoom -> server/hooks/rooms/
- EE mirror: livechat-enterprise hooks -> ee/server/hooks/omnichannel/, canned-responses hooks -> ee/server/hooks/canned-responses/, message-read-receipt hooks -> ee/server/hooks/messages/, authorization callback -> ee/server/hooks/auth/
- relocated mirrored specs; rewrote proxyquire targets and stale mock keys
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… 6c+6d)
Phase 6c — notifications:
- app/push/server -> server/lib/notifications/push/ (methods -> server/meteor-methods/platform/push.ts)
- app/push-notifications/server -> server/lib/notifications/push-config/ (saveNotificationSettings -> server/meteor-methods/users/)
- app/mailer/server -> server/lib/notifications/email/
- app/mail-messages/server -> server/lib/notifications/mail-messages/
- app/notification-queue/server -> server/lib/notifications/queue/
- app/notifications/server -> server/lib/notifications/core/
Phase 6d — messaging:
- app/mentions/server -> server/lib/messaging/mentions/ (getUserMentionsByChannel -> server/meteor-methods/messages/)
- app/threads/server/functions.ts -> server/lib/messaging/threads/
- app/discussion/server/permissions.ts -> server/lib/messaging/discussions/
- app/reactions|message-pin|message-star|message-mark-as-unread -> server/lib/messaging/{reactions,pins,stars,unread}/
- app/markdown/server -> server/lib/messaging/markdown.ts
- app/emoji/server -> server/lib/messaging/emoji.ts
- folded side-effect index.ts aggregators; relocated mirrored specs; re-wired globs and mock keys
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ib (Phase 6e)
- app/file-upload/server -> server/lib/media/file-upload/ (sendFileMessage -> server/meteor-methods/messages/, getS3FileUrl -> server/meteor-methods/media/, isImagePreviewSupported stays lib)
- app/{file,emoji-custom,emoji-native,custom-sounds,assets}/server -> server/lib/media/*
- custom-sounds/emoji-custom methods -> server/meteor-methods/media/
- app/importer*/server -> server/lib/import/*
- app/search/server -> server/lib/search/ (methods -> server/meteor-methods/platform/search.ts)
- app/autotranslate/server -> server/lib/autotranslate/
- app/e2e/server -> server/lib/e2e/
- app/integrations/server -> server/lib/integrations/ (api/api.ts -> server/api/webhooks.ts)
- app/statistics/server -> server/lib/statistics/ (getStatistics method -> server/meteor-methods/platform/)
- app/metrics/server -> server/lib/metrics/
- app/cloud/server -> server/lib/cloud/ (methods -> server/meteor-methods/platform/cloud.ts)
- app/version-check/server -> server/lib/cloud/version-check/ (banner_dismiss -> server/meteor-methods/platform/)
- app/license/server -> server/lib/cloud/license/
- fixed broken ee/server/index.ts import of removed authorization aggregator (6b leftover; in ESLint blind spot)
- re-wired mocha/jest globs; relocated test mirrors; rewrote stale proxyquire/jest.mock keys
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- ee/app/canned-responses/server -> ee/server/lib/canned-responses/ - ee/app/license/server -> ee/server/lib/license/ (fixed root startRocketChat.ts import — outside lint/scan coverage) - ee/app/message-read-receipt/server -> ee/server/lib/message-read-receipt/ Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ib/auth-providers (Phase 6a follow-up) Missed by the plan's 6a table; same shape as dolphin/drupal/github. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…6 fixups) - webhooks.spec.ts / getEmailContent.spec.ts had stale proxyquire keys (variable-held stub objects, invisible to the literal-key checker) that let the real app/settings/server load and crash 9 tests via top-level await - app/file-upload/ufs (server-only storage adapters) -> server/lib/media/file-upload/ufs Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…server/lib #40728 (merged on develop after Phase 6e) added app/integrations/server/functions/clearIntegrationHistory.ts at the old location; relocate it to server/lib/integrations/functions/ and fix its imports of already-moved modules (notifications core, triggerHandler). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
df4b5bc to
c6f1e22
Compare
Proposed changes
Phase 6 of the backend folder-structure migration: move the remaining feature-specific server code — auth providers, hooks, notification/messaging libraries, media, importers, and misc libs — from
app/*/server/intoserver/lib/<domain>/andserver/hooks/<domain>/, with the matching EE mirror insideee/server/. Files move as-is — only import paths change, no refactoring.Stray Meteor method files found along the way (crowd, push, search, cloud, and the deferred
methods/dirs from Phase 5) were routed toserver/meteor-methods/<domain>/— including the newmedia/domain — keeping the Phase 5 invariant that all Meteor methods live inmeteor-methods/.Please read comment with detailed information on the changes that are not plain file moves / path rewrites: #41315 (comment)
Folder structure
Community — before
Community — after (one commit per sub-phase)
EE mirror — before / after (stays inside
ee/)Before
After
→
ee/app/{canned-responses,license,message-read-receipt}/serverand all EE hooks dirs removed. No file crossed the license boundary in either direction (enforced by the move script's guard).Deviations from the plan (each for a concrete reason)
threads/server/hooks/aftersavemessage.ts→server/hooks/messages/processThreads.ts— it would case-collide withafterSaveMessage.tsin the same folder on case-insensitive filesystems (macOS/Windows). Named after its exportedprocessThreads.isImagePreviewSupported.ts→server/lib/media/file-upload/— the plan routed it tometeor-methods/media/, but it's a pure helper (noMeteor.methodscall); putting it there would permanently trip the registration audit.linkedin+meteor-developerOAuth providers were missing from the plan's 6a table — moved toserver/lib/auth-providers/(same shape as dolphin/drupal).app/file-upload/ufs/(S3/GoogleStorage/Webdav server adapters) wasn't listed but is server-only and imported solely by the moved config files — moved toserver/lib/media/file-upload/ufs/.ee/server/hooks/canned-responses/) instead of the table's flatee/server/hooks/, matching the existingabac//federation//messages/layout.index.tsaggregators were folded intoimportPackages.ts/meteor-methods/index.tsand deleted (32 files). Indexes containing real code (importer container, cloud cron startup, e2e callback registration, re-export barrels) moved as-is.ee/app/authorization/lib/addRoleRestrictions.tsand the unusedAuthorization.addRoleRestrictionsservice method. The function's only call site ever was client-side and was removed in chore: move all webclient code out of the COSS folders #32273 — since then the module was only side-effect imported, defining a function nobody called. Surfaced by review, removed deliberately rather than relocated.Verification
yarn lint --quiet✅ (exit 0)tsc --noEmit✅ (exit 0, standalone)server/meteor-methods/+ee/server/meteor-methods/is registeredverify-no-old-imports.mjsover every Phase 6 source path ✅ ·check-broken-imports.mjs: every relative import in the tree resolves ✅🤖 Generated with Claude Code