chore: Enable Meteor's *Modern Build Stack*#37614
Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
WalkthroughSwitches the Meteor app to the modern build stack: adds an SWC config targeting ES2022, moves JSX runtime to automatic via presets, updates Meteor platforms/packages and package.json build flags, injects SWC coverage instrumentation in CI, and replaces Changes
Sequence Diagram(s)sequenceDiagram
participant CI as GitHub Actions
participant Repo as Repository (.swcrc/.babelrc)
participant Builder as Meteor Build (SWC)
participant App as Meteor App (runtime)
participant Collector as Coverage artifacts & CI tools
CI->>Repo: detect BABEL_ENV==coverage
CI->>Repo: read and inject swc-plugin-coverage-instrument into .swcrc
CI->>Builder: trigger build using updated .swcrc
Builder->>App: produce instrumented bundle (SWC)
App->>Collector: emit per-shard __coverage__ JSON on exit
CI->>Collector: merge shards (nyc merge) and upload (Codecov)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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: 0
🧹 Nitpick comments (1)
packages/core-typings/package.json (1)
6-26: Build surface for@rocket.chat/core-typingslooks good; reconsider always-failingtestscriptPositives:
- Adding
main,typings, andfiles: ["/dist"]plus thetsc/ts-patch/typia patchpipeline makes this package behave like a standard compiled TS workspace module.- Dependencies on
@rocket.chat/icons,@rocket.chat/message-parser,@rocket.chat/ui-kit, and the patchedtypiaare consistent with the broader monorepo setup.One caution:
- The
testscript currently runsecho "no tests" && exit 1, which will always fail. If your roottestcommand or CI uses a workspace-widetestscript runner, this package will cause the entire test job to fail even when “no tests” is expected.If this package isn’t yet supposed to have tests, consider either:
- Returning success instead (e.g.
echo "no tests" && exit 0), or- Omitting the
testscript and relying on the root tooling to skip packages without tests.That keeps the door open for adding real tests later without surprising CI failures in the meantime.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (2)
.yarn/patches/typia-npm-9.7.2-5c5d9c80b4.patchis excluded by!**/.yarn/**yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (6)
apps/meteor/.babelrc(1 hunks)apps/meteor/.meteor/platforms(1 hunks)apps/meteor/.swcrc(1 hunks)apps/meteor/package.json(2 hunks)packages/core-typings/package.json(1 hunks)packages/ui-kit/package.json(1 hunks)
⏰ 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). (14)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 5.0 (3/5)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 8.2 [legacy watchers] coverage (5/5)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 5.0 (4/5)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 8.2 [legacy watchers] coverage (1/5)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 8.2 [legacy watchers] coverage (4/5)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 5.0 (2/5)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 8.2 [legacy watchers] coverage (3/5)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 8.2 [legacy watchers] coverage (2/5)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 5.0 (5/5)
- GitHub Check: 🔨 Test UI (CE) / MongoDB 8.2 (1/4)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 5.0 (1/5)
- GitHub Check: 🔨 Test UI (CE) / MongoDB 8.2 (2/4)
- GitHub Check: 🔨 Test UI (CE) / MongoDB 8.2 (4/4)
- GitHub Check: 🔨 Test API (EE) / MongoDB 5.0 (1/1)
🔇 Additional comments (6)
apps/meteor/.swcrc (1)
1-9: SWC React/runtime config looks correct and aligns with Meteor’s SWC docs
jsc.target: "es2022"plustransform.react.runtime: "automatic"matches the documented way to enable the automatic React JSX runtime via.swcrcfor Meteor’s modern SWC-based stack.(docs.meteor.com) This should keep Babel and SWC behavior consistent.Just confirm this target is compatible with the browsers you intend to support (given
browserslist: ["defaults"]) and adjust if you still need older engines.apps/meteor/.meteor/platforms (1)
1-3: Platforms configuration matches Meteor’s modern build stack guidanceHaving:
serverbrowsermodernin
.meteor/platformsmatches the example Meteor gives for excluding legacy bundles in production when using the modern build stack.(fossies.org) This looks correct; just ensure you’re comfortable dropping legacy browser bundles in production.apps/meteor/.babelrc (1)
4-4: Using@babel/preset-reactwithruntime: "automatic"is a clean JSX setupSwitching JSX handling to
@babel/preset-reactwithruntime: "automatic"is idiomatic and avoids the need for the old JSX transform plugin. It aligns Babel’s JSX behavior with your SWCreact.runtime = "automatic"config, reducing divergence between toolchains.No issues from a config perspective; just verify your tests/Storybook don’t rely on the classic JSX runtime assumptions.
packages/ui-kit/package.json (1)
34-34: Typia patched dependency is consistent with the workspace patch strategyPointing
typiato the Yarnpatch:spec keeps this package aligned with the rest of the workspace’s patched typia usage and with thets-patch/typia patchbuild step already defined in scripts.Please just double‑check that:
- The patch file
typia-npm-9.7.2-5c5d9c80b4.patchis present under the expected.yarn/patchespath in the repo, and- Your Yarn version in CI/dev fully supports this
patch:URL form.apps/meteor/package.json (2)
454-454: App-level typia patch keeps runtime dependency in sync with patched toolchainUpdating the app’s
typiadependency to the same Yarnpatch:spec used in other packages keeps the runtime dependency aligned with your patched compiler/tooling setup. That should avoid version skew between wheretypiais used to generate types and where it’s used at runtime.As with the other packages, just confirm the patch file is present in
.yarn/patchesand that CI uses the same Yarn version that generated this spec.
467-477: Meteor modern build flags and browserslist changes look coherent; confirmdisableLegacyBuildsemantics
"meteor": { "modern": true, ... }is exactly how Meteor recommends enabling the modern build stack (SWC transpiler, modern bundler/dev‑server behavior).(docs.meteor.com)- Combined with
.meteor/platformsincludingmodern, this should drop legacy browser bundles in production while using the modern stack during dev.Two things worth double‑checking:
disableLegacyBuild: this flag isn’t clearly surfaced in the public Meteor docs yet. Please confirm your target Meteor version actually recognizes it (and that it does what you expect) rather than silently ignoring it.browserslist: ["defaults"]: this is a sensible general target, but it may differ slightly from your old"last 2 versions", "Firefox ESR"set. Confirm this matches the actual browser support policy you want for the app.If both match your intentions, the overall config is consistent with Meteor’s modern stack guidance.
There is a pending issue with coverage
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #37614 +/- ##
===========================================
- Coverage 70.54% 70.13% -0.41%
===========================================
Files 3274 3273 -1
Lines 116914 116239 -675
Branches 21101 20783 -318
===========================================
- Hits 82482 81530 -952
+ Misses 32375 31416 -959
- Partials 2057 3293 +1236
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
650083d to
31f683f
Compare
7d76e1a to
4728aa1
Compare
56f60ea to
e171229
Compare
|
/jira ARCH-2083 |
There was a problem hiding this comment.
1 issue found across 12 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/ui-kit/package.json">
<violation number="1" location="packages/ui-kit/package.json:34">
P2: The patch path points to a user home directory ("~/.yarn/patches"), which won’t exist in CI or other machines. Use a repo-relative patch path so installs are reproducible.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
8dbcddd to
9f7571f
Compare
zodern:standard-minifier-js@5.3.1 is not compatible with Meteor's modern build stack (disableLegacyBuild + modern: true), causing minification errors: "Identifier 'r' has already been declared". Meteor 3.3+ ships with SWC-based minification in the official standard-minifier-js package, which handles modern builds correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The typia patch renames `import * as module` to `import * as _module` in typia's ESM entry point. Without it, the minifier fails with "Identifier 'module' has already been declared" because Meteor's bundler injects its own `module` variable in the same scope. Applied the patch to core-typings as well (was missing). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add swc-plugin-coverage-instrument as a dependency and inject it into .swcrc during CI coverage builds. This replaces the babel-plugin-istanbul approach which doesn't work with SWC transpilation. The CI injects the plugin into .swcrc when BABEL_ENV=coverage, keeping the same build pipeline (SWC) for both regular and coverage builds. Tested locally: 1625 __coverage__ and 78835 cov_ entries in the bundle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Explains how build-time coverage works with the modern SWC build stack, the rocketchat:coverage runtime package, and the CI workflow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9f7571f to
dc0e01d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
docs/coverage.md (2)
17-19: Add language identifier to the fenced code block.The ASCII diagram should specify a language identifier (e.g.,
text) to satisfy markdown linting rules.📝 Proposed fix
-``` +```text Build (SWC + plugin) --> Run tests --> Process exit triggers report --> Merge & upload</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@docs/coverage.mdaround lines 17 - 19, Update the fenced code block that
contains the ASCII diagram "Build (SWC + plugin) --> Run tests --> Process
exit triggers report --> Merge & upload" to include a language identifier
(e.g., usetext instead of) so the markdown linter recognizes the block
type; ensure only the opening backticks are modified and the diagram content
remains unchanged.</details> --- `110-110`: **Simplify the package append command.** The `echo -e "rocketchat:coverage\n"` command may behave inconsistently across shells. The explicit `\n` in the string is unnecessary since `echo` already adds a newline, and `-e` interpretation varies by shell (BSD vs GNU). <details> <summary>🔧 Proposed fix for portability</summary> ```diff # Add the coverage package -echo -e "rocketchat:coverage\n" >> .meteor/packages +echo "rocketchat:coverage" >> .meteor/packages ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary> ``` Verify each finding against the current code and only fix it if needed. In `@docs/coverage.md` at line 110, Replace the brittle echo invocation that uses -e and an explicit \n with a simple, portable append: write the literal package name "rocketchat:coverage" into the .meteor/packages file using a plain echo (no -e) so shells that differ in echo implementation behave consistently; locate the line containing the echo command that appends rocketchat:coverage and change it to use a simple echo of the package name (or alternatively use printf) to append a single newline reliably. ``` </details> </blockquote></details> </blockquote></details> <details> <summary>🤖 Prompt for all review comments with AI agents</summary>Verify each finding against the current code and only fix it if needed.
Inline comments:
In@docs/coverage.md:
- Around line 102-107: The local dev script currently overwrites
swcrc.jsc.experimental instead of merging plugins; update the script so it
preserves existing swcrc.jsc.experimental and its plugins by ensuring
swcrc.jsc.experimental = swcrc.jsc.experimental || {} and
swcrc.jsc.experimental.plugins = swcrc.jsc.experimental.plugins || [], then push
['swc-plugin-coverage-instrument', {}] onto that plugins array (instead of
replacing the entire experimental object) so other experimental settings/plugins
remain intact.
Nitpick comments:
In@docs/coverage.md:
- Around line 17-19: Update the fenced code block that contains the ASCII
diagram "Build (SWC + plugin) --> Run tests --> Process exit triggers report
--> Merge & upload" to include a language identifier (e.g., usetext instead of) so the markdown linter recognizes the block type; ensure only the
opening backticks are modified and the diagram content remains unchanged.- Line 110: Replace the brittle echo invocation that uses -e and an explicit \n
with a simple, portable append: write the literal package name
"rocketchat:coverage" into the .meteor/packages file using a plain echo (no -e)
so shells that differ in echo implementation behave consistently; locate the
line containing the echo command that appends rocketchat:coverage and change it
to use a simple echo of the package name (or alternatively use printf) to append
a single newline reliably.</details> <details> <summary>🪄 Autofix (Beta)</summary> Fix all unresolved CodeRabbit comments on this PR: - [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended) - [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes </details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Organization UI **Review profile**: CHILL **Plan**: Pro **Run ID**: `a8871db6-02ce-4cec-9b64-e1f572fce2b8` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 8dbcddd48b9d648b3cdfdaff1f7f495b8945894f and dc0e01dd5fc2678a32b560074bf6284cf91e059f. </details> <details> <summary>⛔ Files ignored due to path filters (2)</summary> * `.yarn/patches/typia-npm-9.7.2-5c5d9c80b4.patch` is excluded by `!**/.yarn/**` * `yarn.lock` is excluded by `!**/yarn.lock`, `!**/*.lock` </details> <details> <summary>📒 Files selected for processing (10)</summary> * `.github/actions/meteor-build/action.yml` * `apps/meteor/.babelrc` * `apps/meteor/.meteor/packages` * `apps/meteor/.meteor/platforms` * `apps/meteor/.meteor/versions` * `apps/meteor/.swcrc` * `apps/meteor/package.json` * `docs/coverage.md` * `packages/core-typings/package.json` * `packages/ui-kit/package.json` </details> <details> <summary>✅ Files skipped from review due to trivial changes (5)</summary> * apps/meteor/.meteor/platforms * apps/meteor/.swcrc * apps/meteor/.babelrc * packages/ui-kit/package.json * packages/core-typings/package.json </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (4)</summary> * apps/meteor/.meteor/packages * apps/meteor/.meteor/versions * .github/actions/meteor-build/action.yml * apps/meteor/package.json </details> </details> <details> <summary>📜 Review details</summary> <details> <summary>⏰ 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). (1)</summary> * GitHub Check: CodeQL-Build </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🧠 Learnings (2)</summary> <details> <summary>📓 Common learnings</summary> ``` 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: 0 File: :0-0 Timestamp: 2026-02-24T19:05:56.710Z Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit. ``` ``` Learnt from: ahmed-n-abdeltwab Repo: RocketChat/Rocket.Chat PR: 0 File: :0-0 Timestamp: 2026-02-24T19:05:56.710Z Learning: In Rocket.Chat PRs, keep feature PRs free of unrelated lockfile-only dependency bumps; prefer reverting lockfile drift or isolating such bumps into a separate "chore" commit/PR, and always use yarn install --immutable with the Yarn version pinned in package.json via Corepack. ``` </details> <details> <summary>📚 Learning: 2026-01-08T15:03:59.621Z</summary> ``` Learnt from: d-gubert Repo: RocketChat/Rocket.Chat PR: 38068 File: apps/meteor/tests/data/apps/app-packages/README.md:14-16 Timestamp: 2026-01-08T15:03:59.621Z Learning: For the RocketChat/Rocket.Chat repository, do not analyze or report formatting issues (such as hard tabs vs spaces, line breaks, etc.). The project relies on automated linting tools to enforce formatting standards. ``` **Applied to files:** - `docs/coverage.md` </details> </details><details> <summary>🪛 LanguageTool</summary> <details> <summary>docs/coverage.md</summary> [uncategorized] ~27-~27: The official name of this software platform is spelled with a capital “H”. Context: ...` at build time. This is configured in `.github/actions/meteor-build/action.yml`: ```y... (GITHUB) </details> </details> <details> <summary>🪛 markdownlint-cli2 (0.22.0)</summary> <details> <summary>docs/coverage.md</summary> [warning] 17-17: Fenced code blocks should have a language specified (MD040, fenced-code-language) </details> </details> </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
https://rocketchat.atlassian.net/browse/ARCH-1911
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments
Summary by CodeRabbit
Chores
Documentation
Task: ARCH-2093