Conversation
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…olicy expressions (#2532) Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
…onnect When creating a model with a nested many-to-many `connect`, the join table insert triggered an update-policy check on the just-created entity. Because the connection doesn't exist yet at check time, relation-based policies (e.g. `parents?[id == auth().id]`) always evaluated to false, causing a spurious "not updatable" error. Fix by embedding a lightweight marker in the insert query's end-modifier comment so the policy handler can identify the newly-created side and skip its circular update check. The connected side's update policy is still enforced. Adds regression test for issue #2531. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ide on connect" This reverts commit 59d302d.
|
Claude finished @ymc9's task —— View job PR Review: merge dev to main (v3.5.3)I've completed my analysis of this release PR that merges dev to main for v3.5.3. Here's my comprehensive review: Todo List:
Scope AnalysisThis is a standard release PR with primarily version bumps across 20+ packages (v3.5.2 → v3.5.3), plus some important core functionality improvements: Core Changes:
Code Quality & Best Practices ✅Excellent Standards:
Minor Observations:
Potential Bugs & Issues ✅No Critical Issues Found:
Performance Considerations ✅Positive Impact:
Multi-hop Relation Traversal:
Security Concerns ✅No Security Issues:
Test Coverage ✅Excellent Coverage:
Overall Assessment ✅This is a high-quality release PR with: Strengths:
Minor Suggestions:
Recommendation: APPROVE ✅This release is ready for production. The changes address legitimate issues with proper testing, maintain backwards compatibility, and follow ZenStack's architectural patterns consistently. |
📝 WalkthroughWalkthroughMonorepo version bump from 3.5.2 to 3.5.3 across package.json files with metadata restructuring (displayName, structured author/repository/funding fields). Enhanced ORM dialect system with type-aware SQL comparison logic. Extended policy plugin with operation/thisType context and currentModel/currentOperation expression functions, including relation-aware field resolution. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/orm/src/client/crud/dialects/base-dialect.ts (1)
1498-1506: Add a comment documenting why MySQL/SQLite don't overridebuildComparisonfor@db.*attributes.PostgreSQL explicitly overrides
buildComparisonto handle@db.*type-override attributes with type casting logic (seeresolveFieldSqlTypeand the casting in lines 477-489). MySQL and SQLite inherit the base implementation and silently ignore@db.*attributes. Add a brief comment here clarifying whether this is intentional (those providers don't need type casting) or if it warrants follow-up.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/orm/src/client/crud/dialects/base-dialect.ts` around lines 1498 - 1506, The buildComparison method in base-dialect.ts currently returns this.eb(...) without handling `@db`.* type-override attributes; add a concise inline comment above buildComparison explaining why MySQL/SQLite dialects do not override this (e.g., "MySQL/SQLite intentionally inherit base buildComparison because these providers do not require explicit type casting for `@db`.* overrides at comparison time" or if uncertain, mark as TODO to follow up), and mention resolveFieldSqlType and the PostgreSQL override as the contrasting example so future readers know where to look (reference: buildComparison and resolveFieldSqlType).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/orm/src/client/crud/dialects/base-dialect.ts`:
- Around line 1498-1506: The buildComparison method in base-dialect.ts currently
returns this.eb(...) without handling `@db`.* type-override attributes; add a
concise inline comment above buildComparison explaining why MySQL/SQLite
dialects do not override this (e.g., "MySQL/SQLite intentionally inherit base
buildComparison because these providers do not require explicit type casting for
`@db`.* overrides at comparison time" or if uncertain, mark as TODO to follow up),
and mention resolveFieldSqlType and the PostgreSQL override as the contrasting
example so future readers know where to look (reference: buildComparison and
resolveFieldSqlType).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a7043b30-c62c-4155-a93c-252da89f33d5
📒 Files selected for processing (30)
package.jsonpackages/auth-adapters/better-auth/package.jsonpackages/cli/package.jsonpackages/clients/client-helpers/package.jsonpackages/clients/tanstack-query/package.jsonpackages/common-helpers/package.jsonpackages/config/eslint-config/package.jsonpackages/config/typescript-config/package.jsonpackages/config/vitest-config/package.jsonpackages/create-zenstack/package.jsonpackages/ide/vscode/package.jsonpackages/language/package.jsonpackages/orm/package.jsonpackages/orm/src/client/crud/dialects/base-dialect.tspackages/orm/src/client/crud/dialects/postgresql.tspackages/plugins/policy/package.jsonpackages/plugins/policy/src/expression-evaluator.tspackages/plugins/policy/src/expression-transformer.tspackages/schema/package.jsonpackages/sdk/package.jsonpackages/server/package.jsonpackages/testtools/package.jsonpackages/zod/package.jsonsamples/orm/package.jsontests/e2e/package.jsontests/regression/package.jsontests/regression/test/issue-2394.test.tstests/regression/test/issue-2536.test.tstests/runtimes/bun/package.jsontests/runtimes/edge-runtime/package.json
Summary by CodeRabbit
New Features
currentModel()andcurrentOperation()functions for policy expressions to reference the active model and CRUD operation.Bug Fixes
Chores