-
-
Notifications
You must be signed in to change notification settings - Fork 12
fix(policy): always wrap mutation in a transaction #276
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
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughReworks the query executor to pass explicit connections, manage mutations within optional transactions, and streamline hook/interceptor flows; introduces a ZenStackError base class and updates several error types; and adjusts policy tests and migrated test setup to current APIs and imports. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🧰 Additional context used📓 Path-based instructions (1){packages,samples,tests}/**📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧬 Code graph analysis (2)packages/runtime/src/client/executor/zenstack-query-executor.ts (2)
packages/runtime/src/plugins/policy/errors.ts (1)
⏰ 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). (2)
🔇 Additional comments (16)
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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
|
Claude finished @ymc9's task —— View job PR Review: Transaction Wrapping for MutationsTodo List:
Review SummaryThis PR implements a significant architectural improvement by always wrapping mutations in transactions. The changes simplify the transaction handling logic while ensuring data consistency for all mutation operations. Key Changes1. Simplified Transaction Management (
|
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.
Pull Request Overview
This PR fixes a transaction handling issue in the policy system by ensuring all mutations are consistently wrapped in transactions, simplifying the complex conditional transaction logic.
- Removes the conditional transaction creation based on plugin requirements and instead wraps all mutations in transactions by default
- Simplifies the query execution flow by eliminating the complex nested transaction handling logic
- Updates test expectations to use the correct API methods (
executeTakeFirstinstead ofexecuteandnumUpdatedRowsinstead ofnumAffectedRows)
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/runtime/src/client/executor/zenstack-query-executor.ts | Refactored transaction handling to always wrap mutations in transactions and simplified the query execution flow |
| packages/runtime/test/policy/crud/post-update.test.ts | Re-enabled a skipped test and updated API calls to use correct methods and property names |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Claude finished @ymc9's task —— View job PR Review: Transaction Wrapping for MutationsTodo List:
Review SummaryThis PR implements a significant architectural improvement by always wrapping mutations in transactions. The changes simplify the transaction handling logic while ensuring data consistency for all mutation operations. Key Changes Analysis1. Simplified Transaction Management (
|
Summary by CodeRabbit
New Features
Refactor
Tests