-
Notifications
You must be signed in to change notification settings - Fork 13k
chore: make Prune Messages read from message.files as well
#38084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
WalkthroughA query in the Messages model was broadened to match messages with either single ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
⏰ 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). (3)
🔇 Additional comments (2)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/models/src/models/Messages.ts (1)
56-56: UpdatefindFilesByUserId,getMessageByFileId, andgetMessageByFileIdAndUsernamefor consistency with multi-file attachment support, or clarify if scope limitation is intentional.The
findFilesByRoomIdPinnedTimestampAndUsersfunction has been updated to query bothfile._idandfiles._idusing an$orclause, indicating multi-file support. However:
- Only an index for
'file._id': 1exists; querying'files._id'will lack index support.- Other file-related functions (
findFilesByUserId,getMessageByFileId,getMessageByFileIdAndUsername) still check only'file._id', creating inconsistency in multi-file support across the codebase.Either extend these functions to also handle
'files._id'for consistency, or clarify if the scope limitation is intentional and document the single-file-only queries appropriately.
📜 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)
packages/models/src/models/Messages.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:
packages/models/src/models/Messages.ts
⏰ 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). (3)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: 📦 Build Packages
- GitHub Check: CodeQL-Build
🔇 Additional comments (2)
packages/models/src/models/Messages.ts (2)
791-798: LGTM! Backward-compatible file detection.The
$orclause correctly handles both legacy single-file messages (file._id) and new multi-file messages (files._id), ensuring the Prune Messages feature identifies all file attachments regardless of structure.
805-805: Correct removal of projection mismatch.Removing the projection aligns the actual return value with the declared return type
FindCursor<IMessage>. The PR description confirms callers already specify their own projections as needed.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #38084 +/- ##
===========================================
- Coverage 70.68% 70.67% -0.01%
===========================================
Files 3146 3146
Lines 108829 108829
Branches 19558 19558
===========================================
- Hits 76924 76920 -4
- Misses 29903 29907 +4
Partials 2002 2002
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Proposed changes (including videos or screenshots)
Make the Prune Messages feature detect files in the
IMessage.filesarray as well as the oldIMessage.filesingle attribute.This change should have no impact on develop but is needed once the multi-file upload is merged.
The index for
files._idwill be added on a separate PR.Issue(s)
CORE-1601
Steps to test or reproduce
Further comments
Removed the default projection from that query because it doesn't match the return type and the only place that calls this function is specifying its own projection.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.