chore: chat.update response validation throwing error in dev mode#38075
chore: chat.update response validation throwing error in dev mode#38075kodiakhq[bot] merged 3 commits intodevelopfrom
chat.update response validation throwing error in dev mode#38075Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
WalkthroughThe PR updates response schemas for two chat API endpoints ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 #38075 +/- ##
===========================================
- Coverage 70.67% 70.65% -0.03%
===========================================
Files 3143 3143
Lines 108695 108695
Branches 19538 19530 -8
===========================================
- Hits 76818 76796 -22
- Misses 29878 29895 +17
- Partials 1999 2004 +5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
chat.update response validation throwing error in dev mode
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/meteor/app/api/server/v1/chat.ts (1)
219-222: Apply the same schema fix tochat.pinMessageendpoint.Line 222 still uses
{ $ref: '#/components/schemas/IMessage' }, while the identicalchat.updateendpoint (line 294) was changed to{ type: 'object' }. Since both endpoints normalize messages before returning them and both can contain attachments, thechat.pinMessageresponse schema should be updated consistently.Change line 222 from:
message: { $ref: '#/components/schemas/IMessage' },to:
message: { type: 'object' },
🤖 Fix all issues with AI Agents
In @apps/meteor/app/api/server/v1/chat.ts:
- Around line 291-294: The ajv.compile<{ message: IMessage }> in chat.update
intentionally relaxes the runtime schema (message: { type: 'object' }) while
keeping the compile-time IMessage type as a workaround for typia's
attachment/schema generation limits; update the chat.update code by adding a
clear inline comment explaining this intentional type/schema mismatch, reference
the typia limitation and that normalizeMessagesForUser ensures runtime
normalization, and mention why chat.pinMessage still uses the strict $ref
pattern; optionally add a TODO linking to an upstream typia issue so future
maintainers know to revisit and tighten the schema when typia is fixed.
📜 Review details
Configuration used: Organization 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 selected for processing (1)
apps/meteor/app/api/server/v1/chat.ts
🧰 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/v1/chat.ts
🧠 Learnings (2)
📚 Learning: 2025-09-19T15:15:04.642Z
Learnt from: rodrigok
Repo: RocketChat/Rocket.Chat PR: 36991
File: apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Settings.ts:219-221
Timestamp: 2025-09-19T15:15:04.642Z
Learning: The Federation_Matrix_homeserver_domain setting in apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Settings.ts is part of the old federation system and is being deprecated/removed, so configuration issues with this setting should not be flagged for improvement.
Applied to files:
apps/meteor/app/api/server/v1/chat.ts
📚 Learning: 2025-11-19T18:20:07.720Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: packages/i18n/src/locales/en.i18n.json:918-921
Timestamp: 2025-11-19T18:20:07.720Z
Learning: Repo: RocketChat/Rocket.Chat — i18n/formatting
Learning: This repository uses a custom message formatting parser in UI blocks/messages; do not assume standard Markdown rules. For keys like Call_ended_bold, Call_not_answered_bold, Call_failed_bold, and Call_transferred_bold in packages/i18n/src/locales/en.i18n.json, retain the existing single-asterisk emphasis unless maintainers request otherwise.
Applied to files:
apps/meteor/app/api/server/v1/chat.ts
Proposed changes (including videos or screenshots)
The JSON schema generated by typia does not work well with attachments, causing errors in development mode, so this PR relaxes it.
Introduced in #37138
Issue(s)
CORE-1608
Steps to test or reproduce
Further comments
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.