-
-
Notifications
You must be signed in to change notification settings - Fork 17
chore: minor typing and export updates to ORM and SDK #515
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. WalkthroughThis change adds documentation-only JSDoc annotations marking internal APIs as private in ORM client files, and exposes a new AST barrel export from the SDK package through package.json exports and updated build configuration. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (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)
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 |
|
Claude finished @ymc9's task —— View job PR Code Review: Minor typing and export updatesI've thoroughly reviewed this PR and the changes look good overall. Here's my detailed analysis: Review Progress:
Code Quality Assessment✅ Positive Changes
|
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 makes minor typing and export updates to improve the ORM and SDK packages. The main purpose is to add a new AST export path in the SDK package and temporarily disable plugin function support while marking the feature for future revisiting.
- Added a new
/astexport subpath in the SDK package that re-exports@zenstackhq/language/ast - Simplified function lookup by temporarily disabling plugin-based custom function implementations
- Marked the
functionsfield inClientOptionsas private
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/sdk/tsup.config.ts | Adds AST as a new build entry point |
| packages/sdk/src/ast.ts | Creates new file that re-exports all AST types from language package |
| packages/sdk/package.json | Adds package.json exports configuration for the new /ast subpath |
| packages/plugins/policy/src/expression-transformer.ts | Simplifies function lookup to only check clientOptions, comments out plugin function checking logic |
| packages/orm/src/client/plugin.ts | Comments out the functions field from RuntimePlugin interface and removes ZModelFunction import |
| packages/orm/src/client/options.ts | Adds @Private JSDoc annotation to the functions field |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/orm/src/client/options.ts(1 hunks)packages/orm/src/client/plugin.ts(1 hunks)packages/plugins/policy/src/expression-transformer.ts(1 hunks)packages/sdk/package.json(1 hunks)packages/sdk/src/ast.ts(1 hunks)packages/sdk/tsup.config.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.{ts,tsx} : Implement plugin hooks at ORM, Kysely, and entity mutation levels for query interception and customization
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.{ts,tsx} : Use Kysely as the query builder interface for low-level database queries, avoiding raw SQL when possible
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.test.{ts,tsx} : ORM package tests should include comprehensive client API tests and policy tests
Applied to files:
packages/orm/src/client/options.tspackages/orm/src/client/plugin.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.{ts,tsx} : Implement plugin hooks at ORM, Kysely, and entity mutation levels for query interception and customization
Applied to files:
packages/orm/src/client/options.tspackages/orm/src/client/plugin.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.{ts,tsx} : Use Kysely as the query builder interface for low-level database queries, avoiding raw SQL when possible
Applied to files:
packages/orm/src/client/plugin.tspackages/sdk/src/ast.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to **/*.zmodel : ZModel schema files should define database structure and policies that compile to TypeScript via `zenstack generate`
Applied to files:
packages/orm/src/client/plugin.tspackages/sdk/src/ast.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). (4)
- GitHub Check: Agent
- GitHub Check: build-test (20.x, sqlite)
- GitHub Check: build-test (20.x, postgresql)
- GitHub Check: claude-review
🔇 Additional comments (5)
packages/sdk/src/ast.ts (1)
1-1: LGTM! Clean barrel export for AST utilities.The new export path is properly configured across package.json and tsup.config.ts, providing a clean public API for AST-related functionality.
packages/orm/src/client/options.ts (1)
53-56: JSDoc @Private annotation documents intent but doesn't enforce privacy.The
@privateannotation signals thatfunctionsis internal, which aligns with restricting function resolution toclientOptionsonly. Note that TypeScript doesn't enforce JSDoc privacy annotations, so the property remains accessible at compile time.packages/sdk/tsup.config.ts (1)
6-6: LGTM! Build entry correctly added for AST export.The new
astentry properly maps tosrc/ast.ts, enabling the build process to generate the necessary artifacts for the./astexport path defined in package.json.packages/sdk/package.json (1)
29-38: LGTM! Export configuration properly defined.The new
./astexport follows the existing pattern for the main export, correctly specifying both ESM and CommonJS entry points with their corresponding type definitions.packages/plugins/policy/src/expression-transformer.ts (1)
556-571: Verify impact of removing plugin function resolution.The
functionsproperty has been removed from theRuntimePlugininterface (packages/orm/src/client/plugin.ts, lines 26-30 are commented out), and the plugin function fallback logic ingetFunctionImplhas been disabled (lines 558-569 are commented out). This represents an intentional behavioral change where function lookup now only checksclientOptions.functions, completely bypassing any custom functions that plugins might provide. No existing plugins in the codebase implement this functionality, but this change constrains the extensibility of the custom function system going forward. Both locations contain matching "TODO: revisit later" comments, suggesting this decision may be reconsidered.
|
Claude finished @ymc9's task —— View job PR Code Review: Minor typing and export updatesReview Progress:
Code Quality Assessment✅ Positive Changes
|
Summary by CodeRabbit
Release Notes
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.