-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
fix(polymorphism): wrong query result when selecting "_count" #1124
Conversation
WalkthroughWalkthroughThis update enhances the Changes
Assessment against linked issues
Related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration 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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- packages/runtime/src/enhancements/delegate.ts (2 hunks)
- tests/integration/tests/enhancements/with-delegate/issue-1123.test.ts (1 hunks)
Additional comments: 4
tests/integration/tests/enhancements/with-delegate/issue-1123.test.ts (2)
- 3-39: The test setup, including schema definition and data creation, is well-structured and relevant to the issue being tested. However, consider adding more diverse data to thoroughly test the polymorphic relationships and
_count
functionality across different scenarios.- 41-45: The assertion correctly verifies the primary scenario related to issue Incorrect query result when "_count" is included in select clause #1123. Consider adding more assertions to cover edge cases, such as querying for content with no likes or multiple likes, to ensure comprehensive test coverage.
packages/runtime/src/enhancements/delegate.ts (2)
- 1106-1136: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1109-1177]
The implementation of
assembleUp
andassembleDown
methods to merge entity data across base and derived models is a critical enhancement for handling polymorphic relationships. Ensure thorough testing of these methods, especially in complex inheritance scenarios and when dealing with nested relationships.
- 1106-1136: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-1177]
The enhancements to the
DelegateProxyHandler
class introduce significant complexity. To ensure maintainability, consider adding detailed comments explaining the logic behind critical sections, especially those involving polymorphic model handling and data assembly. Additionally, evaluate if some of the logic can be refactored into smaller, more manageable methods or helper classes.
Fixes #1123
Summary by CodeRabbit