refactor: Use WHATWG URL instead of node url/querystring - #41529
Conversation
The node:url and node:querystring modules are unavailable outside the Meteor bundle; parseQuoteAttachment now uses the standard URL API.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Looks like this PR is ready to merge! 🎉 |
|
|
/jira ARCH-2086 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (5)
WalkthroughThe E2EE quote attachment parser removes Node-specific URL and querystring imports, uses the global ChangesE2EE quote attachment parsing
Estimated code review effort: 2 (Simple) | ~5 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/meteor/client/lib/e2ee/rocketchat.e2e.ts`:
- Around line 737-739: Update the URL message-parameter handling near the msgId
extraction to use urlObj.searchParams.getAll('msg') instead of
Object.fromEntries. Require exactly one msg value before fetching the quoted
message, preserving the existing skip behavior when the parameter is missing or
duplicated.
🪄 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 Plus
Run ID: bbf56111-4396-4b82-a677-b6b607cc58db
📒 Files selected for processing (14)
apps/meteor/client/lib/e2ee/rocketchat.e2e.tsapps/meteor/imports/client/hepburnapps/meteor/imports/client/limaxapps/meteor/imports/client/map-age-cleanerapps/meteor/imports/client/memapps/meteor/imports/client/mimic-fn/index.jsapps/meteor/imports/client/p-deferapps/meteor/imports/client/poly1305-jsapps/meteor/imports/client/query-stringapps/meteor/imports/client/schedulerapps/meteor/imports/client/sodium-nativeapps/meteor/imports/client/sodium-plusapps/meteor/imports/client/split-on-firstapps/meteor/imports/client/strict-uri-encode
💤 Files with no reviewable changes (13)
- apps/meteor/imports/client/map-age-cleaner
- apps/meteor/imports/client/sodium-plus
- apps/meteor/imports/client/strict-uri-encode
- apps/meteor/imports/client/limax
- apps/meteor/imports/client/hepburn
- apps/meteor/imports/client/mem
- apps/meteor/imports/client/poly1305-js
- apps/meteor/imports/client/mimic-fn/index.js
- apps/meteor/imports/client/scheduler
- apps/meteor/imports/client/query-string
- apps/meteor/imports/client/sodium-native
- apps/meteor/imports/client/p-defer
- apps/meteor/imports/client/split-on-first
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
- GitHub Check: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{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/lib/e2ee/rocketchat.e2e.ts
🧠 Learnings (5)
📚 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/lib/e2ee/rocketchat.e2e.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.
Applied to files:
apps/meteor/client/lib/e2ee/rocketchat.e2e.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/lib/e2ee/rocketchat.e2e.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/lib/e2ee/rocketchat.e2e.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/client/lib/e2ee/rocketchat.e2e.ts
🔇 Additional comments (2)
apps/meteor/client/lib/e2ee/rocketchat.e2e.ts (2)
1-2: LGTM!
731-735: 🩺 Stability & AvailabilityPrevent malformed URLs from rejecting quote parsing.
new URL(url)throws for an invalid or non-absolute match. Because this runs insidePromise.all, one malformed URL can reject the entireparseQuoteAttachmentcall. Verify thatgetMessageUrlRegex()guarantees constructor-compatible URLs; otherwise catch the error and skip that match.
There was a problem hiding this comment.
All reported issues were addressed across 14 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #41529 +/- ##
========================================
Coverage 68.63% 68.63%
========================================
Files 4138 4138
Lines 158963 158958 -5
Branches 27895 27915 +20
========================================
- Hits 109098 109097 -1
+ Misses 44724 44713 -11
- Partials 5141 5148 +7
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Read the msg query parameter via searchParams.getAll and skip fetching when it is missing or duplicated, restoring the intended guard that the previous Object.fromEntries collapse made unreachable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
new URL() throws on malformed input, unlike the previous URL.parse(). Since quote URLs come from regex-matched message content, one bad match rejected the whole Promise.all and dropped every quote attachment. Parse inside a try/catch and skip only the offending URL. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
getAll('msg') returns [""] for ?msg=, which passed the length check and
reached chat.getMessage with an empty id (400 error). Guard against
missing, empty, or duplicated msg values in a single check.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Proposed changes (including videos or screenshots)
The
node:urlandnode:querystringmodules are unavailable outside the Meteor bundle. This replaces their usage inparseQuoteAttachmentwith the standard WHATWGURLAPI, and removes the now-unused client import symlinks that were only kept to satisfy those legacy imports.No behavior change — purely a refactor.
Issue(s)
Steps to test or reproduce
Further comments
🤖 Generated with Claude Code
Task: ARCH-2293
Summary by CodeRabbit