chore: allow parameterless internalError calls#40756
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 |
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro 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 of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
WalkthroughThe PR refines TypeScript typings for internal error handling: ChangesInternal Error Type Refinements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #40756 +/- ##
===========================================
- Coverage 69.76% 69.72% -0.04%
===========================================
Files 3327 3327
Lines 123134 123134
Branches 21987 21933 -54
===========================================
- Hits 85904 85858 -46
- Misses 33869 33915 +46
Partials 3361 3361
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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/app/api/server/definition.ts`:
- Line 365: The error branch is incorrectly inferring all non-200 error payloads
from TResponse[500]; update the InternalError generic to use the current status
key so the payload type is TResponse[K] instead of TResponse[500]. Locate the
occurrence of InternalError<InferNon200Result<TResponse[500]>, K> (in the
response/error type construction) and change it to
InternalError<InferNon200Result<TResponse[K]>, K> so each error status (e.g.,
501/502) infers its own payload via TResponse[K].
🪄 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
Run ID: 08561b3e-9bd0-4ea6-bef3-54ce1e38f9dc
📒 Files selected for processing (2)
apps/meteor/app/api/server/ApiClass.tsapps/meteor/app/api/server/definition.ts
📜 Review details
⏰ 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). (6)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- GitHub Check: 🔎 Code Check / Code Lint
- GitHub Check: 🔎 Code Check / TypeScript
- GitHub Check: 🔨 Test Unit / Unit Tests
- GitHub Check: 📦 Meteor Build (coverage)
🧰 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/app/api/server/ApiClass.tsapps/meteor/app/api/server/definition.ts
🧠 Learnings (3)
📚 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/app/api/server/ApiClass.tsapps/meteor/app/api/server/definition.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/app/api/server/ApiClass.tsapps/meteor/app/api/server/definition.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/app/api/server/ApiClass.tsapps/meteor/app/api/server/definition.ts
🔇 Additional comments (1)
apps/meteor/app/api/server/ApiClass.ts (1)
349-361: LGTM!
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Proposed changes (including videos or screenshots)
Fixes a TypeScript compilation error (
Type 'unknown' is not assignable to type 'InternalErrorResponse') that occurs when callingAPI.v1.internalError()without arguments in endpoints strictly typed with AJV schemas.There were two underlying typing issues preventing parameterless calls to
internalErrorfrom passing strict AJV schema validations:internalError()was called without arguments, TypeScript inferred the genericTasunknown.definition.ts,ErrorStatusCodes(500) was usingInferResult<TResponse[500]>instead ofInferNon200Result. This caused the framework to expect the entire response object ({ success: false, error: string }) as the generic type instead of just extracting theerrorpayload type, unlike how 401, 403, and 404 errors are handled.Issue(s)
CORE-2277 Fix TypeScript compilation error on parameterless API.v1.internalError() calls
Steps to test or reproduce
Further comments
Summary by CodeRabbit
Note: These are internal infrastructure improvements with no user-visible changes.